analyzing-codebases
Detects project languages and monorepo state, runs language-appropriate static analysis (dependency graph, complexity, duplication, semantic patterns), and…
Cleans up and consolidates an agent system after creation or modification. Use when user says "cleanup agent system", "refactor agent setup", "clean up skills", "consolidate agents". Use when called by applying-agent-systems.
$ npx -y skills add wayne930242/Reflexive-Claude-Code --skill refactoring-agent-systems --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/refactoring-agent-systemsContext preview
The summary Claude sees to decide when to auto-load this skill.
Cleans up and consolidates an agent system after creation or modification. Use when user says "cleanup agent system", "refactor agent setup", "clean up skills", "consolidate agents". Use when called by applying-agent-systems.
name: refactoring-agent-systems description: Cleans up and consolidates an agent system after creation or modification. Use when user says "cleanup agent system", "refactor agent setup", "clean up skills", "consolidate agents". Use when called by applying-agent-systems.
**Refactoring agent systems IS applying clean code principles to agent configurations.**
Re-analyze after changes, compare before/after, fix remaining issues, simplify over-engineering.
**Core principle:** Refactoring without measurement is guessing. Analyze, then change, then verify.
**Pattern:** Skill Steps **Handoff:** none **Next:** none **Chain:** main (terminal)
Follow [task initialization protocol](../../references/task-initialization.md).
**Tasks:** 1. Load review findings 2. Prioritize issues 3. Execute refactoring 4. Final verification 5. Produce refactoring report 6. Archive pipeline documents
Announce: "Created 6 tasks. Starting execution..."
**Goal:** Load the review report as the basis for refactoring.
**If review report path was provided** (from `reviewing-agent-systems`): 1. Read the review report 2. Extract all Critical and Major issues 3. These are your refactoring targets
**If no review report** (standalone invocation): 1. Invoke `reviewing-agent-systems` skill first to produce a report 2. Then continue with the report's findings
**Verification:** Have a list of specific issues to fix from the review report.
**Goal:** Classify and order issues from the review report for fixing.
**Priority order:** 1. **Critical** — must fix before shipping 2. **Major** — should fix for quality 3. **Minor** — nice to have, fix if time permits
**Present the prioritized list to user.** Do NOT summarize — show each issue with its component, severity, and planned fix.
**Ask:** "這些修正項目正確嗎?要開始修正嗎?"
**Verification:** User has confirmed the prioritized fix list.
**Goal:** Fix remaining and new issues.
**Refactoring actions (in priority order):**
| Issue Type | Action | Method | |------------|--------|--------| | Duplicate logic across components | Merge or extract to rule | Main conversation edits | | Conflicting instructions | Unify or remove one | Main conversation edits | | Over-engineered component | Simplify (YAGNI) | Main conversation edits | | Weak skill trigger | Improve description | Main conversation edits | | Heavy read-only work in main context | Move it to a subagent, or add `context: fork` to the skill | Main conversation edits | | CLAUDE.md too long | Move content to rules/skills | Main conversation edits | | Skill missing asset | Add scripts/, templates/, or references/ | Create directly — no user confirmation needed |
**Important:** All edits happen in main conversation. Never delegate refactoring writes to subagents.
**For each refactoring action:** 1. Identify the specific change 2. Make the edit 3. Verify the fix resolves the issue 4. Move to next action
**Verification:** All REMAINING and NEW issues addressed.
**Goal:** Confirm no critical issues remain.
**Re-run the relevant reviewer agents** on components that were modified in Task 3.
**Pass criteria:**
**If critical issues remain:** Return to Task 3 and fix.
**Verification:** All modified components pass their reviewer.
**Goal:** Document what was changed and why.
**Write to:** `.rcc/{timestamp}-refactoring-report.md`
**Report format:**
# Agent System Refactoring Report **Date:** YYYY-MM-DD HH:MM ## Changes Made | # | Component | Change | Rationale | |---|-----------|--------|-----------| ## Before/After Comparison | Metric | Before | After | |--------|--------|-------| | Components | N | N | | Critical issues | N | 0 | | Warnings | N | N | | Total lines (CLAUDE.md) | N | N | ## Remaining Items (INFO) - [Low priority items for future consideration]
**Verification:** Report accurately reflects all changes.
**Goal:** Move all pipeline documents from the current run to the archive.
**Steps:** 1. Create archive directory: `.rcc/archive/{YYYY-MM-DD}/` 2. Move ALL `*.md` files from `.rcc/` to the archive directory (excluding the `archive/` directory itself) 3. Commit the archive move
mkdir -p .rcc/archive/{YYYY-MM-DD}
mv .rcc/*.md .rcc/archive/{YYYY-MM-DD}/
git add .rcc/
git commit -m "chore: archive pipeline documents from {YYYY-MM-DD}"**Replace `{YYYY-MM-DD}` with today's actual date.**
**If no documents exist in `.rcc/`:** Skip this task (nothing to archive).
**Verification:** `.rcc/` contains only the `archive/` directory. All pipeline documents are in the dated archive subdirectory.
These thoughts mean you're rationalizing. STOP and reconsider:
**All of these mean: You're about to leave mess behind. Follow the process.**
| Excuse | Reality | |--------|---------| | "Skip re-analysis" | Building introduces new issues. Always re-analyze. | | "Skip comparison" | Without before/after, you can't prove improvement. | | "Subagent edits" | Subagents can't write to `.claude/`. Use main conversation. | | "Skip verification" | Refactoring can break things. Verify. | | "Skip report" | Report documents decisions for future maintainers. | | "Skip archiving" | Accumulated documents confuse future pipeline runs. Archive. |
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
Detects project languages and monorepo state, runs language-appropriate static analysis (dependency graph, complexity, duplication, semantic patterns), and…
Executes a refactor plan phase-by-phase on a dedicated branch with per-phase commits and mandatory reviewer checkpoints. Use when characterization-tests…
Writes AGENTS.md per subproject, archives run artifacts, and suggests rcc handoff conditionally. Use when verifying-refactors passes (PASS or…
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…
Adds golden/snapshot tests to untested hotspot modules before refactoring. Use when refactor plan marks any phase with…
Validates hard structural rules (no cycles, file/fn line caps, cognitive/cyclomatic complexity) and runs mutation testing on touched modules. Use when…