Skip to content
Agentmart
Submit a tool

codebase-map

Generate an interactive, self-contained HTML map of any codebase — a dependency graph of its modules, a zoomable lines-of-code treemap, and stack-specific…

Skill by lyh843

IndexedMIT★ 1
Write a review

Chalk Labs

Need help deploying codebase-map?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/lyh843-codebase-map

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Generate 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 (API surface, DB schema, routes, background jobs). Use when the user asks for a codebase visualization, codebase map, architecture diagram/atlas, "help me understand this repo visually", "explore the codebase interactively", or wants to onboard someone onto a repo. Also use to refresh a map generated earlier by this skill.

Use cases: frontend, backend, data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Node.js package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/codebase-map

What's inside

Skill name
codebase-map
Description
Generate 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 (API surface, DB schema, routes, background jobs). Use when the user asks for a codebase visualization, codebase map, architecture diagram/atlas, "help me understand this repo visually", "explore the codebase interactively", or wants to onboard someone onto a repo. Also use to refresh a map generated earlier by this skill.
License
MIT
Metadata
version: 1.0.0
Instructions
86 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (5)

  • SKILL.md
  • viewer.html · assets/
  • facets.md · references/
  • build.mjs · scripts/
  • scan.mjs · scripts/

SKILL.md (first lines)

# Codebase Map

Produce a single self-contained HTML file (no CDNs, works offline, light+dark, colorblind-validated palette) that lets a visual learner explore a repo from architecture level down to individual files.

The pipeline separates what is generic from what is not:

- `scripts/scan.mjs` — generic scanner: modules, per-file LOC trees, dependency edges, git activity. Works on any repo.
- `scripts/build.mjs` — assembles scan + `meta.json` + `facets.json` into `assets/viewer.html` (single `__EMBED__` placeholder) and writes the final HTML.
- **You** supply the two things a script can't: prose understanding (`meta.json`) and stack-specific facets (`facets.json`, schema in `references/facets.md`).

## Procedure

### 1. Set up a map workspace
Ask where the output should live if not stated (default: a `codebase-map/` dir next to the repo, or the user's notes dir). Create a working dir there holding: `map-config.json`, `meta.json`, `facets.json`, `extract-facets.mjs`, and the output HTML. Keeping these files makes every future refresh a one-command rebuild.

### 2. Write `map-config.json`
```json
{
  "repo": "/abs/path/to/repo",
  "title": "repo-name",
  "subtitle": "COMPANY · WHAT IT IS · MONOREPO ATLAS",
  "out": "repo-name-map.html",
  "branch": "main",
  "topKinds": ["app"],
  "stripKinds": ["tooling"],
  "excludeDeps": ["@org/tsconfig", "@org/tailwind-config"],
  "excludeRel": ["drizzle/meta$", "migrations/meta$"],
  "edges": [["apps/web", "packages/api"]],
  "modules": [{ "id": "backend", "path": "src/backend", "kind": "service", "deps": ["core"] }]
}
```
Module discovery order: explicit `modules` → JS workspaces (pnpm-workspace.yaml / package.json workspaces, edges from package.json deps) → Cargo workspace members (edges from path/workspace deps) → Elixir umbrella `apps/*` (edges from `in_umbrella: true` deps) → top-level dirs (no edges). For anything else (Go multi-module, Django apps, single-app repos), list `modules` yourself with `deps` derived from a quick import grep — even rough edges make the graph useful. All fields except `repo`/`title`/`out` are optional.

- `topKinds`: kinds pinned to the top row (deployables — apps, services). Without it, layering is pure longest-path and low-dependency apps sink into the middle.
- `stripKinds`: kinds excluded from the graph and shown as a footnote chip strip (tooling, infra).
- `excludeDeps`: dep names every module shares (base tsconfig etc.) — they'd make the graph a hairball.
- `excludeRel`: regexes for **generated content that would drown real code** (lockfile-scale JSON, migration meta snapshots). Sanity-check for this in step 3.

### 3. Scan and sanity-check
```bash
node <skill-dir>/scripts/scan.mjs map-config.json codebase-data.json
```
Then inspect the biggest files/modules (quick `node -e` over the JSON). If the top files are generated artifacts, add `excludeRel` patterns and rescan. Do not skip this — one 600k-line generated dir silently ruins every number and treemap.

### 4. Write `meta.json` — the understanding layer
Explore the codebase (fan out a read-only subagent if your harness supports one; medium breadth: package manifests, entry files, key dirs — not whole files) across all modules and produce JSON:

> For each module return: "purpose" (1–2 specific sentences on what it does in the product), "keyAreas" (3–6 items, `"dir — what it does"` format), "runtime" (one line: where/when it runs), plus a top-level "runtimeStory" (4–6 sentences tracing how a request flows through the pieces at runtime). Base every claim on files actually seen.

Shape:
```json
{
  "runtimeStory": "…",
  "flow": [["browser → apps/web", "Next.js UI + BFF"], ["web → packages/api", "…"]],
  "testSegments": ["qa-datasets"],
  "modules": {
    "apps/web": { "purpose": "…", "keyAreas": ["src/app — …"], "runtime": "…", "testOnly": false }
  }
}
```
Write `flow` yourself: 4–6 numbered steps distilled from the runtimeStory. Mark test-harness modules (`e2e`, evals) with `testOnly: true` (dashed border in the graph). `testSegments` adds repo-specific dir names to the treemap's test-hatching heuristic. Modules in `stripKinds` just need `purpose` (used as the chip tooltip).

### 5. Build facets — the stack-specific tabs
Detect the stack, then write one throwaway `extract-facets.mjs` that emits `facets.json`. Read `references/facets.md` for the section schemas (`tiles`, `barlist`, `groups`, `tree`, `loclist`) and per-stack extractor recipes (tRPC, Drizzle, Prisma, Next.js/TanStack Start, Express/FastAPI/Rails/Django routes, Rust axum/actix + diesel/sea-orm/sqlx, Phoenix/Ecto/Oban, Go chi/gin + sqlc, GraphQL, job queues, CLIs) — the recipes are worked examples, not a whitelist; any stack works by grepping its registration idiom. 2–3 high-signal facets beat 5 thin ones; skip facets the stack doesn't have. Verify counts against the source (e.g. a "router" file with zero procedures is a helper — filter it, don't count it).

