- Home
- Skills
- Technical Documentation
- Architecture Diagrams from Code with Mermaid and C4
Works with the AI Agents you already use
Architecture Diagrams from Code with Mermaid and C4
Generate C4-style, sequence and ER diagrams in Mermaid from a real repo, every node traced to a file, then drift-check old diagrams as ACCURATE, DRIFTED or MISSING.
$7
Architecture Diagrams from Code with Mermaid and C4
Example session with this skill installed
Our docs/architecture folder is from last year. Check whether the diagrams still match this monorepo, fix what drifted, and add an ER diagram from the migrations. Keep it Mermaid so it renders on GitHub.
- Read your context and instructions
- Compiled the architecture diagrams from
Architecture diagrams - shop-monorepo @ 4e1c9a2
Verdict: DRIFTED Mode: DRIFT CHECK Format: Mermaid
Defaults used: output location docs/architecture/
Diagram status
| Diagram | File | Nodes | Verdict | Notes |
|---|---|---|---|---|
| Containers | docs/architecture/02-containers.md | 7 | DRIFTED | search service removed, worker missing |
| Checkout sequence | docs/architecture/10-seq-checkout.md | 5 | ACCURATE | matches handlers |
| ER | (none) | - | MISSING | migrations/ has 9 tables |
Updated containers diagram
flowchart LR
user((Customer))
subgraph system["shop-monorepo"]
web[web<br/>Next.js]
api[orders_api<br/>Express]
worker[worker<br/>BullMQ]
db[(postgres)]
q[[redis queue]]
end
stripe{{Stripe API}}
user -- HTTPS --> web
web -- "REST /api/*" --> api
api -- SQL --> db
api -. "order.created" .-> q
q -.-> worker
worker -- HTTPS --> stripe
Evidence (excerpt)
| ID | Element | Evidence | Conf. |
|---|---|---|---|
| N3 | worker | docker-compose.yml:31, apps/worker/src/index.ts:4 | HIGH |
| E4 | api -> queue | apps/api/src/orders/service.ts:52 | HIGH |
| E6 | worker -> Stripe | apps/worker/package.json (stripe), charge.ts:18 | HIGH |
Unconfirmed (not drawn)
analytics- only in a comment in apps/web/lib/track.ts
Drift fixes
- [stale]
search- no service in compose, k8s or code since apps/search was deleted - remove node and 2 edges - [missing]
worker+ queue - add as above - [missing] ER view - generate 20-er.md from migrations/
Next steps
- Write 20-er.md, update 02-containers.md, record 4e1c9a2 as last verified
- Render-tested with mmdc: 2 of 2 diagrams parse
Connects securely to your tools. The creator never sees your data.
About this skill
Architecture diagrams go stale fast, and diagrams an AI draws from scratch often include services, queues or vendors that the code does not have. This skill builds diagrams from the repository itself and requires a file path as evidence for every box and arrow.
What it does:
- Runs read-only discovery across docker-compose, Kubernetes manifests, Terraform, package manifests, entry points, routes, queue clients, external API clients and migrations
- Builds an evidence table (path:line, confidence) and leaves out anything it cannot prove, listing it under "Unconfirmed"
- Writes a small set of Mermaid diagrams: system context, containers, one component view, 1-3 sequence flows and an ER diagram from the schema
- Applies size rules (about 15 nodes per diagram, split beyond 20), shape and edge conventions, and a legend on every diagram
- Places files under docs/architecture/ with an index, an evidence file and a README embed, and records the commit they were verified against
- Re-checks existing diagrams against the code and grades each one ACCURATE, DRIFTED or MISSING, with exact fixes
- Includes a reference on current Mermaid syntax (flowchart, sequenceDiagram, erDiagram, C4, architecture-beta), GitHub and GitLab rendering, and mmdc/D2 validation commands
Who it's for: developers, tech leads and technical writers who need onboarding docs, design-review material or an audit of architecture docs that are out of date.
Honesty note: the diagrams describe the code at a single commit, not live production topology. The skill does not invent services, versions or vendors. Mermaid's C4 and architecture-beta types are experimental or beta, so the skill defaults to stable types and tells you to check the host's Mermaid version first.
Diagrams reflect what the repository declares at one commit, not live production. Services in other repos, console-created cloud resources, and runtime-only wiring cannot be seen. Rendering depends on the Mermaid version the host runs, so beta and experimental types need a version check. D2 and PlantUML do not render natively on GitHub.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 month ago
Requires