Agent skill
optimize-plugin
This skill should be used when the user asks to "validate a plugin", "optimize plugin", "check plugin quality", "review plugin structure", or "run plugin optimizer".
Install this agent skill to your Project
npx add-skill https://github.com/FradSer/dotclaude/tree/main/plugin-optimizer/skills/optimize-plugin
SKILL.md
Plugin Optimization
Execute plugin validation and optimization workflow. Target: $ARGUMENTS
Background Knowledge
Load plugin-optimizer:plugin-best-practices skill using the Skill tool for component templates, tool invocation rules, and type classification.
Phase 1: Discovery & Validation
Goal: Validate structure and detect issues. Orchestrator MUST NOT apply fixes.
Actions:
- Resolve path with
realpathand verify existence - Validate
.claude-plugin/plugin.jsonexists - Find component directories:
commands/,agents/,skills/,hooks/ - Validate components against
${CLAUDE_PLUGIN_ROOT}/examples/templates - Assess architecture: if
commands/exists with.mdfiles, useAskUserQuestiontool to ask about migrating to skills structure - Run validation:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/validate-plugin.py "$TARGET"- Options:
--check=structure,manifest,frontmatter,tools,tokens - JSON output:
--json - Verbose:
-v, --verbose
- Options:
- Compile issues by severity (Critical, Warning, Info)
Phase 2: Agent-Based Optimization
Goal: Launch agent to apply ALL fixes. Orchestrator does NOT make fixes directly.
Condition: Always execute.
Actions:
- Launch
plugin-optimizer:plugin-optimizeragent with the following prompt content:- Target plugin path (absolute path from Phase 1)
- Validation console output (issues list from Phase 1)
- Template validation results
- User decisions (migration choice if applicable)
- INSTRUCTION: Analyze the validation output to identify issues
- Agent autonomously applies fixes (MUST use
AskUserQuestiontool before applying template fixes, presenting violations with specific examples and before/after comparison) - Agent increments version in
.claude-plugin/plugin.jsonafter fixes:- Patch (x.y.Z+1): Bug fixes
- Minor (x.Y+1.0): New components
- Major (X+1.0.0): Breaking changes
- Wait for agent to complete
Path Reference Rules:
- Same directory: Use relative paths (
./reference.md) - Outside directory: Use
${CLAUDE_PLUGIN_ROOT}paths - Component templates: See
${CLAUDE_PLUGIN_ROOT}/examples/
Redundancy & Efficiency:
- Redundancy: Allow strategic repetition of critical content (MUST/SHOULD requirements). Favor concise restatement.
- Efficiency: Agent detects if tasks need Agent Teams (Parallelizable > 5 files, Multi-domain).
Phase 3: Verification & Deliverables
Goal: Verify fixes, generate report, and update documentation.
Actions:
- Execute validation script:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/validate-plugin.py "$TARGET" - Analyze results: compare with Phase 1 findings, confirm critical issues resolved
- If critical issues remain, resume agent execution
- Generate final validation report using template below
- Update
README.mdto reflect current state (metadata, directory structure, usage instructions; do not append version history log)
Validation Report Template
## Plugin Validation Report
### Plugin: [name]
Location: [absolute-path]
Version: [old] -> [new]
### Summary
[2-3 sentences with key statistics]
### Phase 1: Issues Detected
#### Critical ([count])
- `file/path` - [Issue description]
#### Warnings ([count])
- `file/path` - [Issue description]
### Phase 2: Fixes Applied
#### Structure Fixes
- [Fix description]
#### Template Conformance
- **Agents**: [Count] validated, [count] fixed
- **Instruction-type Skills**: [Count] validated, [count] fixed
- **Knowledge-type Skills**: [Count] validated, [count] fixed
#### Redundancy Fixes
- [Consolidations applied]
### Phase 3: Verification Results
- Structure validation: [PASS/FAIL]
- Manifest validation: [PASS/FAIL]
- Component validation: [PASS/FAIL]
- Tool patterns validation: [PASS/FAIL]
- Token budgets validation: [PASS/FAIL]
### Token Budget Analysis
- Skills analyzed: [count]
- Tier 1 (Metadata ~50): [OK count], [WARNING count]
- Tier 2 (SKILL.md ~500): [OK count], [WARNING count], [CRITICAL count]
- Tier 3 (References 2000+ typical): [total tokens]
### Component Inventory
- Commands: [count] found, [count] valid
- Agents: [count] found, [count] valid
- Skills: [count] found, [count] valid
### Remaining Issues
[Issues that couldn't be auto-fixed with explanations]
### Overall Assessment
[PASS/FAIL] - [Detailed reasoning]
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
plugin-best-practices
This skill should be used when the user asks to "validate plugin structure", "review manifest files", "check frontmatter compliance", "verify tool invocation patterns", "explain plugin component types", or needs Claude Code plugin architectural guidance.
init-config
Generates a CLAUDE.md file with AI-driven environment detection and advanced configuration options. This skill should be used when the user asks to "initialize config", "setup claude config", "create CLAUDE.md", or needs help configuring project instructions.
start-feature
Starts working on a new feature branch using git-flow. This skill should be used when the user asks to "start a feature", "create feature branch", "begin new feature", "git flow feature start", or wants to start a new feature.
finish-feature
Finalizes and merges a feature branch into develop using git-flow. This skill should be used when the user asks to "finish a feature", "merge feature branch", "complete feature", "git flow feature finish", or wants to finalize a feature branch.
finish-hotfix
Finalizes a hotfix and merges it into main and develop using git-flow. This skill should be used when the user asks to "finish a hotfix", "merge hotfix branch", "complete hotfix", "git flow hotfix finish", or wants to finalize a hotfix.
finish-release
Finalizes a release and merges it into main and develop with a tag using git-flow. This skill should be used when the user asks to "finish a release", "merge release branch", "complete release", "git flow release finish", or wants to finalize a release.
Didn't find tool you were looking for?