An agent skill that generates an interactive, self-contained HTML map of any codebase — a dependency graph of its modules, a zoomable lines-of-code treemap, and stack-specific tabs for whatever the repo actually contains (API surface, DB schema, routes, background jobs).
One HTML file. No server, no CDNs, works offline. Light + dark themes, colorblind-validated palette.
npx skills add fadhlirahim/codebase-mapWorks with Claude Code and any agent that supports the open SKILL.md format.
Ask your agent:
map this codebase
or "visualize this repo", "make a codebase atlas", "help me understand this codebase visually". The skill walks the agent through the whole pipeline and ends with a verified HTML file plus a small map workspace, so refreshing the map after the code changes is a single command.
| Tab | What it shows |
|---|---|
| Architecture | Modules laid out by dependency depth — a module only imports downward, so height = position in the stack. Hover to trace imports (blue) vs. dependents (orange); click for a detail panel with purpose, key areas, LOC, git activity, and clickable dependency chips. |
| File explorer | Zoomable treemap of every module: cell area = lines of code, color = file type, hatching = tests/fixtures. Click to zoom, breadcrumbs to zoom out, sidebar with type breakdown and largest files. |
| Facet tabs | Stack-specific: tRPC/REST/GraphQL surface as ranked bars, DB tables grouped by domain, route trees, background-job lists. Declared as JSON — the agent writes a small extractor per stack, never edits the HTML. |
- documenso — open-source document-signing platform (292k LOC monorepo: React Router v7 + Hono, tRPC, Prisma). Map workspace in
examples/documenso/.
map-config.json ─┐
├─ scan.mjs ──► codebase-data.json ─┐
repo ────────────┘ │
meta.json (agent-written module descriptions) ──────┼─ build.mjs ──► your-map.html
facets.json (agent-written stack extractors) ────────┘ ▲
viewer.html (template)
scripts/scan.mjs— generic scanner. Discovers modules (explicit config → JS monorepo workspaces → top-level dirs), builds per-file LOC trees, dependency edges from package manifests, and git activity. Multi-language.scripts/build.mjs— assembles everything intoassets/viewer.htmland stamps the current git commit.- The agent supplies what a script can't:
meta.json(what each module is for, written after actually reading the code) andfacets.json(declarative stack-specific tabs — schemas and extractor recipes for tRPC, Drizzle, Prisma, Next.js/Express/FastAPI/Rails, GraphQL, job queues, and CLIs inreferences/facets.md).
The skill also bakes in the failure modes we hit building it: a mandatory sanity-check for generated files that drown real code (one 600k-line migration-snapshot dir will silently ruin every number), size-gated treemap recursion so deep directory chains don't render as voids, and a mandatory render-and-look verification step before handing off.
The pipeline is plain Node (20+), no dependencies:
# 1. describe the repo
cat > map-config.json <<'EOF'
{ "repo": "/path/to/repo", "title": "my-repo", "out": "my-repo-map.html" }
EOF
# 2. scan + build
node skills/codebase-map/scripts/build.mjs map-config.jsonThat alone gives you the architecture graph and treemap. meta.json and facets.json (optional, same directory) add the prose descriptions and extra tabs — see the SKILL.md for their shapes.
skills/codebase-map/
├── SKILL.md # the agent procedure
├── scripts/scan.mjs # generic repo scanner
├── scripts/build.mjs # assembler
├── assets/viewer.html # the interactive page (data-driven)
└── references/facets.md # facet schemas + per-stack extractor recipes
MIT