agentleFS
MartinPLarsenMartinPLarsen/claude-architecture-skills/architecture-audit/SKILL.md

architecture-audit

Skill4 starsChanged 5 months agoMITView on GitHub

Produce a complete, visual architecture audit of an entire repository using a fleet of parallel subagents. Scouts the repo, fans out one reader per subsystem, synthesizes a single Markdown document with Mermaid flowcharts (system context, end-to-end pipeline, component map, data lifecycle, the domain's core transform, integrations, control loop, governance, and a "where do I edit X" cheatsheet), then adversarially verifies every claim against the actual code before finishing. Use this whenever the user wants to understand how a whole codebase fits together start-to-finish, map how all the agents/services/modules connect, visualize a pipeline or data flow, audit the architecture, onboard onto an unfamiliar repo, or build the shared context needed to decide on new or changed features. Triggers: "architecture audit", "audit this whole repo", "map this whole codebase", "how does everything connect", "diagram the system", "flowchart the pipeline", "subagent-driven audit", "onboard me onto this repo". Reach for this even when the user does not say the word "audit" but clearly wants a holistic, diagrammed understanding of an entire system rather than a single-file answer.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use prototype and tdd.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    prototype

    Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the entry points and the docs that explain intent: README, package.json/pyproject/go.mod/Cargo.toml/etc., any …

    line 21
  2. Very specific:

    Evidence over assertion: Every claim traces to path:line.

    line 63
  3. Distinctive:

    Honest status: Never present specs/planned work as shipped.

    line 64

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Repo Architecture Audit

What this does and why it works

Produce one self-contained Markdown document that explains an entire codebase start-to-finish, with Mermaid flowcharts as the primary medium, grounded in path:line evidence, and verified against the real code before it is handed over. The output is a decision aid: someone reads it and knows how the system connects and where to edit things, without re-reading the repo.

The method is subagent-driven for a reason. A whole-repo audit is too much for one context to hold well, and one reader is blind to the seams between subsystems. Fanning out one reader per subsystem in parallel covers more ground, keeps each reader's context focused, and surfaces contradictions between subsystems that a single pass misses. A dedicated verify pass then catches the failure mode that matters most here: a confident synthesis claiming something the code does not actually do (planned work shown as shipped, wrong gate order, invented field mappings).

You are the orchestrator. Scout first so the fan-out is informed, then run the phases below. Default to the Workflow tool (this skill is explicit opt-in for it). If Workflow is unavailable, fall back to parallel Agent calls; if subagents are unavailable entirely, run the phases inline and sequentially, which is slower and lower-coverage but still works.

Phase 0 — Scout inline (do not fan out blind)

Spend a few cheap tool calls building the work-list before spawning anything. You cannot pick good subsystem boundaries until you have seen the shape of the repo.

  • Map the tree and file sizes, excluding vendored/generated noise: node_modules, .git, dist/build/out, vendor, .next, target, lockfiles, and any worktrees/mirror copies (read each file once, from the canonical tree only).
  • Read the entry points and the docs that explain intent: README, package.json/pyproject/go.mod/Cargo.toml/etc., any CLAUDE.md/ARCHITECTURE/docs/, migrations, and config.
  • Identify the subsystems — the natural seams along which to split readers. These are repo-specific; derive them, do not assume. Common seams:
    • agents / services / workers (the active units of work)
    • executable pipeline or business-logic code (what actually runs, vs specs)
    • data layer (schema, migrations, state model, storage)
    • the domain's core transform (the thing this system exists to do: image/media generation, schema mapping, ETL, model inference, payment flow)
    • external integrations / publishing (APIs, third-party services, webhooks)
    • frontend / presentation / rendering
    • orchestration / control plane / scheduling / cost or rate guards
    • governance / rules / config / requirements contracts
  • Decide reader count from repo size: small repo → 4-5 readers, medium → 6-8, large/monorepo → 9-12 (and consider one reader per package). Note language and conventions (so output language matches the repo).

Tell the user the subsystem split you chose in one line, then launch.

Phase 1 — Map (parallel readers, one per subsystem)

Spawn one reader per subsystem in parallel. Each reader reads its files fully (cite path:line), ignores the excluded dirs, and returns structured notes — not a chat reply, raw data for synthesis. Give every reader the same output template so the synthesizer can merge them; see references/doc-template.md for the template and the full diagram catalog.

The exact orchestration that works — a Workflow script with a Map → Synthesize → Verify → Fix pipeline — is in references/workflow-skeleton.js. Read it, fill in the scouted subsystem list and per-reader prompts, and run it with Workflow({script}). It is parameterized; you only edit the READERS array and the date.

Each reader extracts, for its subsystem: a summary; components (name, status: shipped / parked / planned, role, inputs, outputs, key files path:line, services used); data and control flow with the trigger and handoff contract; rules/gates enforced; diagram hints as A --> B: label edges; and gotchas/stale/contradictory findings. The status field is load-bearing: the single most useful and most error-prone thing an architecture doc does is distinguish what is built from what is only specified.

Phase 2 — Synthesize (write the document)

One agent takes all reader notes and writes the audit doc to docs/ARCHITECTURE-AUDIT-<YYYY-MM-DD>.md (or the repo's docs convention). Write to a new dated file — never overwrite an existing architecture.md or any doc that may be locked; reference the old one instead. Prose in the user's/repo's language, identifiers/paths/table names in their original form.

The doc follows the section + diagram catalog in references/doc-template.md. Every major section carries at least one valid Mermaid diagram (flowchart, sequenceDiagram, stateDiagram-v2, erDiagram). Keep node labels short and put detail in the surrounding prose. The non-negotiable diagrams: a system-context graph, an end-to-end primary-flow flowchart with every gate/decision drawn as a decision node, and a "where do I edit X" cheatsheet table. Adapt the rest to what the repo actually has.

Phase 3 — Verify (adversarial, against the code)

Spawn a verifier that reads the written doc, then checks its load-bearing claims against the actual files. Focus on the claims most likely to be wrong: stage/flow order and which module owns each step; every gate and threshold; data model / state machine values; the core-transform details (model names, field mappings, formats); shipped-vs-planned labels; and that Mermaid blocks are syntactically valid. It returns findings as {severity, location, claim, reality (path:line), fix} and a one-line verdict. This pass is what makes the doc trustworthy rather than plausible.

Phase 4 — Fix

Apply the real corrections (blockers/majors and clearly-correct minors) with surgical edits to the doc, preserving what was right and keeping Mermaid valid. Return a short changelog.

After the run

Relay to the user, briefly: where the doc is, how many diagrams, the handful of facts that should change their mental model (especially shipped-vs-planned surprises and anything stale/contradictory found), and offer one clear next action (commonly: reconcile the stale docs the audit surfaced). Do not invent recommendations the audit does not support.

Quality bar (the few things that make or break this)

  • Evidence over assertion. Every claim traces to path:line. "The code shows X" beats "the system does X".
  • Honest status. Never present specs/planned work as shipped. When sources disagree, say so in the doc rather than silently picking one.
  • Diagrams carry the load. The user asked to see it. Lead with flowcharts; prose annotates them.
  • Verify before handover. The Fix phase is not optional; an unverified audit is plausible fiction.
  • Don't clobber. New dated file. Locked/append-only docs are read, not rewritten.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.