codemap
Skill0 starsChanged 7 months agoMITView on GitHub
Generate a single CODEMAP.md at the repo root containing a filtered file tree, a one-line purpose for each source file, and exported top-level symbols (functions, classes, constants). Invoke at the start of a new conversation in an unfamiliar repo to avoid spending tokens on repeated Glob / Grep / Read exploration. Supports Python, TypeScript/JavaScript, and Go for symbol extraction; other files appear in the tree only.
13 other projects use a version of this.
Adopted by
Most recently taken up by
- hmjBill/skillstheir own version, first seen Oct 5, 2026
- lglucas/ai-dev-operating-systemtheir own version, first seen Sep 28, 2026
- jellydn/my-ai-toolstheir own version, first seen Sep 28, 2026
- vladimirstempel/oh-my-claude-code-slimtheir own version, first seen Sep 20, 2026
- akitaonrails/my-skillstheir own version, first seen Sep 17, 2026
- mike22890/opencode-skills-cntheir own version, first seen Sep 13, 2026
Used with
Projects with it also use clonedeps, deepwork and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
hbollonSkillclonedeps
Clone important project dependency source code into an ignored local workspace so OpenCode can inspect library internals. Use when the user asks to clone dependencies, inspect dependency/source internals, understand SDK/framework behavior from source, debug library implementation details, or make core dependency repos locally readable. Do not use for ordinary API/docs questions where @librarian is enough.
Also in 4 projects that use this
hbollonSkilldeepwork
Orchestrator-only workflow for heavy coding sessions, multi-phase implementation, and risky refactors. Use for complex work that needs planning, review gates, and persistent progress tracking.
Also in 3 projects that use this
Hugging FaceSkillsimplify
Refactor code after tests pass. The "Refactor" phase of Red-Green-Refactor.
Also in 4 projects that use this
Microsoft AzureSkillreflect
Learning capture system that extracts HIGH/MED/LOW confidence patterns from conversations to prevent repeating mistakes. Use after user corrections ("no", "wrong"), praise ("perfect", "exactly"), or when discovering edge cases. Complements .squad/agents/{agent}/history.md and .squad/decisions.md.
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- JordanCoin/codemap★ 704same name
- huisezhiyin/sdd-riper★ 330same name
- openyida/openyida★ 219same name
- akitaonrails/my-skills★ 205same name
- jellydn/my-ai-tools★ 122same name
- lglucas/ai-dev-operating-system★ 12same name
- beadnall/codemap★ 9same name
- shalomb/agent-skills★ 3same name
- arkan/skills★ 1same name
- hbollon/opencode-config★ 1same name
3 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- answer-cacheSkill
- api-contractSkill
- diff-summarySkill
- file-summarySkill
- git-digestSkill
- log-extractSkill
- run-quietSkill
- session-handoffSkill
- test-failures-onlySkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Do NOT invoke when:
- Very specific: line 57
If the user passed root=<subdir>, filter to only files under <subdir>/.
- Very specific: line 59
If the repo has > 5000 files, abort and ask the user for a root=<subdir>.
- Very specific: line 86
Run these grep commands as parallel Bash calls, one batch per language, piping the results into a buffer Claude parses:
- Very specific: line 194
If a symbol you need is not in the map, fall back to Grep for the precise location.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
codemap
A Markdown-only skill — no Python, no scripts. You (Claude) walk the
repo using git ls-files and the Glob tool, then use grep to extract
top-level symbols per language. The result is a single CODEMAP.md at the
repo root.
When to invoke
Invoke codemap when ANY of these apply:
- This is a new conversation in a repository you have not explored yet.
- The user asks "where is X?" without giving a path.
- You are about to make 3+
Glob/Grepcalls just to understand layout. - The user explicitly types
/codemapor asks to "regenerate the codemap".
Do NOT invoke when:
- A fresh
CODEMAP.mdalready exists at the repo root and was generated today (read it instead). - The task is scoped to one file whose path is already known.
- The repo is trivial (< 10 source files) — direct exploration is cheaper.
Trade-off vs the old Python parser
The Markdown recipe uses grep patterns instead of AST parsing. That means:
- Faster, no dependencies — works anywhere
gitandgrepare available. - Slightly less precise — multi-line declarations, decorators changing visibility, or unusual formatting may produce false positives/negatives.
- Good enough for navigation — the map is a hint, not gospel. If a
symbol isn't where the map says, fall back to
Grepfor the exact location.
How to run
Step 1 — list source files
git ls-filesThis is the single best source of truth: it respects .gitignore and skips
junk like node_modules, .venv, __pycache__, etc. for free.
If the user passed root=<subdir>, filter to only files under <subdir>/.
If the repo has > 5000 files, abort and ask the user for a root=<subdir>.
Step 2 — classify files by language
| Extension | Language |
.py | Python |
.ts, .tsx, .mts, .cts | TypeScript |
.js, .jsx, .mjs, .cjs | JavaScript |
.go | Go |
| anything else | unknown — tree only, no symbol extraction |
Step 3 — extract one-line purpose per file
For each source file, read just the first ~20 lines (use head -n 20 or
Read with limit: 20) and pull a purpose from the first match:
- Python: triple-quoted string at top of file → its first line.
- TS/JS: leading
/**JSDoc → first content line; else top single-line comment// …runs joined. - Go: leading
// Package <name> …comment → text after package name. - Fallback: humanized filename (e.g.
auth_middleware.py→ "auth middleware").
Cap each purpose at ~80 characters.
Step 4 — extract exported top-level symbols (per language, in parallel)
Run these grep commands as parallel Bash calls, one batch per language,
piping the results into a buffer Claude parses:
Python
grep -nE '^(class|def|async def) [A-Za-z_]' <file>
grep -nE '^[A-Z][A-Z0-9_]*\s*=' <file>Skip symbols beginning with _ (Python convention for private).
TypeScript / JavaScript
grep -nE '^export\s+(default\s+)?(async\s+)?(function|class|const|let|var|interface|type|enum)\s+[A-Za-z_]' <file>
grep -nE '^export\s+\{' <file>For the export { … } case, capture the full braces block (may span lines —
use grep -nA 5 and stop at the closing brace).
Go
grep -nE '^func\s+(\([^)]+\)\s+)?[A-Z][A-Za-z0-9_]*\s*\(' <file>
grep -nE '^type\s+[A-Z][A-Za-z0-9_]*\s' <file>
grep -nE '^(var|const)\s+[A-Z][A-Za-z0-9_]*\s' <file>Go's convention: exported = uppercase-initial.
Cap symbols per file at max=N (default 30). For each symbol, record the
line number and a one-line signature (trim to first ~80 chars).
Step 5 — write CODEMAP.md
Path: <repo-root>/CODEMAP.md. Overwrite if it exists.
# CODEMAP
_Generated: <UTC timestamp>_
## Tree
<repo-name>/
├── src/
│ ├── api/
│ │ ├── auth.py
│ │ ├── users.py
│ │ └── init.py
│ └── auth/
│ └── jwt.py
├── tests/
│ └── test_users.py
└── README.md
(Render the tree as ASCII art. Show all files from `git ls-files`. Group
tests under a separate `## Tree (tests)` section unless `includetests=true`.)
## Files
### src/api/auth.py
_auth middleware — validates JWTs on every request_
- L12 `class AuthMiddleware:`
- L34 `def verify_jwt(token):`
- L60 `JWT_ALGORITHM = "HS256"`
### src/api/users.py
_user CRUD endpoints_
- L8 `class UserCreate(BaseModel):`
- L20 `def create_user(payload):`
- …
(Sort by path. Skip files with no symbols when listing under `## Files`;
they still appear in the tree.)Step 6 — confirm
Print one line to the user:
codemap: wrote CODEMAP.md (<N> files, <M> with symbols)Supported arguments
| Argument | Default | Purpose |
root=<subdir> | repo root | Index only this subtree (useful in monorepos). |
max=N | 30 | Cap symbols listed per file. |
includetests=true | off | Include test files in the main ## Files section instead of a separate group. |
refresh=true | off | (no-op in the Markdown version — full regen is the only mode) |
Notes
CODEMAP.mdis a derived artifact — add it to.gitignoreif you don't want it committed (some teams prefer to commit it as repo documentation; either choice is fine).- The Markdown recipe does not maintain a cache. Regeneration is cheap
because most of the work is parallel
grep, and Claude only needs to read one short response per file. - Parser errors on individual files are non-fatal: if a
grepfails, the file appears in the tree without symbol detail. - If a symbol you need is not in the map, fall back to
Grepfor the precise location. The map is a navigation aid, not an exhaustive index.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

