matklad-architecture
Skill0 starsChanged 26 days agoMITView on GitHub
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.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- effective-goSkill
- git-commitSkill
- github-publishSkill
- github-releaseSkill
- github-topicsSkill
- nystrom-game-programming-patternsSkill
- ousterhout-software-designSkill
- silber-pixel-artSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Before writing anything, build a mental model:
- Very specific: line 12
Read the project's entry points, manifest files, and existing docs (README.md, CONTRIBUTING.md, CLAUDE.md, AGENTS.md).
- Distinctive: line 14
Read key files in each module to understand purpose and dependencies.
- Distinctive: line 16
Look for architectural patterns: layering, plugin systems, message passing, shared state.
- Distinctive: line 20
Write the document with these sections, omitting any that have no meaningful content:
- Distinctive: line 35
Use a flat list or table. Keep it at the right abstraction level — describe modules, not individual functions.
- Distinctive: line 39
Document important constraints, especially those expressed as the absence of something:
- Distinctive: line 49
If the project has patterns that span multiple modules, document them:
- Distinctive: line 57
Only include concerns that a newcomer would need to know and that aren't obvious from the code.
- Very specific: line 69
If ARCHITECTURE.md already exists, show a diff preview and ask before overwriting.
- Very specific: line 73
If the project uses a framework with strong conventions (Rails, Next.js, etc.), note the framework and only document deviations from its …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
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.
Explore the codebase
Before writing anything, build a mental model:
- Read the project's entry points, manifest files, and existing docs (
README.md,CONTRIBUTING.md,CLAUDE.md,AGENTS.md). - Map the top-level directory tree — identify coarse-grained modules, crates, packages, or service boundaries.
- Read key files in each module to understand purpose and dependencies. Focus on public interfaces, not internals.
- Trace one or two important call paths end-to-end (e.g., how a request flows from entry point to response) to understand module relationships.
- Look for architectural patterns: layering, plugin systems, message passing, shared state.
Generate ARCHITECTURE.md
Write the document with these sections, omitting any that have no meaningful content:
Bird's Eye View
One or two paragraphs explaining what the project does and the high-level approach. Answer: "What problem does this solve and how?"
Code Map
The centerpiece. For each coarse-grained module or directory:
- Name — the directory or crate name.
- Purpose — one sentence on what it does.
- Key types/files — name the most important ones (name, don't link — links go stale).
- Relationships — which other modules it depends on or is depended upon by.
Use a flat list or table. Keep it at the right abstraction level — describe modules, not individual functions.
Architectural Invariants
Document important constraints, especially those expressed as the absence of something:
- "The
modellayer does not depend onview." - "All database access goes through the
repolayer." - "No module imports from
internal/of another module."
These invariants shape every future change and are invisible without explicit documentation.
Cross-Cutting Concerns
If the project has patterns that span multiple modules, document them:
- Error handling strategy
- Logging / observability conventions
- Authentication / authorization flow
- Configuration loading
- Testing patterns (e.g., integration vs unit, fixture conventions)
Only include concerns that a newcomer would need to know and that aren't obvious from the code.
Writing principles
- Concise over complete — if it's in the code, don't repeat it. The doc points people to where things are, it doesn't explain how they work internally.
- Name, don't link — reference files and types by name (e.g., "
FooParserinsrc/parser/"). Hyperlinks rot; names can be searched. - Stable content only — only document things unlikely to change frequently. Omit volatile implementation details.
- No module internals — don't describe how a module works inside. That belongs in inline comments or module-level docs.
- Match the project's language — use the same terminology the codebase uses. Don't invent new names for existing concepts.
Edge cases
- If
ARCHITECTURE.mdalready exists, show a diff preview and ask before overwriting. - For monorepos, organize the Code Map by workspace/package, noting cross-package dependencies.
- For very small projects (< 2,000 LOC), a Bird's Eye View and a brief Code Map may be sufficient — skip Invariants and Cross-Cutting Concerns unless they're non-obvious.
- For very large projects (> 200,000 LOC), focus on the top two layers of the module hierarchy. Point readers to sub-module docs for deeper detail.
- If the project uses a framework with strong conventions (Rails, Next.js, etc.), note the framework and only document deviations from its standard structure.
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
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.

