Codebase visualize
Skill Shaelz/codebase-visualize-skill/skills/codebase-visualize
Use to build a visual + operational map of a repository for an AI coding agent. Scans a target repo into a structured graph JSON and renders a self-contained interactive HTML map, with claim labels (fact / inference / unknown), risk hints, and an agent routing panel that suggests what to read before editing a file or domain. Good triggers: visualize this codebase, map the repo, show me the structure, what should I read before editing X, where do things live, generate a codebase map/graph. Does NOT do AST/import analysis, MCP, or diagram-tool export.From its SKILL.md
npx -y skills add Shaelz/codebase-visualize-skill --skill codebase-visualizeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.3 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
codebase-visualize
Turn a target repository into two refreshable artifacts:
docs/ai/visualize/codebase-graph.json- a structured graph (nodes + edges + metadata)docs/ai/visualize/codebase-map.html- a self-contained interactive map (no build step)
The point is operational cartography for agents: where things live, what is risky to touch, and what to read before editing - not pretty diagrams.
When to use this skill
Use it when:
- You (or another agent) are new to a repo and need a fast structural overview.
- Someone asks "visualize / map this codebase" or "where does X live".
- Before broad or multi-file changes, to see change surfaces and risk hints.
- You want an "agent routing" hint: what should I read before editing this area?
Skip it for tiny, well-understood single-file changes.
Workflow
The skill package is self-contained. Installation is separate from invocation;
resolve <skill-dir> to the installed or copied codebase-visualize directory
before running these commands.
-
Visualize the target repo:
node <skill-dir>/scripts/visualize.mjs --target /path/to/repoThis scans, then renders. It writes only:
<target>/docs/ai/visualize/codebase-graph.json<target>/docs/ai/visualize/codebase-map.html
-
Open the HTML file in a browser. Use the sidebar (domains), search box, tree/graph switch, map-signal notices, copy agent briefing action, and detail panel. Read the agent routing suggestions for the selected node.
-
Regenerate rather than hand-edit. The artifacts are snapshots. Re-run
visualize.mjs --target /path/to/repoafter the target repo changes.
Optional split commands:
node <skill-dir>/scripts/scan.mjs --target /path/to/repo
node <skill-dir>/scripts/render.mjs --target /path/to/repo
Use scan to refresh only the graph JSON. Use render when the graph JSON
already exists and you only need to rebuild the HTML map.
In the source repository, npm run demo runs both steps against the bundled
fixture.
Generated outputs
| File | What it is |
|---|---|
docs/ai/visualize/codebase-graph.json | Nodes (files/folders), edges (contains + references), and metadata. |
docs/ai/visualize/codebase-map.html | Self-contained interactive viewer (inline CSS/JS). |
Graph metadata includes: generated_at, target_root, scanner_version,
ignored_patterns, scan_warnings, counts, and a claim_policy.
Namespace and ownership contract
The intended default skill operation owns only docs/ai/visualize/* inside
a target repo.
The sibling codebase-orient-skill owns the root orientation docs:
| Path | Owner | Visualizer access |
|---|---|---|
docs/ai/visualize/codebase-graph.json | codebase-visualize | read + write |
docs/ai/visualize/codebase-map.html | codebase-visualize | read + write |
docs/ai/CODEBASE_MAP.md | codebase-orient | read-only advisory |
docs/ai/CHANGE_SURFACES.md | codebase-orient | read-only advisory |
docs/ai/OPEN_QUESTIONS.md | codebase-orient | read-only advisory |
Rules:
- Public commands accept only
--targetand write only the fixed paths underdocs/ai/visualize/. - If orientation docs are present in a scanned repo, they appear as normal graph
nodes with kind
docsand risk hintorient-docs. The scanner does not read their content to enrich routing hints (planned for a future version). - If orientation docs are absent, the visualizer works correctly from deterministic filesystem scans alone.
- Both tool families may coexist in the same repo without conflict.
Claim labels
Every classification in the graph carries a claim label so consumers know how much to trust it:
- fact - directly observed (path, name, extension, size, folder hierarchy).
- inference - heuristic guess from naming/extension (e.g. "looks like a route", "looks like a migration"). May be wrong.
- unknown - not enough signal to classify; treat as unexplored.
These three values are the claim_policy object embedded in every generated
graph's metadata and schema-validated before rendering. The HTML legend explains
them, and risk hints are shown per node.
Large-repo, sparse-reference, and many-unknown notices are usability guidance,
not hard failures. Scope the target to a subdirectory if the graph feels too
busy.
Safety / authority boundaries
- Outputs are generated and refreshable, not canonical truth.
- There is no real dependency/import analysis - do not treat edges as a call graph.
- Risk hints are heuristics; verify against the actual code before acting.
- The scanner reads the target. Public commands write only inside
<target>/docs/ai/visualize/. - Symlinks are reported and skipped rather than traversed. Unreadable
directories, files, and Markdown are reported in
metadata.scan_warnings. - The renderer accepts graph schema major version
1, validates required fields and relationships before rendering, and rejects malformed graphs without replacing an existing map. - Repository-controlled filenames and Markdown evidence are embedded as data, not executable markup. Reference evidence text is bounded.
- Do not hand-edit generated files; re-scan instead.
Out of scope through v1
No AST parsing, no MCP, no Excalidraw export, no dependency on
codebase-orient-skill, no heavy dependencies, no CI.
Example invocation
"Visualize the codebase at
./fixtures/sample-repoand tell me what I should read before editing the API routes."
node <skill-dir>/scripts/visualize.mjs --target /path/to/repo
# then open /path/to/repo/docs/ai/visualize/codebase-map.html
Select a route-looking file in the map; the agent routing panel lists the sibling files, configs, and docs to read first.
What ships with it: 10 files
140.0 KB alongside SKILL.md, 9 of them executable
assets/
- renderer.css21.9 KB
lib/
- commands.mjsruns3.7 KB
- renderer.mjsruns88.6 KB
- runtime.mjsruns1.6 KB
- scanner.mjsruns15.2 KB
- schema.mjsruns8.4 KB
- version.mjsruns40 B
scripts/
- render.mjsruns190 B
- scan.mjsruns188 B
- visualize.mjsruns193 B
Gives 0 of the 12 instructions most architecture codebase skills give in ~1.4k tokens
Counted across 811 of the 1,134 authors here whose files we hold, read 2026-08-07
- Ask the user which candidate to explorein 45 of 811, across 15 files
- Apply the deletion test to suspected shallow modulesin 43 of 811, across 15 files
- Read any relevant architecture decision records firstin 31 of 811, across 8 files
- Use exact glossary terms in every suggestionin 30 of 811, across 10 files
- Accept dependencies instead of creating themin 24 of 811, across 5 files
- Include before and after visualisations for each candidatein 24 of 811, across 5 files
- Read the domain glossary before exploringin 24 of 811, across 6 files
- Return results instead of producing side effectsin 23 of 811, across 4 files
- Explore the codebase for shallow modules and frictionin 23 of 811, across 3 files
- Introduce seams only where things varyin 22 of 811, across 3 files
- Reduce the number of methodsin 21 of 811, across 2 files
- Design deep modules with small interfacesin 21 of 811, across 3 files
Said here and by no other author read
- scan target repository into a graph
- render an interactive html map
- regenerate artifacts after repository changes
- scope target to a subdirectory if graph is too busy
- embed a claim policy in graph metadata
- report symlinks without traversing them
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.