/re-arch:re-arch-optionsfrom re-arch
Proposes and compares 2-4 target architectures for an existing codebase, sized by understanding cost and implementation effort, scored against quality scenarios. Use when choosing between clean/hexagonal, CQRS, event sourcing, or simpler options.
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.
The goal is a decision, not a lecture. Each option says what it costs to understand, what it costs to build, what it fixes, what it does not fix, how it serves the qualities the business cares about, and which signals in this code justify it.
.re-arch/findings.json, .re-arch/domains.json, .re-arch/scan-summary.md, .re-arch/meta.json (team context, quality drivers). If findings are missing, run re-arch-diagnose first: options without a diagnosis are fashion.
Understanding cost: what a developer must learn and keep in mind to work in the target.
| Size | Meaning |
|---|---|
| S | no new concept; the request path stays as short as today |
| M | 1 to 3 widely known concepts (service, repository, DTO, module facade); at most 3 hops from entry point to data |
| L | 4 to 6 concepts including dependency inversion (ports, adapters, use cases, aggregates); 4 to 5 hops; needs training and examples in the repo |
| XL | paradigm change with new failure modes (eventual consistency, projections rebuilt from events, sagas); needs sustained practice and at least one experienced person |
Give the concrete list of concepts and the hop chain (controller -> use case -> port -> adapter -> ORM).
Implementation size: effort to reach the target from today's code, same scale as the plan.
| 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, safety net to build first |
| XL | data model change or global style change; must be split before committing |
Architecture choices trade qualities against each other. Make the trade explicit with 2 to 4 quality scenarios (ATAM / arc42 style), taken from meta.json quality_drivers when the person gave them, otherwise inferred from the product and the findings and marked as assumed:
Each option then rates each scenario + (helps), 0 (neutral) or - (hurts) in scenario_fit, and names its main trade-off in tradeoffs. This is what turns "which architecture is best" into "which one serves what matters here".
references/styles.md (fit signals, anti-signals, concepts, costs) and references/ecosystems.md for the idiomatic form in the detected ecosystem (a Go or Laravel team does not express layering the way a Spring or .NET team does).rejected, or as an opportunity scoped to one place.per_domain.rejected with a direct verdict tied to the code. Never leave the question unanswered because no signal supported it.scenario_fit, tradeoffs, the findings it addresses and the ones it does not.prerequisites, not inside each option.python3 <re-arch-report-dir>/scripts/validate.py <repo>/.re-arch (light option present, signals, ids, style ids), then the decision checkpoint: if someone is present, ask which option they retain; otherwise record the recommended one with decision.by: "assumed".Arguments that sound right and usually are not. If you catch yourself using one, check the counter-signal.
| Tempting argument | Check before keeping it |
|---|---|
| "The core domain deserves hexagonal" | Does the core domain have invariants that break today (findings), or is it CRUD with validation? Are there several adapters on either side? If not, a service layer with pure functions for the rules is enough. |
| "Event sourcing gives us history" | Is history a business requirement (audit, compliance, temporal queries) or a nice-to-have? An append-only audit table or domain events with an outbox give most of it at a fraction of the cost. |
| "Microservices will decouple the teams" | Is there more than one team? Are domain boundaries high-confidence? Can the organisation run distributed systems? A modular monolith gives the boundaries first. |
| "Clean architecture makes it testable" | Testability comes from pure business logic and seams; layers alone add mapping code. Would extracting the rules into pure functions give the same tests? |
| "Best practice says repositories everywhere" | With EF Core, Prisma or Eloquent, the ORM already is a repository. Add repositories where they protect an aggregate or a seam, not on every table. |
| "The team will learn it" | Who will review the first ten PRs in the new style? Without someone experienced, an L or XL understanding cost becomes a cargo cult. |
| "AI agents will write the boilerplate" | Agents copy what they see. More layers mean more places for agents to put code wrong; guardrails must exist before the style does. |
.re-arch/options.json{
"context": {"domain_complexity": "...", "team": "...", "constraints": ["..."]},
"quality_scenarios": [
{"id": "Q1", "driver": "Speed of change on invoicing rules", "scenario": "A VAT rule change ships in one day, one module, with tests", "assumed": false}
],
"options": [
{
"id": "O2", "name": "Layered everywhere, clean architecture for orders",
"styles": ["layered", "clean"], "scope": "per-domain",
"per_domain": [{"domain": "orders", "style": "clean"}, {"domain": "catalog", "style": "layered"}],
"summary": "...",
"understanding_cost": "M",
"understanding_detail": {"concepts": ["service", "repository", "use case", "port (orders only)"], "indirections": "route -> service -> repository; orders: route -> use case -> port -> adapter"},
"implementation_size": "L",
"implementation_detail": "safety net on orders, then extraction domain by domain",
"scenario_fit": {"Q1": "+"},
"tradeoffs": "More files per feature in orders in exchange for rules testable without a database",
"benefits": ["..."], "drawbacks": ["..."],
"signals": ["F1", "F3", "orders is core with pricing and stock invariants"],
"addresses": ["F1", "F2", "F3"], "does_not_address": ["F7"],
"recommended": true, "why": "..."
}
],
"prerequisites": [{"title": "...", "why": "...", "size": "M"}],
"rejected": [{"style": "Event sourcing", "why": "..."}],
"opportunities": [{"pattern": "Domain events", "where": "orders -> notifications", "signal": "F4"}],
"decision": {"chosen": "O2", "by": "assumed", "note": "recommended option, awaiting team validation"}
}
styles uses the ids listed at the top of references/styles.md. Strings in the deliverable language. Option ids are stable: the plan, pitch and guardrails refer to them.
Present the options as a compact comparison (name, understanding cost, implementation size, fit with the quality scenarios, what it fixes, main drawback), then the recommendation and the rejected styles in one line each, and ask which one to retain.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gregorybabonaux/re-arch --plugin re-arch10 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.Other plugins' skills for the same job