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".
Best use case
optimize-plugin is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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".
Teams using optimize-plugin should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/optimize-plugin/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How optimize-plugin Compares
| Feature / Agent | optimize-plugin | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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**:
1. Resolve path with `realpath` and verify existence
2. Validate `.claude-plugin/plugin.json` exists
3. Find component directories: `commands/`, `agents/`, `skills/`, `hooks/`
4. Validate components against `${CLAUDE_PLUGIN_ROOT}/examples/` templates
5. Assess architecture: if `commands/` exists with `.md` files, use `AskUserQuestion` tool to ask about migrating to skills structure
6. Run validation: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/validate-plugin.py "$TARGET"`
- Options: `--check=structure,manifest,frontmatter,tools,tokens`
- JSON output: `--json`
- Verbose: `-v, --verbose`
7. 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**:
1. Launch `plugin-optimizer:plugin-optimizer` agent 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
2. Agent autonomously applies fixes (MUST use `AskUserQuestion` tool before applying template fixes, presenting violations with specific examples and before/after comparison)
3. Agent increments version in `.claude-plugin/plugin.json` after fixes:
- Patch (x.y.Z+1): Bug fixes
- Minor (x.Y+1.0): New components
- Major (X+1.0.0): Breaking changes
4. 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**:
1. Execute validation script: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/validate-plugin.py "$TARGET"`
2. Analyze results: compare with Phase 1 findings, confirm critical issues resolved
3. If critical issues remain, resume agent execution
4. Generate final validation report using template below
5. Update `README.md` to reflect current state (metadata, directory structure, usage instructions; do not append version history log)
## Validation Report Template
```markdown
## 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]
```Related 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.
update-readme
Updates README.md and README.zh-CN.md to reflect the project's current state. Use this skill whenever the user asks to "update the README", "sync the docs", "update documentation", "reflect latest changes in README", or wants both the English and Chinese READMEs to match the current project. Always triggers when the user mentions updating or regenerating README files, especially for bilingual (EN/ZH) projects.
swiftui-review
Reviews SwiftUI code for best practices on modern APIs, maintainability, and performance. This skill should be used when the user asks to review SwiftUI code, check for deprecated iOS/macOS APIs, validate data flow patterns, or audit accessibility compliance in Swift projects.
writing-plans
Creates executable implementation plans that break down designs into detailed tasks. This skill should be used when the user has completed a brainstorming design and asks to "write an implementation plan" or "create step-by-step tasks" for execution.
systematic-debugging
Provides a systematic debugging methodology with a 4-phase root cause analysis process. This skill should be used when the user reports a bug, error, test failure, or unexpected behavior, ensuring thorough investigation precedes any code changes.
need-vet
This skill should be used when the user invokes /need-vet to enable work verification for the current task. Claude must verify completion and append the verified tag before the session can end.
executing-plans
Executes written implementation plans efficiently using agent teams or subagents. This skill should be used when the user has a completed plan.md, asks to "execute the plan", or is ready to run batches of independent tasks in parallel following BDD principles.
build-like-iphone-team
Applies Apple's Project Purple design philosophy for radical innovation. This skill should be used when the user wants to challenge industry conventions, approach open-ended problems requiring disruptive thinking, or when standard brainstorming needs a breakthrough approach.
brainstorming
Structures collaborative dialogue to turn rough ideas into implementation-ready designs. This skill should be used when the user has a new idea, feature request, ambiguous requirement, or asks to "brainstorm a solution" before implementation begins.
behavior-driven-development
Applies behavior-driven development principles including Gherkin scenarios and test-driven development. This skill should be used when the user asks to implement features, fix bugs, or when writing executable specifications and tests before writing production code.
agent-team-driven-development
Provides guidance on coordinating multiple specialized teammates working in parallel. This skill should be used when the user needs to execute complex implementation plans, resolve cross-cutting concerns, or coordinate independent work streams requiring communication.
shadcn
Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".