From rcc
Refactors Claude Code plugins to official best practices via health checks, structural analysis, refactoring plans, execution, and verification. Triggers on refactor/audit requests or drift detection.
npx claudepluginhub wayne930242/reflexive-claude-codeThis skill uses the workspace's default tool permissions.
**Refactoring plugins IS aligning plugin structure with official Claude Code best practices.**
Validates Claude Code plugin structure and manifest, launches agent to fix issues with user confirmation, increments version, re-validates, and reports. For plugin quality optimization.
Assesses Claude Code plugins by analyzing structure, scoring quality, and generating phased refactoring plans with design maps and task files for parallel agent execution.
Audits Claude Code plugins for structure validation, frontmatter quality, deprecations, feature adoption, security patterns, and documentation. Ensures changelog compatibility and best practices for releases.
Share bugs, ideas, or general feedback.
Refactoring plugins IS aligning plugin structure with official Claude Code best practices.
Run health checks, detect structural drift, fix anti-patterns, and verify the result. Plugins differ from agent systems — they have an official schema (plugin.json), auto-discovery conventions, and distribution requirements.
Core principle: A plugin that fails health check will fail in production. Measure first, then fix.
Violating the letter of the rules is violating the spirit of the rules.
Pattern: Skill Steps Handoff: none Next: none
Before ANY action, create task list using TaskCreate:
TaskCreate for EACH task below:
- Subject: "[refactoring-plugins] Task N: <action>"
- ActiveForm: "<doing action>"
Tasks:
Announce: "Created 6 tasks. Starting execution..."
Execution rules:
TaskUpdate status="in_progress" BEFORE starting each taskTaskUpdate status="completed" ONLY after verification passesTaskList to confirm all completedGoal: Locate the plugin to refactor.
Discovery order:
.claude-plugin/plugin.json → use it*/.claude-plugin/plugin.json in working directoryRecord:
Verification: Have a valid plugin directory with .claude-plugin/plugin.json.
Goal: Execute the automated health check script.
Step 1: Run claude plugin validate <plugin-path> (official CLI).
Step 2: Run extended health check: uv run scripts/validate_plugin.py <plugin-path> (or python3). The script integrates CLI validation and adds checks for manifest, structure, skills quality, commands, agents, path safety, and version sync.
Capture output for analysis in Task 3.
Verification: Health check completed with error/warning counts.
Goal: Deep analysis beyond the automated script.
CRITICAL: Read references/plugin-health-checklist.md for the full checklist.
The script catches structural issues. Manual analysis catches:
For each finding, record:
Verification: All 9 checklist categories evaluated.
Goal: Show user the full findings and planned fixes.
Present ALL findings with detail. Do NOT summarize:
Format:
| # | Severity | Category | Component | Issue | Planned Fix |
|---|
Ask: "以上是插件健康檢查結果,要開始修正嗎?"
Verification: User has confirmed the refactoring plan.
Goal: Fix all confirmed issues.
CRITICAL: Read references/plugin-structure-rules.md for official rules and execution order.
CRITICAL: All edits in main conversation. Never delegate writes to subagents.
Verification: Each fix applied and individually verified.
Goal: Re-run health check to confirm all issues resolved.
Process:
validate_plugin.py on the refactored pluginIf issues remain: Return to Task 5 and fix.
Produce final report with changes made (component, change, rationale) and before/after health check metrics.
Verification: Health check passes with zero errors.
| Thought | Reality |
|---|---|
| "Skip health check" | Scripts catch what eyes miss. Always run it. |
| "Structure looks fine" | Anti-patterns hide in config files. Check all 9 categories. |
| "Fix without showing" | User must confirm before structural changes. |
| "Skip re-verification" | Fixes can break other things. Re-run the script. |
| "Simple plugin" | Simple plugins still need valid manifests and naming. |
| "I know the official structure" | Official structure evolves. Verify against the checklist. |
digraph refactor_plugin {
rankdir=TB;
start [label="Refactor\nplugin", shape=doublecircle];
identify [label="Task 1: Identify\nplugin target", shape=box];
health [label="Task 2: Run\nhealth check", shape=box];
analyze [label="Task 3: Analyze\nfindings", shape=box];
present [label="Task 4: Present\nrefactoring plan", shape=box];
confirm [label="User\nconfirms?", shape=diamond];
execute [label="Task 5: Execute\nrefactoring", shape=box];
verify [label="Task 6: Verify\nfixes", shape=box];
pass [label="Zero\nerrors?", shape=diamond];
done [label="Refactoring\ncomplete", shape=doublecircle];
start -> identify;
identify -> health;
health -> analyze;
analyze -> present;
present -> confirm;
confirm -> execute [label="yes"];
confirm -> done [label="no"];
execute -> verify;
verify -> pass;
pass -> done [label="yes"];
pass -> execute [label="no\nfix more"];
}
scripts/validate_plugin.py (cross-platform, supports uv run)