SkillAgentSearch skills...

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.

Install / Use

npx skills add zebbern/claude-code-guide --skill code-to-diagram

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

91/100

Category

Automation

Supported Platforms

Universal

Our assessment of code-to-diagram

code-to-diagram scores 91/100 on our quality scale, 675th of 2,035 Automation skills we index (top 34%).

Its SKILL.md is 3.8 KB long, well organised into 17 sections with 4 code examples: a solid amount of guidance for an agent.

With 4,638 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
26/30
Structure
20/20
Description
15/15
Adoption
16/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated 2 days ago, so code-to-diagram is actively maintained.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

code-to-diagram compared with similar skills

All 4 of these similar skills score higher than code-to-diagram; compare them before choosing.

SkillScoreStarsUpdatedFormat
code-to-diagram (this skill)by zebbern914.6k2d agoSKILL.md
Agent-Reachby Panniantong10085.9k13d agoCLAUDE.md
headroomby headroomlabs-ai10074.0k1d agoCLAUDE.md
rufloby ruvnet10073.4ktodayCLAUDE.md
crawl4aiby unclecode10084.4k3d agoMCP Server

Frequently asked questions

How do I install code-to-diagram?
Run npx skills add zebbern/claude-code-guide --skill code-to-diagram. The install tabs above show the steps for each supported agent.
Which AI agents does code-to-diagram work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is code-to-diagram safe to use?
It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is code-to-diagram still maintained?
The repository was last updated 2 days ago, so code-to-diagram is actively maintained.

name: code-to-diagram description: "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 module diagram from source code." license: MIT type: tool tags: ["visualization", "architecture", "mermaid", "ast", "diagram"]

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 |

How It Works

  1. Scan phase: Recursively traverse the directory, skipping node_modules, .git, __pycache__, etc.
  2. Parse phase:
    • Python files: uses the ast module to parse import and from ... import statements
    • JS/TS files: uses regex to match import, require, and export from
    • Go files: uses regex to match import statements
    • Java files: uses regex to match import statements
  3. Resolve internal dependencies: Maps import paths to actual files within the project
  4. Generate diagrams: Converts dependency relationships into Mermaid diagram syntax
  5. Render (optional): Calls mmdc (Mermaid CLI) to render .mmd files as SVG

Use Cases

  • Quickly understand the module structure of an unfamiliar project
  • Visualize dependencies during code review
  • Create architecture diagrams for technical documentation
  • Detect circular dependencies or excessive coupling
  • Analyze project structure before refactoring

Dependencies

  • Python 3.7+ (standard library only, no extra packages needed)
  • SVG output requires @mermaid-js/mermaid-cli (optional)

Notes

  • Only analyzes static import relationships; dynamic imports are not tracked
  • For large projects, use --max-files to limit the scan scope
  • Mermaid diagrams with too many nodes may be hard to render; use --type to generate diagrams separately

Related Skills

View on GitHub
GitHub Stars4.6k
CategoryAutomation
Updated2d ago
Forks469

Languages

Python

Trust signals

100/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

No cautions