anastasiyaw-repo-map

在令牌预算范围内对代码库进行符号提取与排序,提供一份精简的“此仓库中重要的是什么”地图。零依赖(仅标准库),采用受 Aider 启发的正则提取与 PageRank 排序,而非 tree-sitter 解析;用于快速在不熟悉或大型代码库中定位重要符号、函数与结构,但不用于安全审计或评估代码质量。

仓库最近推送
GitHub Stars
218
Forks
33
Issues / PRs
5

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "anastasiyaw-repo-map":https://skillpi.com/zh/skills/deepskill-85db75cf224093088326917a86d0e061b4e7deafd4b848f9544d75662ce852ba。安装前核对上游来源和版本:https://github.com/AnastasiyaW/codex-claude-code-config。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

在令牌预算范围内对代码库进行符号提取与排序,提供一份精简的“此仓库中重要的是什么”地图。零依赖(仅标准库),采用受 Aider 启发的正则提取与 PageRank 排序,而非 tree-sitter 解析;用于快速在不熟悉或大型代码库中定位重要符号、函数与结构,但不用于安全审计或评估代码质量。

0 下载

介绍来源: third_party · AnastasiyaW · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: repo-map
description: Ranked symbol map of a codebase within a token budget — a compact "what matters in this repo" before reading files. Use when starting work in an unfamiliar/large codebase, before a refactor or deep-review fan-out, when you need JIT context instead of dumping whole files, or asked "give me a map of this repo / where are the important functions / what's the structure". Zero-dependency (stdlib only); Aider-inspired regex extraction and PageRank ranking, not a tree-sitter parser. Do NOT use to find correctness/security defects in a change or to audit a diff; use deep-review for that (this only ranks and lists symbols, it does not evaluate code quality).

repo-map

Produces a ranked list of the structurally-important symbol definitions in a codebase, capped to a token budget. The point: instead of dumping whole files (wasteful, blows the context window), get a cheap "skeleton" of the repo — the functions/classes everything else depends on — and read full files only where it matters.

This is our zero-dependency port of Aider's repo-map.

When to use

  • Onboarding to an unfamiliar or large codebase — get the lay of the land first.
  • Before a refactor / deep-review / workflow-orchestration fan-out — feed each subagent the map so it knows the important entry points without re-scanning.
  • JIT context (principle 07 / practice_context_engineering) — load the map, not the files.
  • Anytime the instinct is "let me read 20 files to understand this" → run this first.

Usage

python scripts/repo_map.py [ROOT] [--budget-tokens N] [--top N] [--json] [--no-signature] [--max-files N]
  • ROOT — repo root (default: cwd). If it's a git repo, only tracked files are scanned (honors .gitignore); otherwise a filtered directory walk is used.
  • --budget-tokens (default 1024) — stop emitting once ~this many tokens are used (≈4 chars/token heuristic). Use 256–512 for a quick orientation, 2048+ for depth.
  • --top N — hard cap on symbols before the budget applies.
  • --json — machine-readable output (for piping into a workflow / another agent).
  • --no-signature — emit path:line: name instead of the full signature line.

JSON distinguishes symbols_extracted_total (before --top), symbols_ranked_after_top (after that cap), and symbols_emitted (after the token budget). The legacy symbols_total key retains its post---top meaning for compatibility. None is a semantic coverage guarantee: extraction is regex-based and --max-files can limit input. Never diagnose parser coverage from a capped map.

Typical recipes

# Quick orientation in a new repo
python scripts/repo_map.py . --budget-tokens 512

# Feed a fan-out: JSON map of the most important 40 symbols
python scripts/repo_map.py /path/to/repo --top 40 --json > repo_map.json

# Focus a subdirectory (a single layer/service)
python scripts/repo_map.py /path/to/repo/services/auth --budget-tokens 800

How ranking works

  1. Extract definitions (functions/classes/types) and identifier references per file via per-language regexes (py/js/ts/tsx/go/rust/java/ruby/c/cpp/csharp/php/kotlin/swift).
  2. Build a directed graph: edge F → D when file F references an identifier defined in file D. Rare identifiers (defined in few files) weigh more.
  3. Run PageRank over the file graph → structurally-central files float up (shared utilities, core models, base classes).
  4. Symbol score = pagerank(def_file) × (1 + total_refs) × rarity. Emit highest first until the token budget is hit.

So the map surfaces the code everything else leans on, not just the first files alphabetically.

