agentleFS
healthier-vitaminshealthier-vitamins/agentic-grimoire/skills/codemap/SKILL.md

codemap

Skill2 starsChanged 27 days agoMITView on GitHub

Map a whole codebase as areas and sections, with statecharts where the code keeps state, and a copyable /codewalk prompt per section.

18 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use clonedeps and simplify.

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.
  • mike22890Skill

    clonedeps

    将项目依赖的第三方库源码克隆到本地,便于深入阅读和调试。当需要查看库的实现细节、阅读源码、调试第三方依赖、理解 SDK/framework 内部机制、查看 node_modules 之外的原始代码、分析开源库架构、学习他人代码、查看依赖的 TypeScript 类型定义时使用。

    Also in 4 projects that use this

  • Hugging FaceSkill

    simplify

    Refactor code after tests pass. The "Refactor" phase of Red-Green-Refactor.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the project's own map first (README, docs, module docstrings), then the code: from each entry point (CLI commands, servers, exported …

    line 39
  2. Distinctive:

    Done when: every source file outside tests is in exactly one section or set aside with a reason, and each statechart candidate is kept with …

    line 47
  3. Very specific:

    Write .codemap/map.json in the shape of map-format.md: jobs, files, entry points by symbol, and for each kept statechart its states_from …

    line 61
  4. Distinctive:

    Done when: every section has a job, files and at least one entry point, and every transition the code makes for a kept statechart is listed.

    line 65
  5. Distinctive:

    Done when: all three are in the reply.

    line 89

“Common” is measured: kept by at least 6 in 10 of the 17 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

The user is new to a codebase and wants the overview first: a mindmap of its areas and sections, each section with its job, entry points, key files and size, and a statechart where the code has a real state machine. Each section's button copies a /codewalk prompt, so the user deep-dives one section at a time, only the ones they pick. The map stays cheap: it never runs a codewalk itself.

Iron rule: write only to <project>/.codemap/. The scripts add .codemap/ to .git/info/exclude on first use.

<skill> below is this skill's directory. Languages: Python, JavaScript, TypeScript.

Vocabulary

  • Area: a top-level branch of the map, a group of sections (Checkout, Payments).
  • Section: one unit a single codewalk can cover: a job, entry points, files. Its slug is the codewalk's folder name.
  • Facts: what scan.py computes: files, line counts, symbols with lines, imports, state lists. Never write a fact by hand.
  • Citation: a path:line or path::Symbol in the map, checked by the build.

Step 1: Scan

uv run <skill>/scripts/scan.py --root <project>

Done when: .codemap/facts.json exists and the line it prints names the file and line totals.

Step 2: Read and group

Read the project's own map first (README, docs, module docstrings), then the code: from each entry point (CLI commands, servers, exported functions), follow calls to see which files work together. Group the files into sections of one job each, and the sections into areas. Use the project's own terms for names. Read facts.json states for state machines: a state list counts only when the code moves a record between its values (an UPDATE ... SET status, an assignment, a setter). A list that is only read, or a value set nothing writes, gets no statechart.

Done when: every source file outside tests is in exactly one section or set aside with a reason, and each statechart candidate is kept with its transitions found or dropped with a reason.

Step 3: Confirm the grouping

Show the user, per area: each section's slug, one-line job, files, and any statechart's states. Name the files set aside. Ask them to confirm, or to rename, merge, split, move or drop. Redo Step 2 on their edits and show it again.

Done when: the user has confirmed the grouping as shown.

Step 4: Write the map

Write .codemap/map.json in the shape of map-format.md: jobs, files, entry points by symbol, and for each kept statechart its states_from and every transition with the path:line where it happens.

Done when: every section has a job, files and at least one entry point, and every transition the code makes for a kept statechart is listed.

Step 5: Build

uv run <skill>/scripts/build.py --root <project>

The build rescans, checks every citation, and writes .codemap/map.html. A section whose .codewalk/<slug>/page.html exists gets a "walked" badge and a link to it. On exit 1, fix each line it printed and build again.

Done when: the build exits 0.

Step 6: Hand over

Publish .codemap/map.html as an artifact, then tell the user, in chat:

  • the link;
  • the files no section holds (the build prints them);
  • that each section's button copies its /codewalk prompt, and "Copy map as text" copies the whole overview for a chat.

Done when: all three are in the reply.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.