code-to-diagram

code-to-diagram is a skill for Claude Code, Codex from zebbern/claude-code-guide. It costs 74 tokens per session (923 once invoked), scanned A, original, MIT.

A tool that reads a codebase’s import relationships and generates architecture diagrams, flowcharts, and file-hierarchy charts. It supports Python, JavaScript, TypeScript, Go, and Java, with Mermaid or SVG output.

In plain words
What is it for?
Use it to understand project architecture, trace imports between files, document folder structure, or create diagrams for review and onboarding.
Why use it?
It replaces manual diagram drawing and gives developers a quick visual map of how a project is connected and arranged.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to understand project architecture, trace imports between files, document folder structure, or create diagrams for review and onboarding.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zebbern/claude-code-guide/code-to-diagram
About the project

Claude Code Guide is a reference collection for configuring and using Claude Code, Anthropic’s command-line coding agent. Developers use it to learn commands, skills, agents, MCP, automation, security, integrations, and troubleshooting. Its catalogue add-ons provide many of the documented skills and agents.

zebbern/claude-code-guide · 4,665 stars · on GitHub

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.

Any agent
npx skills add zebbern/claude-code-guide --skill code-to-diagram
Clone the repo
git clone --depth 1 https://github.com/zebbern/claude-code-guide

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-to-diagram

README.md
[![agentmods](https://agentmods.dev/badge/skills/zebbern/claude-code-guide/code-to-diagram/github.svg)](https://agentmods.dev/skills/zebbern/claude-code-guide/code-to-diagram)
Your own site
<a href="https://agentmods.dev/skills/zebbern/claude-code-guide/code-to-diagram"><img src="https://agentmods.dev/badge/skills/zebbern/claude-code-guide/code-to-diagram/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-to-diagram

Your own site · 80×15
<a href="https://agentmods.dev/skills/zebbern/claude-code-guide/code-to-diagram"><img src="https://agentmods.dev/badge/skills/zebbern/claude-code-guide/code-to-diagram.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 923 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00074 $0.00923
Opus 5.5 $0.00030 $0.00369
Sonnet 5.5 $0.00015 $0.00185
Haiku 4.5 $0.00007 $0.00092

Measured 1mo ago against content hash 82de1fa72456, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-to-diagram 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 1mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/analyze_codebase.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/code-to-diagram/SKILL.md · 105 lines

How it starts

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

Code to Diagram

Extract import and dependency relationships from a codebase via AST parsing, and automatically generate three types of diagrams:

  1. Architecture Diagram — Module/directory-level dependency relationships
  2. Flowchart — File-level import call chains
  3. Org Chart — Directory/file hierarchy structure

Supported languages: Python, JavaScript, TypeScript, Go, Java

Output formats: Mermaid text (.mmd) or SVG images (requires mmdc installed on the system)

Usage

Basic: Analyze an Entire Project

python3 scripts/analyze_codebase.py /path/to/project

Outputs three Mermaid diagrams to stdout and writes .mmd files to the current directory.

Specify Diagram Type

# Architecture diagram only
python3 scripts/analyze_codebase.py /path/to/project --type architecture

# Flowchart only
python3 scripts/analyze_codebase.py /path/to/project --type flowchart

# Org chart only
python3 scripts/analyze_codebase.py /path/to/project --type org

Specify Output Directory and Format

# Output to a specific directory
python3 scripts/analyze_codebase.py /path/to/project --output /tmp/diagrams

# Output as SVG (requires mmdc)
python3 scripts/analyze_codebase.py /path/to/project --format svg

# Output both Mermaid and SVG
python3 scripts/analyze_codebase.py /path/to/project --format both

Output JSON Analysis Results

python3 scripts/analyze_codebase.py /path/to/project --json

Parameters

Parameter Description
directory Code directory to analyze (required)
--type, -t Diagram type: architecture, flowchart, org, all (default: all)
--output, -o Output directory (default: current directory)
--format, -f Output format: mermaid, svg, both (default: mermaid)
--max-files Maximum number of files to scan (default: 500)
--max-depth Maximum depth for org chart (default: 4)
--json Output analysis results in JSON format

Read the full file on GitHub · 105 lines

Files

What ships with it

2 files 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. 1mo ago First seen · 105 lines · 74 tokens per session scan A 82de1fa72456

Subscribe to this mod's changes

code-to-diagram is a skill published in the GitHub repository zebbern/claude-code-guide (4,665 stars, last pushed yesterday), licensed MIT. It adds 74 tokens to every session and 923 once invoked, about $0.0003 per session on Opus 5.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.

Related

Other skills, from other repositories

code-to-chart

A code-structure diagram maker that examines how files and modules depend on one another. It supports Python, JavaScript, TypeScript, Go, and Java, and produces Mermaid text or SVG images.

serejaris/kimi-skills · 102 tokens

code-to-diagram

Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts. Uses AST parsing to map import dependencies for Python, JS/TS, Go, and Java, outputting Mermaid or SVG files. Triggered when users ask to visualize code architecture, understand dependencies, draw a flowchart, or create a…

serejaris/kimi-skills · 74 tokens

fin-arch-diagram

A tool for creating architecture diagrams, process flowcharts, and hierarchy trees. These show how system parts, business steps, decisions, or organizational levels relate to one another.

csmar432/finai-research · 72 tokens

tech-diagram

Use this skill when the user wants to turn a description into a technical diagram — architecture diagrams, flowcharts, sequence diagrams, state machines, ER diagrams, class diagrams, or mind maps. Generates brand-consistent Mermaid that the DesireCore chat renders inline as SVG, with a semantic shape/arrow vocabulary…

desirecore/market · 210 tokens

diagram-creator

Create professional diagrams using Mermaid, PlantUML, and other text-based diagram tools. Generate flowcharts, sequence diagrams, architecture diagrams, and more.

claude-office-skills/skills · 34 tokens

document-generation

Generates structured documents including architecture diagrams (Mermaid), usage manuals, progress reports, and API documentation from code analysis.

pan94u/forge · 27 tokens