update-codemap
Skill2 starsChanged 6 days agoMITView on GitHub
Regenerate the project codemap at .claude/codemap.md — produce an LLM-facing architecture document with prose overview, per-module roles, detected conventions, hub files, and structured file/class graphs for downstream visualization. Use when the user types /update-codemap or asks to refresh / create / update the codemap for the current project.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- tranhieutt/software_development_departmenttheir own version, first seen Apr 30, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- tranhieutt/software_development_department★ 71same name
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 repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- autonomizeSkill
- blueprintSkill
- brainstormSkill
- captureSkill
- checkpointSkill
- close-outSkill
- coordinateSkill
- cycleSkill
- deliverSkill
- design-proposalSkill
- discoverSkill
- dispatchSkill
- draft-planSkill
- envisionSkill
- executeSkill
- extract-conventionsSkill
- glossarySkill
- humanizeSkill
- human-viewSkill
- improve-promptSkill
- memory-auditSkill
- new-agentSkill
- new-agents-mdSkill
- new-hookSkill
- new-mcpSkill
- orchestrateSkill
- pr-authorSkill
- prepSkill
- pre-pushSkill
- pr-triageSkill
- recapSkill
- retrospect-coreSkill
- reviewSkill
- rulesSkill
- shortcutsSkill
- specSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- update-changelogSkill
- using-git-worktreesSkill
- visualise-codemapSkill
- visualSkill
- work-stateSkill
- wrapSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Run the script from this skill's folder, never relative to CWD or a hardcoded path.
- Very specific: line 28
If the skill folder can't be found, the script also lives at the canonical contexture/skills/update-codemap/codemap.mjs.
- Distinctive: line 59
After a run, pass on the script's diff summary (files added and removed, purpose and export changes, or the initial-scan line) and say if a …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
update-codemap
Generates an LLM-facing architecture document for the current project: a prose Overview, per-module roles (Role / Purpose / Entry / Public surface / Depends on / Imported by / Internals), evidence-based detected conventions, hub files ranked by importer count, and structured file-level + class-level graphs that downstream tools (notably visualise-codemap) consume to render diagrams and UML. Full-rewrite each run. Per-project, lives in the project's own git repo at .claude/codemap.md. The audience is LLMs and agents (consumed by /prep, /discover, and any agent that needs architectural context) — prose-heavy at the top, structured sections below.
How to run (for Claude Code)
This skill is implemented as a standalone Node script — codemap.mjs, co-located in this skill folder. The procedure below is the contract the script implements; treat it as the spec.
Run the script from this skill's folder, never relative to CWD or a hardcoded path. Claude Code fills in ${CLAUDE_SKILL_DIR} below. In another tool it stays literal: use the folder this SKILL.md is in instead.
# device-agnostic: resolve the skill's real dir (collapses the ~/.claude symlink), run the co-located script
SKILL_DIR="${CLAUDE_SKILL_DIR}"
node "$SKILL_DIR/codemap.mjs" # writes .claude/codemap.md
node "$SKILL_DIR/codemap.mjs" --dry-run # preview to stdout, no write
node "$SKILL_DIR/codemap.mjs" --root <dir> # explicit project root
node "$SKILL_DIR/codemap.mjs" --map-tokens N # cap doc size ~N tokens (trims index sections only)
node "$SKILL_DIR/codemap.mjs" --no-cache # ignore the per-file cache, full re-parseRegeneration is incremental: a per-file extraction cache at .claude/codemap.cache.json (gitignored, beside codemap.md) is validated by each file's size + mtime, so an unchanged file skips its read + parse (the tree-sitter pass is the expensive part). A changed/added/removed file re-extracts. --no-cache forces a cold rebuild; a bumped cache version or a corrupt cache file degrades safely to cold. The cache can only make a run slower on a miss, never produce a wrong map.
If the skill folder can't be found, the script also lives at the canonical contexture/skills/update-codemap/codemap.mjs; run it with an explicit --root . against the target project.
Multi-language extraction (tree-sitter)
Class graph, exports, and import edges for Python, Java, Kotlin, Swift, Rust, Go, and C++ come from tree-sitter (AST), via the optional deps in this skill's package.json. One-time install, from the skill folder:
npm install --prefix "$SKILL_DIR" # fetches web-tree-sitter + tree-sitter-wasms (~30 MB, gitignored)Without the deps the script degrades gracefully: TS/C#/C++ still extract via regex; the other languages index as files with no class graph or edges (a log line points here). TypeScript and C# always use the regex extractors (mature, no AST needed). Coverage is verified end-to-end by test/language-sweep.mjs — run it after any extractor change; it must pass with zero failures (currently 96/96 across 12 languages; Swift's file-edge is n/a — Swift has no file-level import syntax). The web-tree-sitter pin is ~0.25 deliberately: 0.26+ dropped the grammar ABI that tree-sitter-wasms@0.1.13 ships, and 0.24− is CommonJS-only.
The script honors $CLAUDE_PROJECT_DIR, reads .claude/codemap.config.md (skip patterns, layers, auto-update toggle), clears .claude/codemap.dirty after a successful write, and prints the diff summary on stdout. Surface the diff summary to the user; do not paraphrase. If the script fails, the error message tells you which spec step it choked on — fix the input or extend the script.
When to run
- User types
/update-codemap. - User asks to refresh / create / update the codemap.
- Do not auto-fire. The
codemap-refreshhook keeps it fresh: when the codemap is behind, it regenerates it in the background. That is on by default when git doesn't track the codemap; a tracked one needs- refresh: true(see## Auto-updatebelow). Where it can't refresh, it says at session start when the codemap is 5+ files behind. - Codemap is a map, not the territory. This skill does not replace reading the actual code when implementation details matter.
Inputs
- Project root.
$CLAUDE_PROJECT_DIRif set, otherwise the current working directory. Resolve to an absolute path; write.claude/codemap.mdrelative to that. - Previous codemap, if present at
<root>/.claude/codemap.md. Used for the diff summary at the end. Never used as input to what to scan — always scan from the filesystem. - Dirty sentinel, if present at
<root>/.claude/codemap.dirty. Indicates the codemap-dirty hook flagged the codemap stale since the last run. Acknowledge in the report and delete the sentinel after a successful write.
Procedure
codemap.mjs implements the procedure; you run it, you don't re-implement it. The full spec (file list and skip rules, per-language extraction, the output layout, atomic write, the diff summary) is in spec.md. Read it when a run's output looks wrong or when changing the script.
After a run, pass on the script's diff summary (files added and removed, purpose and export changes, or the initial-scan line) and say if a config file was applied.
Per-project config file format
.claude/codemap.config.md is optional. When present, it extends the skip list, declares architectural layers, marks vendored folders, and toggles the auto-update dirty hook.
Full example:
# Codemap config
## Skip
- `Library/`
- `Builds/`
- `Assets/Plugins/ThirdParty/`
- `*.gen.cs`
- `**/snapshots/`
## Vendored
- `include/openxr/`
- `third_party/**`
## Layers
- Domain: domain, model
- Application: app, services, use-cases
- Infrastructure: persistence, http, adapters
- Presentation: ui, web, mobile
## Auto-update
- enabled: true
- refresh: trueSection reference:
## Skip— additive to defaults. Bullet list of backtick-quoted gitignore-style globs. See §2 parsing rules.## Vendored— bullet list of backtick-quoted gitignore-style globs. Files under these patterns are scanned for tree structure but get<vendored>as their purpose line and noexports:entry. Imports out of vendored files are not emitted into## Dependencies/## File deps. Use this for in-tree third-party SDKs (e.g. bundled OpenXR headers) that you want represented in the tree but not as part of the project's surface area. Imports into vendored files (e.g. project code that#includes a bundled header) still produce edges — vendored is about ownership of the file, not visibility.## Layers—<LayerName>: <module>, <module>, ...per bullet. Module names match top-level directories. Surfaces in the codemap's## Layerssection and is consumed byvisualise-codemapto cluster L1 nodes.## Auto-update—enabled: true(or- enabled: true) opts the project into the codemap-dirty hook. The hook touches.claude/codemap.dirtyon any project-tree write so the next/update-codemaprun knows the codemap is stale. Anything other thanenabled: true(missing line,enabled: false, missing section) keeps the project opt-out — no sentinel is ever written. The hook is registered globally; this section is the per-project gate.refreshcontrols background regeneration by thecodemap-refreshhook at session start and after each turn, whenever git shows files changed since the codemap was written. Unset, it is on when git doesn't track.claude/codemap.mdand off when it does, so a committed codemap doesn't churn;refresh: trueorrefresh: falseoverrides. It is incremental (extraction cache) and needs this skill's tree-sitter deps (npm installhere); without them the hook only advises, so a refresh never downgrades to the regex fallback.
Glob semantics (Skip and Vendored):
*matches a single path segment.**crosses segments.- A trailing
/makes the pattern directory-anchored —Library/matches theLibrarydirectory itself and everything under it. - Patterns match relative to the project root. A pattern without a leading
**/or/still matches at any depth (gitignore-compatible).
Notes:
- Headings are exact, case-sensitive.
- Prose around sections is fine — only the documented bullet lines are read.
- File absent or empty: skill behaves exactly as it does without the file. No section is mandatory.
- Unknown sections are ignored. Reserved for future use.
More in reference.md: What update-codemap does NOT do, limits (v1).
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.

