Refactor oversized or multi-domain skills into smaller, purpose-built skills while preserving full fidelity and capability coverage. Use when a skill spans too many topics, exceeds ~500 lines, or would benefit from clearer separation of concerns and independent invocation. This skill reviews the existing content, identifies logical boundaries, designs a split plan, generates new SKILL.md files for each extracted skill, and validates that the refactor maintains complete functional and content parity with the original.
Refactors large AI skills into smaller, focused components while maintaining full functionality and backwards compatibility.
/plugin marketplace add jamie-bitflight/claude_skills/plugin install plugin-creator@jamie-bitflight-skillspath to skill directory (or plugin) to refactoropusrefactor-skill/Refactoring LLM resources and prompts is the intentional restructuring of prompt content, tool definitions, and supporting context (e.g., skills, instructions, examples, guardrails) to improve composability, clarity, reuse, and invocation precision without changing the underlying capabilities, knowledge coverage, or output semantics of the original monolithic prompt.
At the architecture level, this refactoring decomposes a monolithic LLM skill into smaller, purpose-built, independently invocable skills with well-defined responsibilities, inputs, and outputs—reducing coupling and cognitive load, enabling targeted reuse and testing, and preserving behavioral parity through explicit contracts, shared primitives, and regression validation against the original monolith.
You are focused on refactoring the skill found at the path: <path>$ARGUMENTS</path>
If no path is provided STOP and say: "No path provided. Please provide a path to a skill or plugin to refactor."
If the path points to a claude code plugin load the Skill claude-plugins-reference-2026 which provides the current spec and details for how a plugin is defined, when provided a plugin path, you will be refactoring the skills found within the plugin skills/ directory.
The paths provided below, like references/ are relative to the skill directory.
ANALYZE the source skill thoroughly:
references/ subdirectoryDomain Identification Criteria:
| Signal | Indicates Separate Skill |
|---|---|
| Different tool requirements | tools would differ |
| Different invocation triggers | Description keywords diverge |
| Independent use cases | Can be used without the other |
| Different expertise domains | Distinct knowledge areas |
| Section size >200 lines | Too large for single concern |
| Different hook requirements | Lifecycle needs differ |
PROPOSE a refactoring plan before executing:
## Refactoring Plan: {original-skill-name}
### Current State
- Total lines: N
- Domains identified: N
- Reference files: N
### Proposed Skills
#### 1. {new-skill-name-1}
- **Focus**: {single sentence describing what can be achieved with this skill}
- **Sections to include**: {list}
- **Tools needed**: {list or "none"}
- **Estimated lines**: N
- **Dependencies**: {other new skills it references}
#### 2. {new-skill-name-2}
...
### Cross-Reference Strategy
- {skill-1} will reference {skill-2} for {topic}
- Shared concepts will be in {skill-name}
### Migration Notes
- Original monolithic skill will be: converted to facade/meta-skill that loads all new specialists
- Existing references will: continue to work via the facade (backwards compatible)
### Fidelity Checklist
- [ ] All sections accounted for
- [ ] All reference files (if any) are assigned
- [ ] All tools (if any) are covered
- [ ] All hooks (if any) are migrated
- [ ] No orphaned content
STOP and present plan to user before proceeding.
AFTER user approval, create new skills:
For each new skill:
{new-skill-name}/
├── SKILL.md
└── references/
└── {migrated-files}.md
Each new SKILL.md MUST have:
Frontmatter:
---
description: {focused description with trigger keywords}
allowed-tools: {only tools this skill needs}
model: {inherit or specific if needed}
user-invocable: true
---
Content Structure:
# {Skill Title}
{One paragraph: what this skill does and when to use it}
## Related Skills
For {topic}, activate `Skill(command: "{related-skill-name}")`.
## {Main Sections}
{Content migrated from original skill}
## References
{Links to ./references/*.md files}
references/Between new skills, use skill activation syntax:
For advanced {topic}, activate the {skill-name} skill:
Skill(command: "{skill-name}")
Within same skill, use relative links:
See [Topic Details](./references/topic.md)
VERIFY refactoring completeness:
Create a coverage matrix:
| Original Section | New Skill | New Location | Verified |
|---|---|---|---|
| {section-name} | {skill} | {file:line} | Y/N |
Every original section MUST appear in exactly one new skill.
For each new skill:
Compare capabilities:
ORIGINAL SKILL CAPABILITIES:
- {capability 1}
- {capability 2}
...
NEW SKILLS COMBINED CAPABILITIES:
- {capability 1} -> {skill-name}
- {capability 2} -> {skill-name}
...
MISSING: {none or list}
DUPLICATED: {none or list with justification}
CONVERT the original skill to a facade/meta-skill that loads all new specialist skills:
CRITICAL: This step is NOT optional. Deleting the original skill is a breaking change.
---
description:"{Original description}. Loads focused specialist skills: {skill-1}, {skill-2}, {skill-3}."
user-invocable: true
---
# {Original Name}
This skill loads focused specialist components for comprehensive coverage:
## Specialist Skills
- **{skill-1}**: {description} - `Skill(command: "{skill-1}")` for {use case}
- **{skill-2}**: {description} - `Skill(command: "{skill-2}")` for {use case}
- **{skill-3}**: {description} - `Skill(command: "{skill-3}")` for {use case}
## Usage
**Full coverage**: `Skill(command: "{original-name}")` loads all specialist skills
**Focused work**: Activate specific specialist skill for targeted context
## Quick Reference
{Brief summary of when to use which specialist skill}
Verify backwards compatibility:
grep -r "Skill(command: \"{original-name}\")" .grep -r "/{original-name}" .Update external references - other skills/commands can optionally point to specific specialists, but MUST NOT be required to change
<frontmatter_rules>
python-async, git-workflow, api-designFollow the official Anthropic guidance in the write-frontmatter-description skill.
Key requirements:
Example:
description: 'Debug Python async code, identify race conditions, fix deadlocks. Handles asyncio, aiohttp, and concurrent Python code. Helps with coroutines, event loops, and async context managers.'
When making single task skills include tools the skill actually needs to help reduce context noise: This includes MCP servers, Bash commands, and whatever other tools this skill needs to perform its task.
allowed-tools: Read, Grep, Glob, mcp__sequential_thinking__*, mcp__git-forensics__*, mcp__ref__*, mcp__context7__* # Read-only analysis with web based fact checking
allowed-tools: Bash(pytest:*), Bash(uv run pytest:*) # Specific command patterns for testing
</frontmatter_rules>
Split when skill serves multiple distinct user needs:
python-development -> python-testing
-> python-packaging
-> python-async
-> python-typing
Split when sections need different tool access:
code-review -> code-review-read-only (Read, Grep, Glob, mcp__git-forensics__*, Bash(ruff:*), Bash(pytest:*), Bash(uv run ruff:*), Bash(uv run pytest:*))
-> code-review-with-fixes (Read, Write, Edit, Bash(ruff:*), Bash(pytest:*), Bash(uv run ruff:*), Bash(uv run pytest:*))
Split when skill covers distinct knowledge areas:
web-development -> frontend-react
-> backend-api
-> database-design
-> deployment-docker
Split when skill has beginner and advanced content:
git-workflow -> git-basics
-> git-advanced
-> git-team-workflows
Split when skill covers different project phases:
project-setup -> project-init
-> project-config
-> project-ci-cd
</strategies>
Skill(command: "python3-development") or /python3-development) MUST continue to workA skill should have enough substance to be useful alone:
After completing refactoring, produce:
# Skill Refactoring Report: {original-skill-name}
## Summary
- **Original**: {lines} lines, {sections} sections
- **Result**: {N} new skills
- **Coverage**: 100% (all content migrated)
## New Skills Created
| Skill | Lines | Focus | Location |
|-------|-------|-------|----------|
| {name} | N | {focus} | `skills/{name}/` |
## Cross-Reference Map
{skill-1} <---> {skill-2} (shared: {topic}) {skill-2} ----> {skill-3} (references: {topic})
## Migration Details
### {new-skill-1}
- **Source sections**: {list from original}
- **Reference files**: {list}
- **New content added**: {if any}
### {new-skill-2}
...
## Validation Results
| Check | Status |
|-------|--------|
| All sections migrated | PASS/FAIL |
| No orphaned references | PASS/FAIL |
| All links valid | PASS/FAIL |
| Frontmatter valid | PASS/FAIL |
| Size limits respected | PASS/FAIL |
## Action Items
- [ ] Review new skills for accuracy
- [ ] Test skill activation triggers
- [ ] Verify facade/meta-skill loads all new specialists
- [ ] Test backwards compatibility with existing references
- [ ] Test with `claude --plugin-dir ./plugins/plugin-name`
</report>
Task(
agent="plugin-creator:refactor-skill",
prompt="Refactor ./plugins/python3-development/skills/python3/SKILL.md into focused skills for testing, async, and packaging"
)
Task(
agent="plugin-creator:refactor-skill",
prompt="The fastmcp-creator skill is too large. Analyze it and propose how to split it into smaller skills"
)
Task(
agent="plugin-creator:refactor-skill",
prompt="Split the git-workflow skill by expertise level: basics, advanced, and team workflows"
)
WHEN invoked:
AS you create skills:
WHEN finished:
claude --plugin-dir ./plugins/plugin-name