From codebase-mapper
Generate a structured, self-maintaining codebase map: a set of atomic Markdown docs in .claude/.codebase-info/ that ground every future Claude session in how the project is built. Use when the user asks to "map the codebase", "document the codebase", "create codebase documentation", "generate architecture docs", "onboard me to this project", "what does this codebase do", "bootstrap codebase docs", "set up codebase-mapper", or "analyze the project structure". Works for any language/stack and for both existing projects and brand-new or empty ones. To refresh an existing map after code changes, use update-codebase-map instead.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codebase-mapper:map-codebaseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate a codebase map as a collection of **atomic documents** in `.claude/.codebase-info/`. Each
Generate a codebase map as a collection of atomic documents in .claude/.codebase-info/. Each
document covers one aspect of the project, so the map stays easy to read, update, and navigate. The
map is written for the next Claude session (and the next human): it is grounding context, not
marketing.
Loading is automatic and you don't have to wire anything up: this plugin ships a SessionStart
hook that injects the map at the start of each session, so Claude starts oriented and keeps
consulting and updating it as work goes on. Never edit CLAUDE.md. The hook is the only loading
mechanism; leave CLAUDE.md alone. Your job is just to write the docs in .claude/.codebase-info/.
.claude/.codebase-info/
├── INDEX.md # Navigation hub + how-to-use; the hook injects this at session start
├── architecture.md # System overview, components, boundaries, data flow
├── tech-landscape.md # Languages, frameworks, runtimes, infra, source-of-truth files
├── directory-structure.md # Annotated folder tree
├── entry-points.md # Where execution starts (routes, CLIs, jobs, main files)
├── modules.md # Key modules/packages: purpose, deps, exports
├── communication.md # APIs, events, queues, external integrations (if applicable)
├── database.md # Schema, relationships, migrations (if applicable)
├── dependencies.md # Categorized packages (if applicable)
├── patterns.md # Recurring patterns, error handling, testing, config
├── coding-style.md # Conventions derived from linters + existing code
├── docker.md # Containers / local dev environment (if applicable)
├── onboarding.md # Quick start + common tasks
└── .map-state.json # Machine state (last-mapped commit + date) for staleness checks
This list is a menu, not a checklist. Create only the documents that earn their place in this codebase, and feel free to go beyond the list when a project has a major aspect the standard docs do not cover. Two directions:
database.md if there's no datastore, docker.md if there are
no containers, dependencies.md if there's no dependency manifest, and so on. A tiny project might
only need INDEX.md, architecture.md, tech-landscape.md, and onboarding.md.ml-pipeline.md for a training/inference flow, cli-reference.md
for a tool with many subcommands, realtime.md for a websocket/event core, iac.md for substantial
infrastructure-as-code). List any such doc in INDEX.md and in the state file the same as the rest.The test for every doc, standard or not, is the same: would a future session be meaningfully faster for having it? If yes, write it; if not, leave it out.
Get the lay of the land first, then pick a path:
.git/, node_modules/, vendor/, dist/, build/,
target/, .venv/, __pycache__/, .next/, lockfiles, generated code, minified assets).Then branch:
Also check today's actual date (it's provided in the session context, or run date) so the
"Last Updated" stamps are real, not placeholders.
Read the project's manifest/config files to determine languages, frameworks, and tooling. See
references/language-detection.md for a broad map of signal files across ecosystems
(JS/TS, Python, Go, Rust, Java/Kotlin, .NET, Ruby, PHP, Swift, Elixir, C/C++, Dart/Flutter,
monorepos, and more). Note the framework(s) — they dictate where things live.
List the tree (git ls-files in a git repo gives a clean, ignore-aware listing; otherwise tree
or a recursive list, skipping the noise dirs above). Identify the organizing principle:
controllers/, services/, models/features/auth/, domains/billing/domain/, application/, infrastructure/packages/*, apps/*, workspacesWhere does execution begin? Web routes, API routers, CLI command handlers, background workers/cron,
serverless handlers, library public exports, app main/bootstrap files, build/start scripts.
For the 3–5 most important features, trace end to end: entry point → business logic → data layer →
external effects. Example: POST /api/users → UserController.store() → UserService.create() →
users table → WelcomeEmail. Note shared utilities and cross-cutting concerns (auth, logging,
validation, error handling).
From the manifest(s), categorize: Core (framework/runtime), Data (DB/ORM/cache), External (API clients, third-party services), Dev (test/lint/build). Capture only what aids understanding — don't transcribe the entire lockfile.
Recurring design patterns, error-handling approach, configuration/secrets management, logging and
observability, and testing structure. Derive coding style from linter/formatter configs
(.eslintrc, ruff.toml, .editorconfig, rustfmt.toml, etc.) and from what the code
actually does.
First decide the doc set: walk the aspects you found in Steps 1–6 and pick the documents this project
warrants (see "This list is a menu, not a checklist" above). Then create each one in
.claude/.codebase-info/ using the templates in references/document-templates.md. For a
non-standard doc with no matching template, follow the same shape (title, Last Updated line, concrete
paths, tables/diagrams where they help). For each document:
*Last Updated: YYYY-MM-DD* line under the title.src/auth/guard.ts), not vague descriptions.INDEX.md compact. The hook injects it into context at the start of each session, so it should
summarize the project in a few lines and link out to the detailed docs, which Claude reads on
demand. Include the short "How to use / How to maintain this map" section from the template.Write .claude/.codebase-info/.map-state.json so update-codebase-map can detect staleness
precisely:
{
"tool": "codebase-mapper",
"version": "2.1.0",
"mappedAt": "YYYY-MM-DD",
"gitCommit": "<full HEAD SHA, or null if not a git repo>",
"documents": ["architecture.md", "tech-landscape.md", "..."],
"hashes": {
"INDEX.md": "<SHA-256 of the exact file contents>",
"architecture.md": "<SHA-256 of the exact file contents>"
}
}
Get the SHA with git rev-parse HEAD (use null if the project isn't a git repo). List exactly the
documents you created. Hash INDEX.md and every listed document from its exact final contents. Write
the documents and .map-state.json as one map update: stage the final document contents first, then
atomically replace the state file so a hook can only ever see either old hashes or a safely detectable
stale manifest.
Finally, tell the user the map is ready, remind them to commit .claude/.codebase-info/ so their
team and every future session share it, and note that the plugin's hook will surface it
automatically from now on.
A brand-new or empty project has little to map yet — so seed the map with intent and let it grow:
README, a spec/PRD, design notes, issues, or scaffolding.INDEX.md, architecture.md (goals + intended design), tech-landscape.md
(chosen/intended stack), directory-structure.md (planned layout), and onboarding.md. Mark it
clearly as a greenfield seed that will grow.update-codebase-map fills in the rest as real code lands.For hundreds or thousands of source files, don't try to read everything serially:
apps/web, services/api, packages/core) or per document,
each returning a concise structured summary. Consolidate their reports into the atomic docs.CLAUDE.md. The plugin's hook handles loading. Do not add, edit, or remove
anything in CLAUDE.md (or CLAUDE.local.md).node_modules/, vendor/, build output, or secrets..claude/.codebase-info/ created with INDEX.md + all applicable atomic docsINDEX.md is compact, links every created doc, and includes the how-to-use/maintain sectionLast Updated date and verified file paths.map-state.json written with date, HEAD SHA (or null), and the document listCLAUDE.md left untouched.claude/.codebase-info/references/document-templates.md — templates for every document typereferences/language-detection.md — signal files for detecting stacks across ecosystemsnpx claudepluginhub eigenwise/eigenwise-toolshed --plugin codebase-mapperOrchestrates parallel subagents to map any codebase, creating docs/CODEBASE_MAP.md with architecture, file roles, dependencies, and navigation. Updates incrementally via git or scans.
Generates or updates a feature-organized CODEMAP.md for any codebase, detecting frameworks and tracing end-to-end flows. Supports create, inventory, update, and section modes.
Analyzes unfamiliar codebases to produce onboarding guides with architecture maps, entry points, conventions, and a starter CLAUDE.md. Useful when joining a new project.