repo-map

GitHub

通过生成代码库的紧凑索引(树结构、行数及符号)替代全量文件阅读,以极低token成本快速定位目标。遵循‘先地图后打开’纪律,仅读取匹配任务的文件,大幅提升探索效率并节省上下文窗口。

exports/openclaw/repo-map/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

高效探索代码库 停止重复阅读整个项目 创建项目地图 确定应打开哪些文件

Install

npx skills add mohitagw15856/pm-claude-skills --skill repo-map -g -y
More Options

Non-standard path

npx skills add https://github.com/mohitagw15856/pm-claude-skills/tree/main/exports/openclaw/repo-map -g -y

Use without installing

npx skills use mohitagw15856/pm-claude-skills@repo-map

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill repo-map -a claude-code -g -y

安装 repo 全部 skill

npx skills add mohitagw15856/pm-claude-skills --all -g -y

预览 repo 内 skill

npx skills add mohitagw15856/pm-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "repo-map",
    "homepage": "https:\/\/mohitagw15856.github.io\/pm-claude-skills\/skill\/repo-map.html",
    "metadata": {
        "openclaw": {
            "emoji": "🧠"
        }
    },
    "description": "Navigate a codebase by map instead of reading files wholesale — a deterministic stdlib script that emits the tree with line counts and top-level symbols, plus the read-the-map-first discipline that cuts exploration tokens by an order of magnitude. Use when asked explore this repo efficiently, stop re-reading the whole codebase, make a map of this project, or which files should the agent actually open. Produces the compact map with its token math (map vs. everything), the navigation discipline, and the open-only-what-matches rule."
}

Repo Map Skill

Agents burn their context windows on exploration: reading ten files to find the one, re-reading them next session, paying full price for code that was only ever navigation. The fix is the oldest one in computing — an index. This skill generates a compact, deterministic map (tree + line counts + top-level symbols via regex, no parser dependencies, nothing leaves the machine) and installs the discipline that makes it pay: read the map first, open only the files whose names and symbols match the task. The script prints its own economics: a typical map costs ~3% of reading everything.