Gotchas

  • Regex extraction, not tree-sitter. Fidelity is good for ranking but not a parser. Exotic syntax, heavy macros, or unusual formatting can miss/misattribute a def. This is a deliberate trade for zero-install + runs-anywhere. To upgrade fidelity, replace extract() with tree-sitter-language-pack tags — the graph/ PageRank stages stay identical. (Don't install tree-sitter casually: it trips the 7-day supply-chain gate; gate it like any fresh dep.)
  • Token count is a heuristic (chars/4), not a real tokenizer. Treat the budget as approximate; it errs slightly high on code with many short tokens.
  • Same name in many files (e.g. get, handle) ranks each def site separately — expected, since each is a distinct definition. Use --top to trim noise.
  • Non-git dirs fall back to a denylist walk (node_modules, dist, venv, …). If your build output lives somewhere unusual, it may get scanned — point ROOT at the source dir instead.
  • Generated code (protobuf, src/gen/) can dominate ranks because it's referenced everywhere. Point ROOT at hand-written source, or filter after the fact.

Troubleshooting

Symptom Cause Fix
0 files scanned ROOT has no recognized source extensions, or all gitignored Check git ls-files; point ROOT at the source subdir
A key function is missing Regex didn't match its signature style Lower --budget-tokens pressure (raise budget) or accept the limitation; verify by grep
--top 12 appears to find only 12 definitions Post-cap count confused with extraction Inspect symbols_extracted_total; remove caps before investigating actual extraction misses
Map dominated by one vendored file A vendor//generated tree got scanned (non-git mode) Run inside the git repo, or point ROOT at hand-written source
Wrong/old map File moved; map is a point-in-time snapshot Re-run — it's cheap and stateless

Verification

scripts/repo_map.py is stdlib-only and was verified to run on real trees (it correctly ranks shared-utility files to the top via PageRank). Re-run on any repo to confirm; there is no state to corrupt.

版本历史

  1. v2026.10.24 GitHub ↗
    原版更新说明

    Three ideas from this month's agent-harness news, adopted as checks rather than prompts. ## New - **Output legibility** — [`docs/output-legibility.md`](https://github.com/AnastasiyaW/codex-claude-code-config/blob/main/docs/output-legibility.md). Karpathy's readability ladder (STE-style text, diagram, HTML, video), plus the two ASD-STE100 rules that need no licensed dictionary: one concept keeps one term, and sentences stay short. - **`scripts/term_drift_check.py`** — checks agent output against a project glossary. It flags synonyms of your terms (`stem*` covers inflection, so it works in Russian too) and overlong sentences, and skips code, URLs and HTML comments. Exit `0` clean, `1` findings, `2` not checked. It ships with a self-test whose must-fail controls catch six deliberate breaks of the logic. - **Bounded harness-improvement pilot** — [`docs/harness-improvement-pilot.md`](https://github.com/AnastasiyaW/codex-claude-code-config/blob/main/docs/harness-improvement-pilot.md). The method behind Google Research's Harness², without the auto-patcher: a frozen suite with a held-out case, one change per candidate, strict improvement and no safety regression. - **Dead-code sweep** — a new reference in the `refactoring-safely` skill, after OpenAI's GPT-6 maintenance guide. It covers a read-only audit with production evidence and one small draft PR per removal, and keeps killswitches and safeguards out of scope. ## Changed - `rules/quality-code.md`: when you change code, update or delete the comment next to it in the same commit. Research suggests a wrong or stale comment misleads a model more than a missing one. - `CLAUDE.md`: new Harness² and Output Legibility sections. Full changelog: [`UPDATES.md`](https://github.com/AnastasiyaW/codex-claude-code-config/blob/main/UPDATES.md) · PRs #18, #19

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值78/100

亮点

  • 解决开发者在新代码库中快速获取上下文的核心痛点
  • 适用于 onboarding、重构前准备、JIT 上下文加载等多个高频场景
触发精准92/100

亮点

  • 触发场景描述清晰完整,覆盖多种典型使用变体
  • 边界明确,不易与其他 Skill 混淆
结构规范85/100

待提升项

  • 文档过长 原报告严重程度:轻微

    SKILL.md 内容超过 500 行,影响可读性

    改进建议:考虑将部分详细说明(如 Troubleshooting 表格)移至独立文档或通过链接引用

亮点

  • 结构完整,包含使用场景、用法、原理、注意事项等必要章节
  • 提供典型用法示例,便于用户快速上手
执行可靠88/100

亮点

  • 零依赖设计,仅使用标准库,确保环境兼容性
  • 提供详细的 troubleshooting 指南,覆盖常见异常场景
  • 参数说明完整,输出格式明确(支持 JSON)
证据可验 (前四项均值)86/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • aider.chat

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。