/refactoring-skills
Analyzes and refactors multiple skills across a project, consolidating overlaps, extracting shared conventions, and removing redundancy. Use when user says "refactor skills", "cleanup skills", "consolidate skills", "skill review". Use when skills overlap, are redundant, or need
$ npx -y skills add wayne930242/Reflexive-Claude-Code --skill refactoring-skills --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/refactoring-skills
Context preview
The summary Claude sees to decide when to auto-load this skill.
Analyzes and refactors multiple skills across a project, consolidating overlaps, extracting shared conventions, and removing redundancy. Use when user says "refactor skills", "cleanup skills", "consolidate skills", "skill review". Use when skills overlap, are redundant, or need
SKILL.md
refactoring-skills.SKILL.mdname: refactoring-skills
description: Analyzes and refactors multiple skills across a project, consolidating overlaps, extracting shared conventions, and removing redundancy. Use when user says "refactor skills", "cleanup skills", "consolidate skills", "skill review". Use when skills overlap, are redundant, or need cross-skill consolidation. NOT for improving a single skill (use improving-skills instead).
Refactoring Skills
Overview
**Refactoring skills IS applying clean code principles to documentation.**
Consolidate, simplify, extract shared conventions, remove redundancy.
**Core principle:** Fewer focused skills > many overlapping skills.
Routing
**Pattern:** Tree **Handoff:** mixed (auto-invoke per classification) **Next:** `analyzing-agent-systems` | `writing-skills` | `writing-rules` **Chain:** maintenance
Task Initialization (MANDATORY)
Follow [task initialization protocol](../../references/task-initialization.md).
**Tasks:** 1. Discover all skills 2. Analyze and classify 3. Execute refactoring plan 4. Extract shared conventions 5. Validate results 6. Generate report
Announce: "Created 6 tasks. Starting execution..."
Task 1: Discover All Skills
**Goal:** Find all skills in the project.
**Search locations:**
find . -name "SKILL.md" -type f 2>/dev/null
ls -la .claude/skills/ 2>/dev/null
**Also check:**
- Plugin directories
- User-level skills (`~/.claude/skills/`)
**Document:**
- Skill name
- Location
- Brief description
**Verification:** Complete list of all skills with locations.
Task 2: Analyze and Classify
**Goal:** Classify each skill for action, informed by systematic weakness analysis.
**First: Invoke `analyzing-agent-systems` skill** to get a comprehensive analysis report covering all 8 weakness categories. This replaces manual analysis.
**Then classify each skill using both the analysis report and manual assessment:**
Classification Matrix
| Status | Criteria | Action | |--------|----------|--------| | **Keep** | Well-structured, unique purpose, no weaknesses flagged | None | | **Refactor** | Analysis flagged weaknesses but valuable | Use writing-skills to improve | | **Merge** | Analysis found overlap with another skill | Consolidate into primary | | **Extract** | Analysis found duplicated conventions | Move to rule file | | **Delete** | Redundant, unused, or superseded | Remove entirely |
Analysis-Informed Questions
For each skill, check against analysis report: 1. Did analysis flag routing/trigger weaknesses for this skill? 2. Did analysis find context management issues? 3. Did analysis detect overlap with other skills? 4. Is this skill referenced in any broken chain? 5. Does it follow current standards? (frontmatter, line count, sections)
**Optional: External Search**
If `claude-skills-mcp` is available:
mcp__claude-skills-mcp__search_skills query="[skill domain]"
Compare with community implementations. Better patterns exist?
**Verification:** Each skill has a classification and action, informed by analysis report.
Task 3: Execute Refactoring Plan
**Goal:** Apply the classified actions.
For Skills to Refactor
**Invoke the `writing-skills` skill** with the existing skill path.
For Skills to Merge
1. Identify the primary skill (keep this one) 2. Extract unique content from secondary skill 3. Integrate into primary skill 4. Delete secondary skill directory
For Skills to Delete
1. Confirm no dependencies (grep for skill name) 2. Remove entire skill directory 3. Remove from any manifest references
**Important:** One action at a time. Verify after each.
**Verification:** All classified actions executed.
Task 4: Extract Shared Conventions
**Goal:** Move duplicated conventions to rule files.
**Signs of shared conventions:**
- Same constraint appears in 2+ skills
- Convention is about "what" not "how"
- Convention is path-specific
**Process:** 1. Identify duplicated constraint 2. **Invoke `writing-rules` skill** to create rule 3. Remove constraint from all skills 4. Verify rule auto-injects correctly
**Verification:** No duplicated conventions across skills.
Task 5: Validate Results
**Goal:** Verify all remaining skills are valid.
**For each skill:**
python3 "${CLAUDE_SKILL_DIR}/../writing-skills/scripts/validate_skill.py" <skill-path>**Or manual checklist:**
- [ ] Frontmatter has name and description
- [ ] Description states what the skill does, then "Use when..." triggers
- [ ] Body < 300 lines
- [ ] No duplicated conventions (now in rules)
**Verification:** All remaining skills pass validation.
Task 6: Generate Report
**Goal:** Document what was done.
Report Format
## Refactoring Summary
### Skills Analyzed: N
### Actions Taken:
| Skill | Action | Notes |
|-------|--------|-------|
| skill-name | kept/refactored/merged/deleted | details |
### Rules Extracted:
| Rule | Source Skills |
|------|--------------|
| rule-name | skill-a, skill-b |
### Recommendations:
- [Future improvements]
**Verification:** Report accurately reflects all changes.
Red Flags - STOP
These thoughts mean you're rationalizing. STOP and reconsider:
- "Keep all skills, they might be useful"
- "Too much overlap is fine"
- "Don't need to extract conventions"
- "Skip validation, I just fixed them"
- "Report is busywork"
**All of these mean: You're about to leave mess behind. Follow the process.**
Common Rationalizations
| Excuse | Reality | |--------|---------| | "Keep everything" | Unused skills are clutter. Delete them. | | "Overlap is fine" | Overlap = confusion. Merge or differentiate. | | "Skip extraction" | Duplicated conventions drift. Extract to rules. | | "Skip validation" | Fixed skills can still be broken. Validate. | | "Skip report" | Report documents decisions for future you. |
Skill Chain Reference (Maintenance)
| Step | Skill | Purpose | |------|-------|---------| | 1 | `analyzing-agent-systems` | Weakness analys
Read more
name: refactoring-skills description: Analyzes and refactors multiple skills across a project, consolidating overlaps, extracting shared conventions, and removing redundancy. Use when user says "refactor skills", "cleanup skills", "consolidate skills", "skill review". Use when skills overlap, are redundant, or need cross-skill consolidation. NOT for improving a single skill (use improving-skills instead).
Refactoring Skills
Overview
**Refactoring skills IS applying clean code principles to documentation.**
Consolidate, simplify, extract shared conventions, remove redundancy.
**Core principle:** Fewer focused skills > many overlapping skills.
Routing
**Pattern:** Tree **Handoff:** mixed (auto-invoke per classification) **Next:** `analyzing-agent-systems` | `writing-skills` | `writing-rules` **Chain:** maintenance
Task Initialization (MANDATORY)
Follow [task initialization protocol](../../references/task-initialization.md).
**Tasks:** 1. Discover all skills 2. Analyze and classify 3. Execute refactoring plan 4. Extract shared conventions 5. Validate results 6. Generate report
Announce: "Created 6 tasks. Starting execution..."
Task 1: Discover All Skills
**Goal:** Find all skills in the project.
**Search locations:**
find . -name "SKILL.md" -type f 2>/dev/null ls -la .claude/skills/ 2>/dev/null
**Also check:**
- Plugin directories
- User-level skills (`~/.claude/skills/`)
**Document:**
- Skill name
- Location
- Brief description
**Verification:** Complete list of all skills with locations.
Task 2: Analyze and Classify
**Goal:** Classify each skill for action, informed by systematic weakness analysis.
**First: Invoke `analyzing-agent-systems` skill** to get a comprehensive analysis report covering all 8 weakness categories. This replaces manual analysis.
**Then classify each skill using both the analysis report and manual assessment:**
Classification Matrix
| Status | Criteria | Action | |--------|----------|--------| | **Keep** | Well-structured, unique purpose, no weaknesses flagged | None | | **Refactor** | Analysis flagged weaknesses but valuable | Use writing-skills to improve | | **Merge** | Analysis found overlap with another skill | Consolidate into primary | | **Extract** | Analysis found duplicated conventions | Move to rule file | | **Delete** | Redundant, unused, or superseded | Remove entirely |
Analysis-Informed Questions
For each skill, check against analysis report: 1. Did analysis flag routing/trigger weaknesses for this skill? 2. Did analysis find context management issues? 3. Did analysis detect overlap with other skills? 4. Is this skill referenced in any broken chain? 5. Does it follow current standards? (frontmatter, line count, sections)
**Optional: External Search**
If `claude-skills-mcp` is available:
mcp__claude-skills-mcp__search_skills query="[skill domain]"
Compare with community implementations. Better patterns exist?
**Verification:** Each skill has a classification and action, informed by analysis report.
Task 3: Execute Refactoring Plan
**Goal:** Apply the classified actions.
For Skills to Refactor
**Invoke the `writing-skills` skill** with the existing skill path.
For Skills to Merge
1. Identify the primary skill (keep this one) 2. Extract unique content from secondary skill 3. Integrate into primary skill 4. Delete secondary skill directory
For Skills to Delete
1. Confirm no dependencies (grep for skill name) 2. Remove entire skill directory 3. Remove from any manifest references
**Important:** One action at a time. Verify after each.
**Verification:** All classified actions executed.
Task 4: Extract Shared Conventions
**Goal:** Move duplicated conventions to rule files.
**Signs of shared conventions:**
- Same constraint appears in 2+ skills
- Convention is about "what" not "how"
- Convention is path-specific
**Process:** 1. Identify duplicated constraint 2. **Invoke `writing-rules` skill** to create rule 3. Remove constraint from all skills 4. Verify rule auto-injects correctly
**Verification:** No duplicated conventions across skills.
Task 5: Validate Results
**Goal:** Verify all remaining skills are valid.
**For each skill:**
python3 "${CLAUDE_SKILL_DIR}/../writing-skills/scripts/validate_skill.py" <skill-path>**Or manual checklist:**
- [ ] Frontmatter has name and description
- [ ] Description states what the skill does, then "Use when..." triggers
- [ ] Body < 300 lines
- [ ] No duplicated conventions (now in rules)
**Verification:** All remaining skills pass validation.
Task 6: Generate Report
**Goal:** Document what was done.
Report Format
## Refactoring Summary ### Skills Analyzed: N ### Actions Taken: | Skill | Action | Notes | |-------|--------|-------| | skill-name | kept/refactored/merged/deleted | details | ### Rules Extracted: | Rule | Source Skills | |------|--------------| | rule-name | skill-a, skill-b | ### Recommendations: - [Future improvements]
**Verification:** Report accurately reflects all changes.
Red Flags - STOP
These thoughts mean you're rationalizing. STOP and reconsider:
- "Keep all skills, they might be useful"
- "Too much overlap is fine"
- "Don't need to extract conventions"
- "Skip validation, I just fixed them"
- "Report is busywork"
**All of these mean: You're about to leave mess behind. Follow the process.**
Common Rationalizations
| Excuse | Reality | |--------|---------| | "Keep everything" | Unused skills are clutter. Delete them. | | "Overlap is fine" | Overlap = confusion. Merge or differentiate. | | "Skip extraction" | Duplicated conventions drift. Extract to rules. | | "Skip validation" | Fixed skills can still be broken. Validate. | | "Skip report" | Report documents decisions for future you. |
Skill Chain Reference (Maintenance)
| Step | Skill | Purpose | |------|-------|---------| | 1 | `analyzing-agent-systems` | Weakness analys
Showing the first part of this file.
A Claude Code plugin marketplace for skills-driven Agentic Context Engineering (ACE) — build, analyze, and maintain agent systems with structured workflows.
Repo: wayne930242/Reflexive-Claude-Code
Other skills on reflexive-claude-code.
- /analyzing-codebases
Detects project languages and monorepo state, runs language-appropriate static analysis (dependency graph, complexity, duplication, semantic patterns), and produces a refactor map ranking hotspots. Use when user invokes /aref or explicitly asks to analyze a codebase for
Open skill - /applying-refactors
Executes a refactor plan phase-by-phase on a dedicated branch with per-phase commits and mandatory reviewer checkpoints. Use when characterization-tests scaffold is complete and plan has phases ready to execute.
Open skill - /finalizing-refactors
Writes AGENTS.md per subproject, archives run artifacts, and suggests rcc handoff conditionally. Use when verifying-refactors passes (PASS or PASS-WITH-WEAK-TESTS).
Open skill - /planning-refactors
Converts a refactor map into a phased plan using parallel-change, branch-by-abstraction, or strangler fig patterns. Use when user has approved the refactor map from analyzing-codebases.
Open skill - /scaffolding-characterization-tests
Adds golden/snapshot tests to untested hotspot modules before refactoring. Use when refactor plan marks any phase with characterization_test.status=must-scaffold.
Open skill - /verifying-refactors
Validates hard structural rules (no cycles, file/fn line caps, cognitive/cyclomatic complexity) and runs mutation testing on touched modules. Use when applying-refactors has completed all phases on the refactor branch.
Open skill

