agentleFS
theishandubeytheishandubey/dotclaude/skills/map-architecture/SKILL.md

map-architecture

Skill2 starsChanged 15 days agoMITView on GitHub

Use when starting in an unfamiliar codebase or asked to document how a system works, to produce one architecture document with diagrams where every fact points at the code.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    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:

    Every node, edge, state and transition carries a path:line reference read at one pinned commit.

    line 9
  2. Distinctive:

    Never run migrations, deploys, or anything that touches a shared database or real credentials.

    line 13
  3. Distinctive:

    When the user wants a page to look at or share, publish the same content as a page instead of a second format.

    line 18
  4. Distinctive:

    Orient from cheap signals: Read the README, the manifests, the CI file (the one build recipe known to work), and the entry points: mains, …

    line 23
  5. Distinctive:

    Write the one-paragraph purpose now, before reading more.

    line 24
  6. Distinctive:

    Keep each diagram to what one screen holds: about 12 nodes, about 8 states on the main path.

    line 53
  7. Very specific:

    Run it by its path in this skill's folder.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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

Map architecture

Produce one Markdown document with Mermaid diagrams. Every node, edge, state and transition carries a path:line reference read at one pinned commit. A wrong map is worse than none, so nothing goes in that was not seen in code or in a run.

Work read-only on the code. Never run migrations, deploys, or anything that touches a shared database or real credentials.

Where it goes

Unless the user names a path: .claude/architecture/<repo>.md in the home repo when the workspace has one, otherwise .claude/architecture.md in the repo, left uncommitted. When the user wants a page to look at or share, publish the same content as a page instead of a second format.

Method

  1. Pin the commit. Record git rev-parse --short HEAD in the document's Commit: line and read everything at that commit.
  2. Orient from cheap signals. Read the README, the manifests, the CI file (the one build recipe known to work), and the entry points: mains, servers, routes, CLI commands, jobs. Write the one-paragraph purpose now, before reading more.
  3. Read the data model before the logic. Migrations or schema files, or the main data shapes when there is no database. Name the three to seven core entities and how they relate.
  4. Follow a connected slice. From entry points and registrations, follow imports and call sites until each responsibility reaches its input, its output or its side effect. An edge is a real call or write site and the condition that permits it. A function that is exported but never called on the normal path is not an edge.
  5. Trace one real request by running it. Pick the user action that matters most, get it running the way CI does, put a stack dump or breakpoint at the final write or response, trigger it once, and read the stack from the bottom up. Stub paid or external services at the edge. Record each hop as path:line and what happens there.
  6. Draw state machines from a table, never from memory. For each entity with a status field, search for every assignment and update of that field. List each write as a row: from, to, guard, path:line. Draw the diagram from the table. A state with no inbound transition, a state with no way out that is not terminal, and a status value the schema allows but no code writes are findings: list them. Retry and recovery appear only when they are real transitions in the code.

The document

Follow template.md. Include a section only when the code has something to show for it.

SectionDiagramDrawn from
System contextflowchart: the system, its users, external servicesManifests, entry points, outbound clients, config
Componentsflowchart with boundaries by ownership, trust and deploymentModule layout, imports, registrations
Request tracesequenceDiagram of one real requestThe run in step 5
State machinesone stateDiagram-v2 per stateful entityThe transition table in step 6
Data modelerDiagram with keys and cardinalityMigrations or schema files
Data flowflowchart of stages where data changes form or ownerCall and write sites

Keep each diagram to what one screen holds: about 12 nodes, about 8 states on the main path. Split by subsystem or entity instead of shrinking. Mark what you saw happen as ran, and what you concluded without confirming as inferred. End with what was not traced.

Check it

python3 check_refs.py <document> --repo <repo>

Run it by its path in this skill's folder. It fails when a path:line does not resolve at the pinned commit, when a state diagram and its transition table disagree, or when a Mermaid block does not parse (checked only if mmdc is installed). Fix every failure and rerun.

Report

Give the path and a five-line summary, then say what kind of confidence each part has: references checked by script, behavior read or run by you, diagrams rendered or not.

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.