/architecture-audit:greenfield-audit <path>from architecture-audit
Read-only architecture audit that derives requirements from tests, docs, and entry points, designs a minimal from-scratch architecture, then classifies every component as KEEP/SIMPLIFY/REPLACE/DELETE. No files edited.
Ships in architecture-audit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Scope: $ARGUMENTS
When the scope is empty, ask for the path in the chat and stop. This is the only question the run may ask.
The current architecture has no authority. Several generations of agents produced and modified it. Expect conceptual debt, accidental abstractions, and inherited decisions whose justification no longer exists.
The goal is not to make the current code more elegant. The goal is to find the minimal architecture the system needs today and to measure the existing code against it.
Constraints for the whole run:
file:line, or as a commit hash for intent recovered from
git, for every requirement, invariant, and verdict.Copy this checklist into the response and tick each line when its text is emitted:
Audit progress:
- [ ] Phase 1: five requirement lists and Unproven emitted, no implementation file opened
- [ ] Phase 2: target architecture emitted, still no implementation file opened
- [ ] Phase 3: implementation read, important components inventoried
- [ ] Phase 4: one verdict per component with evidence
- [ ] Output: five sections delivered, no file edited
Establish what the system must do from sources that describe behavior, not from the code that implements it.
Allowed sources in this phase:
git log --oneline or --stat on the scope, and commit messages, to
recover intent. No -p, no git show, no git blame: they print
implementation.Forbidden in this phase: internal modules, services, helpers, hooks, stores, utilities, or any file whose only role is to implement behavior. Locate them by name, or by a search that lists matching file names only, to know they exist. Never print matching lines from a forbidden file: that reads it.
Emit five lists as text. Every item cites its source.
Put anything with no test, doc, or entry point behind it in an "Unproven" list. An unproven behavior is a candidate for deletion, not a requirement.
Design the minimal architecture from Phase 1 only. Emit it as text now, before any Phase 3 tool call.
Rules:
Deliver:
Now read the implementation. Map every important component of the scope.
Phase 1 and Phase 2 are frozen from here. A behavior found in code with no Phase 1 item goes to Unproven. Never add it to the Phase 1 lists and never amend the Phase 2 design to make room for it.
A component is important when at least one holds:
Group small helpers under the component that owns them. For each component record: location, responsibility as implemented, callers, what it depends on.
Match each component against the Phase 2 target and give one verdict.
| Verdict | Meaning |
|---|---|
| KEEP | A target module has the same responsibility and an equivalent interface, naming aside. A rewrite would produce it again. |
| SIMPLIFY | The need exists, but the component carries responsibilities, indirection, or configurability the target does not. |
| REPLACE | The need exists and the current shape is wrong. A full rewrite is acceptable when the result is substantially simpler and more coherent. |
| DELETE | No Phase 1 item requires it, or a framework-native feature already covers it. |
Tie-break rules:
Deliver in the chat, in this order, then stop:
Requirements: the five Phase 1 lists, then Unproven, as emitted, with the Phase 3 additions to Unproven.
Target architecture: the Phase 2 text, unchanged.
Verdict table: Component | Verdict | Target counterpart | Evidence | Loss if applied. Example rows, paths invented:
| Component | Verdict | Target counterpart | Evidence | Loss if applied |
|-----------|---------|--------------------|----------|-----------------|
| `src/routes/api/posts.ts` | SIMPLIFY | `content` module, `listPosts(filter)` | Behavior 3 (`tests/posts.test.ts:41`). The handler also formats dates and paginates (`posts.ts:20-77`); the target leaves both to the caller. | None. The date format asserted at `tests/posts.test.ts:58` moves with the caller. |
| `src/lib/EventBus.ts` | DELETE | Absent by design | One publisher and one subscriber (`EventBus.ts:4`, `sync.ts:17`). No Phase 1 item requires the decoupling. | None. `sync.ts:17` calls `reindex()` directly. |
Rewrites proposed: the REPLACE rows grouped by subsystem, with why the result is simpler and the main risk. No new components appear here.
Unknowns: questions the user must answer before any edit starts.
Do not edit any file. Do not propose a migration order. The diagnostic is the deliverable.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub bengous/claude-code-plugins --plugin architecture-audit