/re-arch:re-arch-diagnosefrom re-arch
Diagnoses architectural weaknesses with evidence per finding, rated by severity and fix size. Covers layering, coupling, cycles, domain boundaries, data model, error handling, and vibe-coded code. Part of the re-arch suite; reads .re-arch/scan.json and domains.json.
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.
A finding is useful when a developer can open the file and see it, and a manager can understand why it costs money. Both halves are mandatory. A diagnosis is trusted when it also shows what it chose not to flag.
.re-arch/scan-summary.md and .re-arch/scan.json (run re-arch-scan first if missing);.re-arch/domains.json if it exists: attach each finding to its domains;.re-arch/meta.json: deliverable language, team context, quality drivers;findings.json (see re-arch-audit): keep the same id for a finding that persists, so progress can be tracked.Copy it into your working notes and tick it as you go:
- [ ] Orient: README, docs, ADRs, CONTRIBUTING, existing AGENTS.md / CLAUDE.md read
- [ ] Graph sources checked (precise or regex per language)
- [ ] Git signals read (fix share, most fixed files, knowledge)
- [ ] Every scan candidate opened (mixed files, cycles, hotspots, duplicates, secrets, hygiene)
- [ ] Domain rules checked against the domain (regulations, market)
- [ ] Stack support status checked (sources cited)
- [ ] Production-readiness signals checked
- [ ] Hotspots and core domains read in depth
- [ ] Smell catalog walked, with its "do not flag" lists
- [ ] Instances grouped, severity and fix size rated
- [ ] Strengths and non-findings written
- [ ] findings.json validated (validate.py)
knowledge), with pseudonyms only.compliance, or domain-logic when it is a plain business error). Do not invent regulations: state the rule you rely on, flag uncertainty, and put "to validate with an accountant / lawyer / DPO" in open_questions. Upcoming regulatory deadlines that the current model cannot meet are worth a finding: they turn a refactoring into a necessity.config-security, and say when a full security audit is warranted.kind (core first).references/smells.md, including its do not flag lists. Use it as a checklist, not as a template to fill: report only what you actually found.python3 <re-arch-report-dir>/scripts/validate.py <repo>/.re-arch. It checks enums, ids, that every evidence file exists and every line is in range. Fix every error.| Severity | Criteria |
|---|---|
| critical | causes or will cause incidents, data corruption, security exposure, or blocks any change in a core domain (a secret in the repo, payment logic with no transaction, a cycle across all core modules) |
| high | makes changes in a core or busy area slow and risky: business rules in handlers with no tests, duplicated rules that can diverge, a hotspot everybody touches, a core module only one (inactive) person knows |
| medium | real cost but localised, or in a supporting domain |
| low | consistency, naming, structure style; fix opportunistically |
Severity drops when the area is stable and rarely changed (low churn, low business value): ugly code nobody touches is not a priority. Say so when relevant.
deliberate-prudent ("we ship now and know the cost"), deliberate-reckless, inadvertent-prudent ("now we know how we should have done it"), inadvertent-reckless (Fowler's quadrant). Vibe-coded code is usually inadvertent; code written under a known deadline is often deliberate-prudent. It helps the pitch explain debt without blame and helps decide what to leave alone..re-arch/findings.json{
"metrics": {"prod_loc": 9800, "test_ratio": 0.04, "module_cycles": 3, "mixed_files": 21, "modularity": 0.24, "fix_share": 0.5},
"strengths": ["Prisma schema is normalised and consistently named"],
"non_findings": [
{"title": "Catalog entities are plain data classes", "why": "catalog is CRUD with no invariant; an anaemic model is the right choice there", "files": ["src/catalog/product.ts"]}
],
"open_questions": ["Is the 5% bulk discount still a business rule, or a leftover from a promotion?"],
"findings": [
{
"id": "F1", "title": "...", "category": "domain-logic", "severity": "high", "fix_size": "M",
"debt_intent": "inadvertent-reckless", "domains": ["orders"],
"evidence": [{"file": "src/app/api/orders/route.ts", "line": 21, "detail": "..."}],
"impact_tech": "...", "impact_business": "...", "recommendation": "..."
}
]
}
Categories: layering, domain-logic, coupling, cycles, duplication, boundaries, data-model, testing, state, error-handling, config-security, consistency, dead-code, performance-design, dependencies, knowledge, compliance. Sort by severity, then by number of domains affected. open_questions collects what only the maintainers can answer; the report lists them. Strings in the deliverable language.
Also summarise in the conversation: the 3 to 5 findings that matter most (title, severity, fix size, one line of evidence), the main strength, the most useful non-finding, and the next step (choosing a target with re-arch-options).
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./re-arch-domainsIdentifies the business domains of an existing application (bounded-context candidates) from its code, data model, routes, dependency-injection wiring and git history, and draws a domain map with dependencies, external systems (C4 context view), shared technical parts, fuzzy zones and a confidence level per domain. Use when someone wants to understand what an application is made of, visualise its functional areas, prepare a modular monolith or microservice split, organise a refactoring per domain, or as the domain-mapping step of an architecture audit. Works even when folder names mean nothing, as in vibe-coded apps. Part of the re-arch suite; needs .re-arch/scan.json from re-arch-scan./re-arch-guardrailsGenerates the guardrails that keep a codebase in its chosen architecture - rules for AI coding agents (root and per-domain AGENTS.md, CLAUDE.md, Cursor rules), a project skill telling agents where new code goes, agent hooks that run the architecture check during the agent's own turn, fitness functions for CI with a frozen baseline (dependency-cruiser, deptrac, Pest arch, NetArchTest, ArchUnit, Spring Modulith, go-arch-lint, depguard, Cargo workspaces, cargo-deny, CMake targets, plus a language-agnostic checker), an ADR (MADR) and a review checklist. Use after choosing a target architecture, when AI agents keep putting code in the wrong place, to enforce layering or module boundaries, set up architecture tests, or frame vibe coding. Part of the re-arch suite./re-arch-optionsProposes and compares 2 to 4 target architectures for an existing codebase, each sized by human understanding cost and implementation size (S, M, L, XL), scored against the business's quality scenarios, justified by signals in the code and possibly different per domain. Covers targeted refactoring, transaction script, layered service/repository, feature folders, vertical slices, modular monolith, clean/hexagonal/onion, rich domain model, CQRS, event sourcing, domain events, anti-corruption layers and feature-sliced design, with reasons for rejected styles. Never defaults to hexagonal. Use when choosing which architecture to move to, comparing clean vs hexagonal vs simpler options, deciding whether event sourcing or CQRS is worth it, or as the options step of an architecture audit. Part of the re-arch suite./re-arch-pitchWrites the management-facing case for a refactoring or architecture effort, without jargon - current risks tied to evidence, options including doing nothing, recommendation, investment in T-shirt sizes and team capacity with explicit assumptions, milestones, success indicators and the decision requested. Use when someone must convince a CTO, CEO, board, product management or a steering committee to fund technical-debt reduction or a refactoring, needs an executive summary of an architecture audit, or asks how to explain a refactoring to non-technical people. Part of the re-arch suite; reads .re-arch/findings.json, options.json and plan.json.Other plugins' skills for the same job