Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

code-to-diagram

Skill by zebbern

Code-to-diagram analyzes a codebase's import dependencies and generates Mermaid or SVG architecture diagrams, flowcharts, and org charts. It suits developers who want to understand an unfamiliar project or review dependencies.

  • Score 88
  • 4.7k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install code-to-diagram

Built from the published package, never by AI.

git clone --depth 1 https://github.com/zebbern/claude-code-guide /tmp/claude-code-guide && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-guide/skills/code-to-diagram ~/.claude/skills/code-to-diagram

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install code-to-diagram in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

Code-to-diagram scans a source directory and maps import and dependency relationships. It produces three diagram types: an architecture diagram of module-level dependencies, a file-level flowchart of import chains, and an org chart of the directory and file hierarchy. Output is Mermaid text (.mmd) by default, with SVG available if the Mermaid CLI (mmdc) is installed.

The skill runs a Python script that skips folders such as node_modules and .git. Python files are parsed with the standard ast module. JavaScript, TypeScript, Go, and Java files are matched with regular expressions. The script resolves imports to files inside the project and can also print JSON analysis results. The source describes it for developers who want to understand module structure, review dependencies, or plan refactoring.

Written from the project's SKILL.md and checked against it.

What it can do

  • Architecture diagramGenerates a module or directory-level dependency diagram in Mermaid format.
  • FlowchartGenerates a file-level flowchart of import call chains.
  • Org chartGenerates a directory and file hierarchy chart with a configurable maximum depth.
  • Multi-language import parsingParses imports in Python, JavaScript, TypeScript, Go, and Java.
  • SVG renderingRenders diagrams to SVG when the Mermaid CLI is installed.
  • JSON analysis outputOutputs the analysis results in JSON format with the --json flag.

What you need

  • Python 3.7 or later
  • Mermaid CLI (@mermaid-js/mermaid-cli) for SVG output

Try asking

  • Generate an architecture diagram for the code in my project folder.
  • Draw a flowchart of the import chains in this codebase.
  • Create an org chart of the directory structure, limited to depth 3.

Good to know

  • Only static import relationships are tracked; dynamic imports are not.
  • Scans up to 500 files by default, adjustable with --max-files.
  • Diagrams with too many nodes may be hard to render.
  • JavaScript, TypeScript, Go, and Java imports are matched with regex, not a full AST parser.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/code-to-diagram/SKILL.md, skills/code-to-diagram/scripts/analyze_codebase.py. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • LICENSE1 KB
  • SKILL.md4 KB
  • scripts/analyze_codebase.py17 KB

Alternatives to code-to-diagram

All alternatives →
paperbananadwzhu-pku
94

PaperBanana generates publication-quality academic diagrams from a paper's methodology text and figure caption. It is aimed at researchers preparing figures for venues such as NeurIPS, ICML, and ACL.

AAA Skill 7.7k
technical-wireframe-info-layoutMengTo
94

Creates a monochrome technical wireframe design system for dark diagnostic interfaces. It covers layout, typography, info labels, widgets and an exploded wireframe centerpiece. It is for designers and developers building teardown, systems dashboard or specification-style screens.

AAA Skill 8.5k
spline-3d-integrationsickn33
94

Guides an AI assistant through embedding interactive Spline.design 3D scenes in web projects. It covers vanilla, React, Next.js, Vue and iframe setups, for developers adding 3D to websites.

AAA Skill 50k
code-slice-heroheygen-com
94

Code Slice Hero is a HyperFrames headline block. A tiled surface flips cell by cell to reveal a second headline behind the first, at 1920×1080 and 8 seconds.

AAA Skill 92k
patentfigdavila7
94

Generates patent-office-compliant figures and converts drawings through the PatentFig AI API. Built for patent filers who need USPTO or EPO line art, CAD-ready vectors, or filing-ready TIFF, PDF, or PNG files.

AAA Skill 34k
framed-tech-dark-border-gradientMengTo
94

Creates a framed dark technical design system for AI assistants, using border-gradient shells, asymmetrical grid panels, and mono labels. Suited to premium, instrument-like interfaces that need visible boundaries. Published by MengTo.

AAA Skill 8.5k

Compare with paperbanana, technical-wireframe-info-layout or spline-3d-integration

code-to-diagram: common questions

Which languages does code-to-diagram support?

The source lists Python, JavaScript, TypeScript, Go, and Java. Python uses the ast module, and the other four languages use regex matching.

Can it output images instead of Mermaid text?

Yes. With the --format svg or both option it outputs SVG, but this requires the Mermaid CLI (mmdc) to be installed on the system.

Does it track dynamically loaded modules?

No. The source says only static import relationships are analyzed and dynamic imports are not tracked.

How do I install code-to-diagram?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is code-to-diagram free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is code-to-diagram safe to use?

It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to code-to-diagram?

Similar skills: paperbanana, technical-wireframe-info-layout, spline-3d-integration, code-slice-hero.

code-to-diagram Install

Add to stack

Loading.