Generates an ARCHITECTURE.md for any codebase following the matklad standard — a concise, high-level map of modules and their relationships aimed at helping newcomers navigate the project. Triggers on "generate architecture doc", "create ARCHITECTURE.md", "document project architecture", or mapping codebase structure.
Analyze the codebase and generate an ARCHITECTURE.md following the matklad standard. The document is a country-level map — not an atlas of every state. Every recurring contributor will read it, so brevity matters.
Before writing anything, build a mental model:
README.md, CONTRIBUTING.md, CLAUDE.md, AGENTS.md).Write the document with these sections, omitting any that have no meaningful content:
One or two paragraphs explaining what the project does and the high-level approach. Answer: "What problem does this solve and how?"
The centerpiece. For each coarse-grained module or directory:
Use a flat list or table. Keep it at the right abstraction level — describe modules, not individual functions.
Document important constraints, especially those expressed as the absence of something:
model layer does not depend on view."repo layer."internal/ of another module."These invariants shape every future change and are invisible without explicit documentation.
If the project has patterns that span multiple modules, document them:
Only include concerns that a newcomer would need to know and that aren't obvious from the code.
FooParser in src/parser/"). Hyperlinks rot; names can be searched.ARCHITECTURE.md already exists, show a diff preview and ask before overwriting.