/re-arch:re-arch-planfrom re-arch
Generates a phased, incremental refactoring plan with T-shirt-sized phases, safety nets, and domain-by-domain migration using strangler fig, branch by abstraction, and expand/contract patterns.
Ships in re-arch. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A plan the team (or an AI agent) can start on Monday: small steps, each one delivering value and safe to stop after, each one checkable by a command rather than by trust. Big-bang rewrites of working software fail far more often than incremental refactoring; the plan makes the incremental path concrete.
.re-arch/options.json (use decision.chosen; if absent, ask which option or take the recommended one and say so), .re-arch/findings.json, .re-arch/domains.json, .re-arch/scan.json (hotspots, churn, cycles, knowledge), .re-arch/meta.json. In re-audit mode, the previous plan.json: keep phase ids, update status.
No estimates in days: a size with its criterion is discussable, a day count produced without knowing the team is not.
| Size | Criteria |
|---|---|
| S | one module touched, covered by tests, no contract change |
| M | several modules of one domain, internal contracts change |
| L | several domains, new abstractions introduced, safety net to build first |
| XL | data model change or global style change |
Every phase gets a size and the criterion that justifies it (size_rationale). An XL phase is a signal to split: split it until each piece is L or smaller, or keep it XL only with an explicit note that it must be split before starting.
fix_size S go in the first phases: they reduce risk now and build trust in the effort.core first), knowledge risk (a hotspot only one inactive person understood needs its tests first), and dependencies (break cycles before extracting). Explain the order in sequencing_rationale.references/techniques.md): strangler fig, branch by abstraction, parallel change (expand/contract), seams, Mikado method for tangled dependencies, feature toggles, expand/contract migrations for the database.re-arch-guardrails). The plan says in which phase each rule's baseline must reach zero.out_of_scope with a reason; every top-5 hotspot is addressed or explicitly left alone. The validator checks this.A step is a ticket a developer or an agent can execute and prove done. Prefer the structured form:
{"do": "Extract VAT computation from src/utils/utils.ts and src/app/invoices/new/page.tsx into src/server/invoicing/vat.ts (pure function computeTotal)",
"moves": [{"from": "src/utils/utils.ts#computeTotal", "to": "src/server/invoicing/vat.ts#computeTotal"}],
"verify": "! grep -rn 'vatRate / 100' src --include='*.ts*' | grep -v src/server/invoicing"}
verify is a shell command that exits 0 when the step is done: a test command, the architecture checker with a rule id, or a negated search (! grep -rq 'pattern' src, since a grep that finds nothing exits 1). A step without a possible check is a smell: rewrite it.moves lists exact relocations so nobody (human or agent) copies instead of moving.
Plain strings stay accepted for steps that are not mechanically checkable (a workshop, a decision).Each phase's exit_criteria are verifiable, and always include, adapted to the phase:
check_architecture.py --baseline): no new violation; the phase's target rules at zero;done only when these were run after the last change and passed: fresh command output, not a recollection. Agents executing the plan follow the same rule.Verify commands and exit gates often need architecture rules that re-arch-guardrails writes later. Reserve them here: list them in plan.json rules_needed ([{"id": "R1", "rule": "domain code never imports Prisma", "by_phase": "P2"}]) and reference the ids in steps and exit criteria. The guardrails step implements exactly these ids (and may add preventive ones).
Phase 0 is easier to start when its first deliverable already exists. When the toolchain is available in the session, write in .re-arch/starter/:
plan.json starter ({"files": [...], "command": "...", "result": "8 passed"}). If dependencies cannot be installed, still write the tests and say they were not executed. Tests that fail on current behaviour are written down as known bugs, not "fixed" in the starter..re-arch/plan.json, validate (python3 <re-arch-report-dir>/scripts/validate.py <repo>/.re-arch: coverage of critical/high findings and hotspots, ids, cycles in phase dependencies), fix errors, then generate the ticket-friendly .re-arch/plan.md (never by hand; re-run after any JSON edit):
python3 <this-skill-dir>/scripts/plan_to_md.py <repo>/.re-arch
.re-arch/plan.json{
"target": "O2",
"sequencing_rationale": "...",
"assumptions": ["features keep shipping, about a third of capacity on refactoring"],
"out_of_scope": ["F12 (low): naming in the admin module, stable and rarely changed"],
"phases": [
{
"id": "P0", "name": "Safety net and quick wins", "status": "not started",
"goal": "...", "size": "M", "size_rationale": "one domain, no contract change, test harness to create",
"domains": ["orders"], "findings": ["F5", "F9"], "depends_on": [],
"steps": [
{"do": "Rotate the Stripe key found in src/utils/format.ts and read it from env config", "verify": "! grep -rq 'sk_live_' src"},
"Agree with the team which order flows the characterisation tests must cover"
],
"exit_criteria": ["Characterisation tests cover POST /api/orders happy path and the 4 rejection cases, green in CI"],
"rollback": "tests and config only",
"risks": ["..."],
"stop_point": false
}
]
}
status: not started | in progress | done | dropped (updated in re-audits). Strings in the deliverable language.
Give the phase list in the conversation (id, name, size, one-line goal), the first phase's steps, and point to plan.md for the ticket-ready version.
What SKILL.md sets; muted values are Claude Code's defaults
10 skills in this plugin
/re-arch-academyProduces training material to upskill a development team on the architecture and practices of a refactoring - a learning path ordered by the refactoring plan, modules anchored in the team's own code (before/after taken from their repository, katas extracted from real files, exercises, review checklists), curated references, for juniors and seniors. Use when a team must learn clean architecture, hexagonal, DDD, layering, testing legacy code or refactoring techniques, when a tech lead wants onboarding or workshop material about their codebase's target architecture, when developers who vibe-code need to learn craftsmanship basics, or as the training step of an architecture audit. Part of the re-arch suite; reads .re-arch/findings.json, options.json and plan.json./re-arch-auditUse this skill whenever someone questions the overall structure or health of an existing codebase and wants a verdict and a way forward, not a single code fix. This covers "is our repo/workspace/solution well structured?", layer or dependency leaks (domain code depending on the DB or framework), and projects, crates or modules nobody can untangle. It also covers an inherited legacy monolith or a vibe-coded/AI-generated app that is getting hard to change, rewrite vs incremental cleanup, tech debt assessment, refactoring roadmaps, and justifying the investment to a CTO, management or board. Also use it for team architecture rules and re-audits. Produces an evidence-based audit (domain map, weaknesses with file references, sized options from light fixes to modular monolith, hexagonal or CQRS, phased plan, management pitch, CI and AI guardrails, HTML report). JS/TS, PHP/Laravel/Symfony, .NET, Java/Kotlin, C/C++, Go, Rust. Not for one PR review, one-function refactor, security audit or cloud diagram.npx claudepluginhub gregorybabonaux/re-arch --plugin re-archOther plugins' skills for the same job