arch-mmd
1
总安装量
1
周安装量
#42867
全站排名
安装命令
npx skills add https://github.com/aravhawk/claude-code-utils --skill arch-mmd
Agent 安装分布
amp
1
opencode
1
cursor
1
kimi-cli
1
codex
1
github-copilot
1
Skill 文档
Architecture Diagram Generator
Create or update an ARCHITECTURE.mmd Mermaid diagram that maps out the codebase’s structure, components, and data flow.
PHASE 1: EXPLORE THE CODEBASE
Thoroughly scan the project to understand its architecture:
- Identify project type â framework, language, monorepo vs single app
- Map top-level structure â directories, entry points, config files
- Identify key modules â the actual files/packages that form the backbone
- Trace data flow â how data moves through the system (user action -> entry point -> handler -> service -> store, etc.)
- Find external dependencies â databases, APIs, queues, caches, third-party services
- Note boundaries â client/server split, module boundaries, package boundaries in monorepos
PHASE 2: BUILD THE DIAGRAM
Use graph TD (top-down) as the default direction. Use graph LR (left-right) only if the architecture is pipeline-shaped or heavily horizontal.
Node labels
Include the file/module name and a brief description using <br/> for multi-line labels:
ENGINE["engine.py<br/>CodeLoader + Orchestrator"]
CLI["cli.py<br/>Arg parsing + validation"]
For simple/obvious nodes, a single-line label is fine:
DB[(PostgreSQL)]
Node IDs
Use short, uppercase IDs: CLI, ENGINE, AUTH, DB, API
Connections
- Use
-->for standard flow - Label edges with the technology, protocol, or relationship when it adds clarity:
-->|"REST"|,-->|"queries"| - Use
&fan-in syntax when multiple nodes feed into one target:
P1 & P2 & P3 --> AGENT
Color coding with style
Color-code nodes by their role to make the diagram scannable at a glance. Pick a small, consistent palette (4-6 colors). Always include color:#fff for readability.
Role-to-color suggestions (adapt to the project):
| Role | Color | Example |
|---|---|---|
| Entry point / user-facing | #e74c3c (red) |
CLI, UI, API gateway |
| Core engine / orchestrator | #2980b9 (blue) |
Main engine, coordinator |
| Agent / processor | #8e44ad (purple) |
Workers, agents, handlers |
| External service / API | #e67e22 (orange) |
Third-party APIs, LLMs |
| Output / result | #27ae60 (green) |
Reports, exports, responses |
| Infrastructure / runtime | #16a085 (teal) |
Runners, browsers, terminals |
Example:
style ENGINE fill:#2980b9,color:#fff
style REPORT fill:#27ae60,color:#fff
Node shapes
["Label"]â default rectangle for most components[(Database)]â databases and data stores only- No other shapes needed in most cases; keep it uniform
PHASE 3: WRITE THE FILE
- Write the diagram to
ARCHITECTURE.mmdin the project root - If
ARCHITECTURE.mmdalready exists, read it first, then update it to reflect the current state â don’t start from scratch unless the existing diagram is fundamentally wrong - The file should contain ONLY the Mermaid diagram â no markdown fences, no frontmatter, no prose
CONSTRAINTS
- Map real modules, not abstractions â nodes should correspond to actual files, packages, or services in the codebase, not vague concepts like “Business Logic Layer”
- Include brief descriptions â use
<br/>in labels so someone unfamiliar with the codebase can understand each node’s role - Always color-code â a diagram without
styledirectives is incomplete - Right level of granularity â show the key files/modules that form the architecture, not every single file, and not just 3 abstract boxes
- No orphan nodes â every node must connect to at least one other node
- Accuracy over completeness â only include components confirmed to exist in the codebase
- Update, don’t recreate â when updating an existing diagram, preserve the user’s structural choices and only change what’s outdated