What This Skill Produces

  • The map — tree with per-file line counts and top-level symbols (functions, classes, types) for ~10 common languages
  • The token math — reading-everything vs. reading-the-map, printed in the header
  • The navigation plan — for the task at hand: which files the map says to open, which to skip
  • The refresh rule — when the map is stale and what it costs to regenerate (nothing — it's local and instant)

Required Inputs

Ask for these if not provided:

  • The directory — repo root or the subdirectory that matters (mapping src/ beats mapping node_modules' ancestors)
  • The task — the map is generic; the navigation plan needs to know what's being hunted (a bug in auth? the payment flow? where X is defined?)
  • Scale expectations — huge monorepos get mapped per-subdirectory (--max-files guards the map's own size; a 40,000-file map defeats itself)

Programmatic Helper

python3 scripts/repo_map.py .
python3 scripts/repo_map.py src --max-files 400 --max-symbols 8

Deterministic (sorted walk), stdlib-only, local. Skips .git, node_modules, build dirs. Symbols via per-language regex — deliberately humble: top-level names, not a full graph; the point is navigation, not analysis. Header prints files, lines, and the map-vs-everything token comparison.

Framework: The Navigation Discipline

  1. Map before open, every exploration: the first act in an unfamiliar repo is the map, not a file read — one ~3%-cost artifact answers "what's here, what's it called, where would X live" for the whole session.
  2. Open by match, not by curiosity: files get opened when their name or symbols match the task ("refund appears in billing/refunds.py → process_refund, RefundPolicy") — the map converts "read around and see" into a shortlist, and the shortlist is the saving.
  3. The map is cache-friendly context: stable, deterministic output means the map can sit at the top of a session and stay byte-identical across turns — unlike raw file reads, it never invalidates a provider prefix cache by reordering.
  4. Depth on demand: map → open the shortlisted file → if still lost, map the subdirectory deeper. Escalation is cheap because every level is local and instant; what's expensive is skipping the levels and reading wholesale.
  5. Honest limits: regex symbols miss dynamic definitions, decorators' effects, and call graphs — for "who calls this," the map shortlists candidates and grep finishes the job. The map is the index, not the analysis; tools that build true graphs exist for the deep version (see Based On).

Output Format

Repo Map: [path] — [N] files, map ≈ [X]% of reading everything

[The script's map output]

Navigation Plan (for: [the task])

Open: [the shortlist, with the matching symbol/name per file] Skip: [the big directories the task doesn't touch] If not found: [the grep to run next, on the shortlist first]

Quality Checks

  • The map was generated before any wholesale file reading
  • The token comparison (map vs. everything) appears
  • The navigation plan shortlists by name/symbol match with reasons
  • Monorepos were mapped per-subdirectory, not defeated by their own size
  • The regex-symbols limitation is stated when the task is call-graph-shaped

Anti-Patterns

  • Do not read files to find out what's in them — that's the map's job at 3% of the price
  • Do not regenerate the map every turn — it's stable; put it once at the session's top
  • Do not oversell the symbols — top-level names, not semantics; grep and real parsers pick up where regex stops
  • Do not map the world — --max-files and subdirectory scoping exist because a bloated map is just a slower file dump
  • Do not skip the navigation plan — a map without a shortlist saved nothing yet

Based On

The codebase-as-index pattern — local knowledge graphs for agent navigation (as in Graphify, which does the full tree-sitter graph version) — distilled here into a zero-dependency, deterministic map with the read-the-map-first discipline.

Version History

  • 471c606 Current 2026-07-22 13:39

Same Skill Collection

exports/openclaw/360-feedback-template/SKILL.md
exports/openclaw/401k-plan-decoder/SKILL.md
exports/openclaw/ab-test-planner/SKILL.md
exports/openclaw/ab-test-readout/SKILL.md
exports/openclaw/accessibility-audit/SKILL.md
exports/openclaw/account-plan/SKILL.md
exports/openclaw/acquirer-red-team/SKILL.md
exports/openclaw/ad-copy/SKILL.md
exports/openclaw/aeo-optimizer/SKILL.md
exports/openclaw/agenda-or-cancel/SKILL.md
exports/openclaw/agent-design-review/SKILL.md
exports/openclaw/agent-hiring-panel/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-severance/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/agm-in-a-box/SKILL.md
exports/openclaw/ai-ethics-review/SKILL.md
exports/openclaw/ai-eval-plan/SKILL.md
exports/openclaw/ai-feature-prd/SKILL.md
exports/openclaw/ai-product-canvas/SKILL.md
exports/openclaw/air-quality/SKILL.md
exports/openclaw/altitude-shifter/SKILL.md
exports/openclaw/ambiguity-resolver/SKILL.md
exports/openclaw/analyst-relations-brief/SKILL.md
exports/openclaw/announcement-card/SKILL.md
exports/openclaw/api-docs-writer/SKILL.md
exports/openclaw/api-test-plan/SKILL.md
exports/openclaw/api-versioning-strategy/SKILL.md
exports/openclaw/apology-letter/SKILL.md
exports/openclaw/architecture-decision-record/SKILL.md
exports/openclaw/architecture-diagram/SKILL.md
exports/openclaw/archive-strategy/SKILL.md
exports/openclaw/assumption-bounty/SKILL.md
exports/openclaw/assumption-mapper/SKILL.md
exports/openclaw/async-update-format/SKILL.md
exports/openclaw/auto-repair-estimate-decoder/SKILL.md
exports/openclaw/autopilot-charter/SKILL.md
exports/openclaw/behavior-intervention-plan/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bennett-time-audit/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-game-designer/SKILL.md
exports/openclaw/board-minutes/SKILL.md
exports/openclaw/board-pre-read/SKILL.md
exports/openclaw/bom-cost-review/SKILL.md
exports/openclaw/bookkeeping-categorization/SKILL.md
exports/openclaw/boolean-search-builder/SKILL.md
exports/openclaw/brag-doc/SKILL.md
exports/openclaw/brainstorming/SKILL.md

Metadata

Files
0
Version
e4def4c
Hash
c9bff8f2
Indexed
2026-07-22 13:39

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-31 02:15
浙ICP备14020137号-1 $방문자$