re-arch

An architecture audit your team can act on.

re-arch gives your coding agent the skills to map the business domains of an existing app, cite every weakness by file and line, weigh target architectures by what they cost to understand and to build, then plan the refactoring. Vibe-coded apps included.

npx skills add GregoryBabonaux/re-arch
Claude Code plugin

Audits JavaScript / TypeScript, PHP, .NET, Java / Kotlin, C / C++, Go and Rust. Works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot and any agent that reads SKILL.md.

src/server/invoicing/rules/vat.ts

1export function vat(ht: number, country: string) {
2  return country === 'FR' ? ht * 0.2 : 0
3}

src/app/invoices/new/page.tsx

4  const [ht, setHt] = useState(0)
5  const ttc = ht * 1.2
6  return <p>{ttc}</p>

F4 · duplication · high · fix S

VAT is computed twice, with two different rules

The server applies the client's country; the invoice form always adds 20 %. The total shown can differ from the total invoiced.

Plan: phase P2 keeps one pure function, with characterisation tests first.

Point at a piece of evidence to see the line it cites.

One report for the developers and for the board

A single HTML file that opens offline, reads on a phone and prints to PDF. The summary speaks to management; every finding takes developers to the line.

The report: summary with key figures, and the domain map on a phone
Options scored against quality scenarios, each with its understanding cost and implementation size
Options scored against what the business needs, each with its two sizes.
The refactoring plan: phases with size, exit criteria, rollback and stop points
A plan in phases: size, exit criteria, rollback, safe stop points.

Screenshots from Factureo, a fictional vibe-coded invoicing app written for the evals. The sample report is in French; yours follows the language you write in. Download the full report.

Evidence first, opinions after

  1. Scan and map

    A deterministic scan builds the dependency graph with the compiler's own tools when they are there, adds dependency injection, git co-change and the data model, then groups the code into business domains.

    re-arch-scan · re-arch-domains
  2. Diagnose

    Every finding cites files and lines, with its impact for the team and for the business and its fix size. The diagnosis also lists what looks bad but is fine, and the questions only the maintainers can answer.

    re-arch-diagnose
  3. Choose and plan

    2 to 4 target options, then a phased plan for the one you keep: characterisation tests first, verifiable steps, exit criteria, rollback, and a pitch for management that includes doing nothing.

    re-arch-options · re-arch-plan · re-arch-pitch

So it sticks, re-arch-guardrails writes the rules for AI agents, an agent hook and CI checks with a frozen baseline, and re-arch-academy turns the findings into training modules built on your own files.

Months later, run the audit again: the report shows what was resolved, what is new, and how the metrics moved.

Never hexagonal by default

Each option is sized on two axes: what it costs your team to understand, and what it costs to build. A light option is always on the table, each one must be justified by signals in the code, and "keep the current structure, fix these findings" is a legitimate verdict.

On Spring Petclinic, a healthy codebase, re-arch recommends targeted fixes and explains why hexagonal would cost more than it brings.

OptionUnderstandBuild
Targeted fixes, same structureSM
Isolated invoicing core, thin routes recommendedML
Hexagonal for invoicing and paymentsLL

Factureo: two junior developers, so understanding cost weighs as much as the code.

Tested on three very different codebases

A vibe-coded Next.js app full of traps, a healthy Spring project and a legacy Laravel API, each graded with deterministic checks.

Graded checks passed
23 / 23
Ecosystems with compiler-grade graphs
7
Automated tests on fixture repos
34

October 2026. An audit takes about twice as long as a plain prompt, the price of the scan and the checks. Details in evals/.

AI agents keep to the plan

AGENTS.md files say where new code goes and point to the cleanest examples in your repo. An agent hook runs the architecture check at the end of the agent's own turn and sends it back to fix what it broke. Existing debt sits in a baseline that can only shrink.

$ check_architecture.py --hook
Architecture check: 1 violation(s). Fix them before
finishing (move the code, do not silence the rule):
- src/app/invoices/new/page.tsx:5: ui contains
  `* 1.2` [R2]. Why: VAT is computed once, in
  src/server/invoicing/rules/

Architecture knowledge other tools can read

The audit is also exported as an Open Knowledge Format bundle: one Markdown file per domain, external system, rule and decision, to commit next to the code. It says what the team validated, and leaves out anything sensitive.

---
type: "Business Domain"
title: "Invoicing"
status: "stable"
generated: { by: "re-arch/1.0", at: "2026-10-19T00:00:00Z" }
verified: { by: "human:team", at: "2026-10-19T00:00:00Z" }
stale_after: "2027-02-16T00:00:00Z"
---

Install

Skills for Codex, Cursor, Gemini CLI, Copilot and the rest, in the project or globally with -g.

npx skills add GregoryBabonaux/re-arch

Then, in the project to audit, ask your agent: “Audit the architecture of this repository.”

Python 3.8 or later. The language toolchains (compiler, Go, Cargo, JDK, Node, PHP) make the graph exact when they are installed; without them, the scan falls back to regex resolution and says so.