An agentic skill that generates C4 architecture diagrams from any codebase
An agentic skill that generates C4 architecture diagrams from any codebase and uses vision to review them for architectural vulnerabilities.
This is a proof of concept exploring what happens when you combine LLM multimodality with architectural reasoning. The idea is simple: have the model read your code, produce C4 diagrams (system context, containers, components, data flows), render them to PNG, then read the diagrams back using vision to reason about the architecture at a structural level.
The results have been surprisingly useful. We've found real architectural vulnerabilities across multiple projects this way, things like missing security boundaries between public-facing containers and databases, single points of failure, circular dependencies, and error paths that don't exist. These are hard to spot reading code file-by-file but become obvious when you look at the picture.
| File | Level | Content |
|---|---|---|
c1-system-context.mmd |
C1 | External actors and third-party systems |
c2-container.mmd |
C2 | Deployable units and their relationships |
c3-component-<name>.mmd |
C3 | Internal modules per container |
c4-<name>-pipeline.mmd |
C4 | Sequence diagram per major data flow |
*.png |
- | Rendered image for each .mmd |
README.md |
- | Diagram index + architecture review table |
The architecture review at the end is the interesting part. It reads every rendered PNG alongside the source code and flags confirmed issues with severity, diagram evidence, and code evidence.
npx skills add yaambe/synopsisOr manually copy the skill into your skills directory:
# Clone the repo
git clone https://github.com/yaambe/synopsis.git
# Copy to your skills directory
cp -r synopsis/skills/synopsis ~/.claude/skills/or
cp -r synopsis/skills/synopsis ~/.agents/skills/After installation, restart your agent. The skill will be available as /synopsis in any project.
- Node.js for Mermaid CLI (
mmdcvianpx) - Python 3 for the recon, lint, and render scripts
- Optional: ImageMagick (
mogrify+identify) or macOSsipsfor post-render resizing
You can invoke the skill via slash command. This is the recommended way. Simply asking tends to under trigger it.
/synopsis
You can also target specific levels or refresh existing diagrams:
> just the context diagram
> update the c2 container diagram
> render the existing .mmd files in docs/c4/ to PNG
-
Recon -
scripts/recon.pyscans the repo for manifests, deploy configs, entry points, and existing docs to identify containers and candidate pipelines. -
Parallel sub-agents - One agent per diagram, each with a specialized prompt template from
references/. They read the actual source code and emit Mermaid.mmdfiles. -
Lint -
scripts/lint.pyvalidates structural correctness (missing directives, leftover code fences, missingUpdateLayoutConfig). -
Render -
scripts/render.pyconverts.mmdto PNG with sizes tuned for vision input limits (long edge <= 1568px, ~1.15MP). -
Architecture review - The agent reads every rendered PNG back using vision, cross-references with the source code, and produces a findings table with confirmed/unconfirmed issues.