### 6. Build
```bash
node <skill-dir>/scripts/build.mjs map-config.json
```
Stamps the current commit/date from git and writes `cfg.out`.

### 7. Verify by rendering — mandatory
Open the file in a browser and look at every tab, both themes. If your browser tooling can't open `file://` URLs, serve briefly: `python3 -m http.server <port>` in the output dir (kill it after). Check: console has zero errors; graph layers/ordering look sane (adjust `topKinds`/`excludeDeps` if it's a hairball or apps sank); treemap shows colored file cells, not large empty dir voids; hover tooltips, node click → panel, treemap zoom + breadcrumbs work; facet numbers match the counts you verified in step 5; dark AND light themes both read well.

### 8. Hand off
Write a short README in the map workspace: what the map is, `node <skill-dir>/scripts/build.mjs map-config.json` to refresh, and that `meta.json`/`facets.json` are hand-maintained (counts auto-update on rebuild; prose and domain groupings don't). Offer to update the user's memory/notes with the location.

## Design constraints (do not regress these)

- The output must stay **fully self-contained** — no CDN scripts, no fetches, no web fonts. Everything inline; system font stacks only.
- The palette in `viewer.html` is pre-validated for both themes (colorblind-safe adjacent-hue ordering; low-contrast slots relieved by direct labels). Don't introduce new colors or reorder series colors. If the user wants brand colors, verify colorblind separation and surface contrast before swapping values.
- Treemap recursion is size-gated, not depth-capped — that's what keeps deep single-chain trees (Next.js app dirs) from rendering as voids.
- Tooltips carry full paths; labels appear only on cells that fit (relief rule for low-contrast fills).
- LOC counts and byte-based heuristics are for *visual proportion* only — never present them as anything more precise than that.

From lyh843/AgentSkills, MIT.

More from lyh843/AgentSkills

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Sep 12, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from lyh843

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get codebase-map running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying codebase-map?

CallGet help
Cite this page

codebase-map skill. Agent Mart. https://agentmart.dev/skills/lyh843-codebase-map (last updated 2026-10-24)