SkillsReviewed · zebbern

Code to Diagram

Code to Diagram is an assistant skill for developers who want diagrams of a codebase, but its approximate import matching can miss or misidentify dependencies. Its bundled Python script generates Mermaid architecture, file dependency and directory hierarchy diagrams, with optional SVG rendering through Mermaid CLI.

Researched 16 Nov 2026

In short.

Code to Diagram is a diagram-generating skill for developers exploring or documenting a project, but its diagrams need checking because dependency resolution uses simplified matching. The script supports Python, JavaScript, TypeScript, Go and Java files; only Python uses an AST, while the other languages use regular expressions. It produces Mermaid text and can invoke Mermaid CLI for SVG output. Its flowchart represents file imports, not execution flow. Nothing was executed, so accuracy, compatibility, performance and rendering remain untested.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage is limited to the complete supplied skills/code-to-diagram folder: SKILL.md, scripts/analyze_codebase.py and its LICENSE, plus the repository-level LICENSE, all at revision c8f12ba31081ce52578dea413c74789ab5437829. Other repository content, assistant integrations and Mermaid CLI internals were not assessed. No code was executed, no dependencies were installed and no diagrams were rendered. Accuracy, performance, compatibility and actual runtime behavior remain untested.

The overview

Identity

Code to Diagram is the skills/code-to-diagram folder in zebbern/claude-code-guide. It contains assistant instructions in SKILL.md and a directly callable Python program in scripts/analyze_codebase.py. The source location is [https://github.com/zebbern/claude-code-guide/tree/main/skills/code-to-diagram].

The skill describes architecture diagrams, flowcharts and org charts. Here, an org chart means a directory and source-file hierarchy. The bundled analyzer has no model or AI API integration.

Assessment

This is a plausible starting point for project orientation and draft documentation. It provides a concrete local command, editable diagram text and several views without requiring additional Python packages.

Its usefulness depends on whether its simplified resolver matches the project's imports correctly. A diagram with few edges may reflect unresolved imports rather than a loosely coupled system. It should not be treated as authoritative evidence for a refactoring decision without checking representative relationships.

Users

Developers joining an unfamiliar repository can use it to draft a structural overview. Reviewers and documentation authors may find the file import view and Mermaid output useful for explaining dependencies.

Beginners need enough command-line familiarity to supply a project path and locate output files. Experienced developers should inspect resolution accuracy, particularly in projects with aliases, relative imports, package-based imports or repeated filenames.

Capabilities

The scanner recognizes .py, .js, .jsx, .ts, .tsx, .mjs, .cjs, .go and .java files. It skips a fixed set of directories including node_modules, .git, virtual environments, build outputs and caches.

The architecture view groups files participating in resolved dependencies by directory, with finer grouping or file-level edges when needed. The flowchart displays file import relationships. The org view shows directories and some source files. Output options are Mermaid, SVG or both.

The --json option returns the project root, files grouped by language, extracted import strings and total scanned file count. It exits before internal dependency resolution, so this JSON does not include resolved edges or diagrams.

Using it

Requirements

The documentation specifies Python 3.7 or later and standard-library-only operation for Mermaid generation. The program needs a readable local project directory and a writable output directory. Interpreter and operating-system compatibility were not tested.

SVG output requires a separately installed @mermaid-js/mermaid-cli that exposes mmdc on the executable search path. The supplied material does not establish a required assistant account, model or assistant-specific installation method.

Mechanism

The program recursively scans supported files. Python's ast module extracts import statements; JavaScript, TypeScript, Go and Java use regular-expression patterns. This is static analysis of source text, without running the analyzed project.

The resolver builds an index from extensionless file paths and filename stems. It converts import separators to dots, then tries full and progressively shorter names against that index. It does not consult language package managers, compiler configuration or the importing file's directory to perform native module resolution.

Resolved relationships become Mermaid nodes and edges. Optional SVG rendering invokes mmdc as a subprocess with a 60-second timeout. Missing mmdc, a rendering error or a timeout causes a Mermaid-file fallback; the fallback message does not distinguish those causes.

Setup

Obtain SKILL.md, scripts/analyze_codebase.py and the accompanying license notices from the pinned source folder [https://github.com/zebbern/claude-code-guide/tree/c8f12ba31081ce52578dea413c74789ab5437829/skills/code-to-diagram]. Preserve the folder structure if using the documented relative script path.

From that folder, the documented starting command is python3 scripts/analyze_codebase.py /path/to/project. Add --output /path/to/diagrams to choose the destination. Use a separate output directory because generated files have fixed names such as architecture.mmd and can replace existing files with those names.

For SVG, install Mermaid CLI separately and make mmdc available before requesting --format svg or --format both. Exact renderer installation steps and compatible renderer versions are not supplied.

Example

An illustrative command for drafting an import diagram is python3 scripts/analyze_codebase.py /path/to/project --type flowchart --output /tmp/project-diagrams. According to the implementation, this requests flowchart.mmd in that directory and also prints the diagram text to standard output. This example was not executed.

If the resolver recognizes an import from one file to another, the diagram contains an arrow from the importing file to the imported file. That arrow does not establish that a function was called or that either file runs first.

To inspect extracted imports separately, use python3 scripts/analyze_codebase.py /path/to/project --json. The resulting data can help distinguish an import that was not extracted from one that was extracted but failed to resolve.

Assessment & evidence

Limitations

Dependency resolution is approximate. Python relative-import levels and imported member names are not retained; a statement such as from . import helper produces no recorded import. JavaScript relative paths are not resolved against the importing directory. Go package paths and Java wildcard or static imports are not handled comprehensively. Regex extraction can also match text in comments or miss syntax variants.

Filename-stem aliases can confuse files with the same name. Because the index is populated from a set, ambiguous matches may vary with iteration order. Computed or dynamic imports are not tracked, and the diagrams do not establish function calls, execution order or runtime behavior.

The dependency scan defaults to 500 supported files and stops in filesystem traversal order without an explicit truncation flag. The org chart walks the directory separately, so --max-files does not bound it. Its default depth is four, and it omits file nodes from directories containing more than ten supported source files.

Architecture and flowchart views omit files without resolved dependency participation. Mermaid identifiers are made by replacing punctuation with underscores, which can merge distinct paths into the same identifier. Rendering behavior for unusual filenames and large diagrams was not tested.

Reasoning

The source supports treating this as a draft visualization aid: it extracts imports, applies a compact resolver and emits editable Mermaid. That gives developers a concrete diagram to inspect, while the resolver's shortcuts limit what the graph can prove.

The documentation suggests using diagrams to spot cycles or excessive coupling. The script does not implement a dedicated cycle detector or coupling metric; a developer would need to interpret the graph and verify its completeness. These conclusions come from reading the supplied implementation, not executing it.

Alternatives

Within this resource, --type org is an option when directory structure matters more than imports, while --json exposes extracted imports without generating diagrams. Both retain the scanning limitations described above.

For intended architecture, a manually maintained diagram may communicate decisions that imports cannot reveal. For precise dependency resolution or runtime behavior, consider a language-aware analyzer or tracing tool whose coverage matches the project. No named competing products or comparative results are established by the supplied evidence.

Evidence

The available source material consists of skills/code-to-diagram/SKILL.md, skills/code-to-diagram/scripts/analyze_codebase.py, the folder's LICENSE and the repository-level LICENSE. The documentation establishes intended usage; the script establishes the implemented parsing, resolution and output behavior.

All four files are tied to source revision c8f12ba31081ce52578dea413c74789ab5437829. The original script is available at [https://raw.githubusercontent.com/zebbern/claude-code-guide/c8f12ba31081ce52578dea413c74789ab5437829/skills/code-to-diagram/scripts/analyze_codebase.py]. No test results, benchmarks or generated diagram samples are supplied, and nothing was executed.

Access & freshness

Costs

No price or usage charge is stated in the supplied material. The Python analyzer contains no model calls or API billing integration and requires no additional Python packages for Mermaid output.

Costs for an assistant used to invoke the skill, optional renderer setup and local computing resources are unknown. No measured runtime, memory use or operating cost is provided.

Rights

The folder's MIT notice names diagram-maker contributors, copyright 2026. The repository-level MIT notice names zebbern, copyright 2025. Both permit use, copying, modification, distribution, sublicensing and selling copies, subject to retaining the copyright and permission notices in copies or substantial portions.

Both notices disclaim warranty and liability. Preserve both supplied notices when redistributing the captured files. License terms for the separately installed Mermaid CLI are not included in this material.

Freshness

The supplied snapshot was captured on 16 November 2026 at 09:52:43 UTC from revision c8f12ba31081ce52578dea413c74789ab5437829. The findings apply to that revision.

The evidence does not establish a release version, latest commit date, current branch contents or compatibility with current Mermaid CLI releases. Copyright years do not establish maintenance activity.

Actions

Start with a small, representative project directory and a separate output directory. Compare several graph edges with actual imports, including relative imports and duplicate filenames, before using the diagram in documentation or refactoring work.

Check the scanned file count against the intended scope and adjust --max-files where necessary. Inspect --json output when expected edges are absent. For SVG, confirm that rendering produced the expected file and inspect any Mermaid fallback.

Treat these as suggested validation steps; none was performed here. Retain both MIT notices when sharing the source files.

Evidence for this report

LICENSEnotice · checked 2026-11-16
skills/code-to-diagram/LICENSEnotice · checked 2026-11-16
skills/code-to-diagram/SKILL.mdselected · checked 2026-11-16