Skip to content

About

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.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

codebase-map

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.

Install

npx skills add fadhlirahim/codebase-map

Works with Claude Code and any agent that supports the open SKILL.md format.

Use

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.

What you get

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.

Example output

  • documenso — open-source document-signing platform (292k LOC monorepo: React Router v7 + Hono, tRPC, Prisma). Map workspace in examples/documenso/.

How it works

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 into assets/viewer.html and 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) and facets.json (declarative stack-specific tabs — schemas and extractor recipes for tRPC, Drizzle, Prisma, Next.js/Express/FastAPI/Rails, GraphQL, job queues, and CLIs in references/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.

Using the scripts without an agent

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.json

That 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.

Repo layout

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

License

MIT

About

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.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages