c4-diagrams

A guide to drawing C4-style software architecture diagrams, which show systems, users, responsibilities, boundaries, dependencies, and data flow at useful levels of detail.

In plain words
What is it for?
Use it to document an existing codebase, sketch a new system, review architecture, or create diagrams in ASCII or Mermaid.
Why use it?
It helps explain how existing code fits together and exposes unclear system boundaries before implementation. Diagrams can make design decisions easier to discuss.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/intent-driven-dev/intent-driven-template/c4-diagrams
Any agent
npx skills add intent-driven-dev/intent-driven-template --skill c4-diagrams
Clone the repo
git clone --depth 1 https://github.com/intent-driven-dev/intent-driven-template

Made for: Claude Code, Codex.

Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 822 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.00822
Opus 5 $0.00018 $0.00411
Sonnet 5 $0.00007 $0.00164
Haiku 4.5 $0.00004 $0.00082

Measured yesterday against content hash 5ba43fe1b6e7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

c4-diagrams scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/c4-diagrams/SKILL.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C4 Diagrams

Overview

Use C4 diagrams to clarify software architecture before detailed design. Focus on boundaries, responsibilities, actors, dependencies, and data flow; draw only the levels that add value.

First Gates

Before diagramming, determine these choices. If the user already specified one, honor it. If multiple choices are ambiguous, ask one concise combined question.

Choice Options Default behavior
Purpose Existing code, new system, design review Existing code requires codebase exploration first; new systems require assumptions called out.
Format ASCII, Mermaid Ask the user. Mermaid means plain Mermaid syntax, not C4-specific Mermaid.
Rigor Strict C4, lightweight C4-inspired, hybrid Ask the user. Do not decide silently.

If the user asks to skip questions for speed, still preserve unresolved choices as explicit assumptions and keep the first diagram lightweight.

Workflow

  1. Establish purpose, format, and rigor.
  2. For existing code, inspect entry points, runtime boundaries, integrations, and persistence before drawing. For a quick pass, inspect enough to identify language/framework, launch entry points, major directories, external integrations, and data stores; label anything else as unknown.
  3. Pick the smallest useful diagram set. Start with system context or container; add component, dynamic, or deployment only when it answers a real question.
  4. Draw the diagram using ASCII or plain Mermaid.
  5. Explain the diagram in 3-6 bullets: boundaries, responsibilities, key relationships, assumptions, and open questions.
  6. Stop before detailed design unless the user approves the diagram and asks to continue.

C4 Level Selection

Level Use when Avoid when
System context Identifying users, external systems, and scope The scope is already obvious and local.
Container Showing deployable/runnable units, data stores, APIs, CLIs, queues You only need code-level call flow.
Component Explaining internals of one container The container has few meaningful internal parts.
Code Rarely, for critical classes/modules A normal component diagram would be enough.
Dynamic Showing request, event, or workflow sequence Static structure is the actual question.
Deployment Showing infrastructure, nodes, networks, runtime placement Deployment is unknown or irrelevant.

Read the full file on GitHub · 68 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 68 lines · 36 tokens per session scan A 5ba43fe1b6e7

Subscribe to this mod's changes

c4-diagrams is a skill published in the GitHub repository intent-driven-dev/intent-driven-template (121 stars, last pushed 8d ago), licensed MIT. It adds 36 tokens to every session and 822 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.