code-to-diagram
Skill4.6k starsChanged 10 months agoMITView on GitHub
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.
Trending
Steady talk.thin dataabout the whole repository
Who's talking about zebbern/claude-code-guide
- @tom-doerr.bsky.social“https://github.com/zebbern/claude-code-guide”Bluesky · Jun 10, 2026 · 2 likes
- A Hacker News story“Claude Code Guide”Hacker News · Jul 1, 2025 · 2 points
- @tom-doerr.bsky.social“https://github.com/zebbern/claude-code-guide”Bluesky · Apr 4, 2026 · 1 likes
- coderPerseus/blog“使用两个月的 Claude Code ,总结下我的最佳实践”GitHub · Jul 20, 2025 · 1 reactions
- sudosubin/agents.nix“agent-skills.github.zebbern.claude-code-guide: init at 0-unstable-2026-05-31”GitHub · Oct 3, 2026
The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 8
Talked about on GitHub, Bluesky and Hacker News (8 times).
On GitHub · 5
- Jul 20, 2025使用两个月的 Claude Code ,总结下我的最佳实践 — coderPerseus/blog1 reaction · 1 comment
- Oct 3, 2026agent-skills.github.zebbern.claude-code-guide: init at 0-unstable-2026-05-31 — sudosubin/agents.nix0 reactions
- Apr 13, 2026Audit candidate: zebbern/claude-code-guide — xiaolai/nlpm0 reactions · 3 comments
- Apr 6, 2026Audit candidate: zebbern/claude-code-guide — xiaolai/nlpm0 reactions · 1 comment
- Nov 23, 2025AI 相关调研 — wenxueliu/cognitive_center0 reactions · 5 comments
On Bluesky · 2
- Jun 10, 2026https://github.com/zebbern/claude-code-guide — @tom-doerr.bsky.social2 likes and reposts
- Apr 4, 2026https://github.com/zebbern/claude-code-guide — @tom-doerr.bsky.social1 likes and repost
On Hacker News · 1
- Jul 1, 2025Claude Code Guide2 points
In this repository80 other files it gives its agents.
- skills/composition-patterns/AGENTS.mdAGENTS.md
- skills/react-best-practices/AGENTS.mdAGENTS.md
- academic-paper-reviewerSkill
- active-directory-attacksSkill
- api-fuzzing-bug-bountySkill
- api-shape-explorerSkill
- audit-flowSkill
- authentication-patternsSkill
- aws-penetration-testingSkill
- broken-authenticationSkill
- burp-suite-testingSkill
- cachingSkill
- chart-imageSkill
- cloud-penetration-testingSkill
- code-documenterSkill
- code-vuln-auditSkill
- vercel-composition-patternsSkill
- cross-examineSkill
- cv-tailorSkill
- database-optimizerSkill
- database-scoutSkill
- dataset-quality-auditSkill
- data-viz-rendererSkill
- deep-module-refactorSkill
- design-system-builderSkill
- dev-guide-generatorSkill
- ethical-hacking-methodologySkill
- file-path-traversalSkill
- html-injection-testingSkill
- http-load-profilerSkill
- idor-testingSkill
- linux-privilege-escalationSkill
- linux-shell-scriptingSkill
- localization-toolkitSkill
- log-error-digestSkill
- metasploit-frameworkSkill
- network-101Skill
- nextjs-developerSkill
- pdfSkill
- pentest-checklistSkill
- pentest-commandsSkill
- pipeline-blueprintSkill
- playwright-ciSkill
- playwright-coreSkill
- playwright-migrationSkill
- playwright-cliSkill
- playwright-pomSkill
- playwright-skillSkill
- privilege-escalation-methodsSkill
- project-sizing-guideSkill
- r2-uploadSkill
- r3f-animationSkill
- r3f-best-practicesSkill
- vercel-react-best-practicesSkill
- red-team-toolsSkill
- regression-modelerSkill
- regulatory-audit-generatorSkill
- repo-auditSkill
- route-to-openapiSkill
- scanning-toolsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 91
Create architecture diagrams for technical documentation
- Distinctive: line 102
Only analyzes static import relationships.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code to Diagram
Extract import and dependency relationships from a codebase via AST parsing, and automatically generate three types of diagrams:
- Architecture Diagram — Module/directory-level dependency relationships
- Flowchart — File-level import call chains
- 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/projectOutputs 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 orgSpecify 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 bothOutput JSON Analysis Results
python3 scripts/analyze_codebase.py /path/to/project --jsonParameters
| 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
- Scan phase: Recursively traverse the directory, skipping
node_modules,.git,__pycache__, etc. - Parse phase:
- Python files: uses the
astmodule to parseimportandfrom ... importstatements - JS/TS files: uses regex to match
import,require, andexport from - Go files: uses regex to match
importstatements - Java files: uses regex to match
importstatements
- Python files: uses the
- Resolve internal dependencies: Maps import paths to actual files within the project
- Generate diagrams: Converts dependency relationships into Mermaid diagram syntax
- Render (optional): Calls
mmdc(Mermaid CLI) to render.mmdfiles 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-filesto limit the scan scope - Mermaid diagrams with too many nodes may be hard to render; use
--typeto generate diagrams separately
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

