From plugin-creator
Assesses oversized or multi-domain Claude Code skills and refactors by splitting or extracting references. Use for token threshold violations (SK006/SK007) or multiple independent domains.
npx claudepluginhub jamie-bitflight/claude_skills --plugin plugin-creatorThis skill uses the workspace's default tool permissions.
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.
Guides decisions on splitting Claude skill content between SKILL.md and reference files for context efficiency and reliable triggering. Use when creating or refactoring skills, SKILL.md exceeds 300-400 lines, or mentions progressive disclosure.
Refines and validates existing Claude Code skills for clarity, efficiency, and production readiness. Use for improving structure, best practices, token reduction, and production checks.
Guides creation of new Claude Code skills from scratch, listing existing user/project skills, samples, current directory, and providing metadata templates for descriptions/tags.
Share bugs, ideas, or general feedback.
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: $ARGUMENTS
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.
Before analyzing for a split, determine whether skill splitting is the appropriate action at all.
Step 1 — Measure size and read the skill:
uvx skilllint@latest check <skill-path>Step 2 — Determine the correct path:
flowchart TD
Start([Skill flagged for review]) --> Q1{Validator reports SK007 error?}
Q1 -->|Yes — token error threshold exceeded| Split[Proceed to Phase 1 - Domain Analysis]
Q1 -->|No — SK006 warning or below| Q2{Is content cohesive?<br>Single user intent, sequential workflow,<br>phases that depend on each other}
Q2 -->|Yes — cohesive single-intent skill| Refs[References/ Extraction Path<br>Move detailed reference content to ./references/<br>Link from main skill — STOP here]
Q2 -->|No — multiple independent intents| Q3{Count domain signals<br>from Phase 1 criteria<br>How many are genuinely present?}
Q3 -->|Fewer than 2 signals present| NotCandidate[OUTPUT: Not a candidate for skill splitting<br>Recommend references/ extraction instead<br>STOP — do not proceed to Phase 1]
Q3 -->|2 or more signals present| Split
SK006 vs SK007 threshold distinction:
The plugin validator defines two token thresholds (see TOKEN_WARNING_THRESHOLD and TOKEN_ERROR_THRESHOLD in skilllint):
references/ extraction. Only proceed to skill splitting if content covers genuinely independent domains with separate invocation triggers.If the skill is at SK006 but not SK007, exhaust references/ extraction options before proceeding to skill splitting.
References/ extraction path (when content is cohesive):
When the only issue is token count (SK006) and the skill covers a single user intent:
./references/<topic>.md.references/topic.md.STOP condition: If the Phase 0 assessment concludes that skill splitting is not warranted, output the finding, recommend the appropriate alternative (references/ extraction or no action), and STOP. Do not proceed to Phase 1.
ANALYZE the source skill thoroughly to determine whether splitting is warranted:
references/ subdirectoryDomain Identification Criteria:
Evaluate each signal explicitly. Document each as PRESENT or ABSENT with evidence before proceeding.
| Signal | Indicates Separate Skill | Notes |
|---|---|---|
| Different tool requirements | tools would differ between sections | Must be actual tool divergence, not task delegation |
| Different invocation triggers | Description keywords diverge | Sections serve different user intents at the point of invocation |
| Independent use cases | Can be used without the other | Each section must be meaningful when invoked alone |
| Different expertise domains | Distinct knowledge areas | Sections require different reference knowledge, not just different phases |
| Section size >200 lines with distinct trigger | Large AND has its own invocation trigger | A large section with detailed reference content is a candidate for references/ extraction, not skill splitting. This signal applies only when the section also has an independent invocation trigger. |
| Different hook requirements | Lifecycle needs differ |
GATE: Evaluate the signal count before proceeding.
references/ extraction if token count warrants action, and STOP.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(skill: "{plugin-name}:{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(skill: "{plugin-name}:{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:
uvx skilllint@latest check <skill-path> and follow its guidance on sizing)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(skill: "{plugin-name}:{skill-1}")` for {use case}
- **{skill-2}**: {description} - `Skill(skill: "{plugin-name}:{skill-2}")` for {use case}
- **{skill-3}**: {description} - `Skill(skill: "{plugin-name}:{skill-3}")` for {use case}
## Usage
**Full coverage**: `Skill(skill: "{plugin-name}:{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(skill: \"{plugin-name}:{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
uvx skilllint@latest check <skill-path> and follow its guidance on sizing)Skill(skill: "python3-development: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`
Agent(
agent="plugin-creator:refactor-skill",
prompt="Refactor ./plugins/python3-development/skills/python3/SKILL.md into focused skills for testing, async, and packaging"
)
Agent(
agent="plugin-creator:refactor-skill",
prompt="The fastmcp-creator skill is too large. Analyze it and propose how to split it into smaller skills"
)
Agent(
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