Agent skill

Codebase Index

by KonghaYao in KonghaYao/peri

代码库速查索引库 —— docs/code-index/ 下每个 crate 一个速查表文件,把「我想做什么」映射到具体文件、入口函数与一句话关键逻辑。当用户想定位或修改某个行为("怎么改 compact 的触发阈值"、"keepgoing 判定在哪"、"加个 deferred…

Apache-2.0Auto-check passedAgent Workflows

Install Codebase Index

skills CLI
$ npx skills add KonghaYao/peri --skill codebase-index -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install KonghaYao/peri codebase-index --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/KonghaYao/peri.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/codebase-index .claude/skills/codebase-index && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
codebase-index
GitHub stars
223
Token cost
~661 tokens
SKILL.md length
140 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
Apache-2.0

At a glance

代码库速查索引库 —— docs/code-index/ 下每个 crate 一个速查表文件,把「我想做什么」映射到具体文件、入口函数与一句话关键逻辑。当用户想定位或修改某个行为("怎么改 compact 的触发阈值"、"keepgoing 判定在哪"、"加个 deferred…

  • Works in 5 steps: 判断行为落在哪个 crate;不确定就 Glob… → 在速查表里按行为关键词匹配条目(compact / keepgoing /… → 打开主文件,跳转到入口函数 → …
  • Tasks that involve Codebase knowledge for agents
  • SKILL.md covers 索引是什么, 查找流程(查询者视角,最常用), 构建/更新流程(构建者视角) and 索引文件格式(当前 canonical,经两轮检索实验验证), plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Codebase Index is an agent skill from KonghaYao/peri. 代码库速查索引库 —— docs/code-index/ 下每个 crate 一个速查表文件,把「我想做什么」映射到具体文件、入口函数与一句话关键逻辑。当用户想定位或修改某个行为("怎么改 compact 的触发阈值"、"keepgoing 判定在哪"、"加个 deferred 工具改哪里"、"事件链路怎么走")、想快速了解某个模块的结构、或要求重建/更新代码索引时使用。用户没提"索引"二字但任务是找代码位置、改某个逻辑、理清调用链时,也应先查索引,而不是直接全库搜索。

Its SKILL.md is about 660 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Codebase knowledge for agents. The repository describes itself as: Lightweight Rust Agent only use 50MB RAM, but Claude Code Plugin compatible, Dynamic Workflow, Goal, Artifacts, Free Web Search, full feature and better support! The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Codebase knowledge for agents

Example prompts

  • “怎么改 compact 的触发阈值”
  • “keepgoing 判定在哪”
  • “加个 deferred 工具改哪里”
  • “/codebase-index”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. 判断行为落在哪个 crate;不确定就 Glob docs/code-index/*.md 并全部读入
  2. 在速查表里按行为关键词匹配条目(compact / keepgoing / is_direct / cancel / middleware / prompt …)
  3. 打开主文件,跳转到入口函数
  4. 索引里的一句话关键逻辑只用于导航;行为细节一律以代码为准
  5. 跨模块链路看各索引的「跨模块契约」节或 cross-crate.md,那里指向 docs/standards/architecture-contracts.md 的 ARC 编号(不复制正文)

What it can do on your machine

Read from SKILL.md and the folder at commit d7ee444. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Codebase Index loads about 661 tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 140 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~661

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from KonghaYao/peri at commit d7ee444, republished under its Apache-2.0 licence (© KonghaYao). 140 words, ~661 tokens.

Download SKILL.mdSave it as .claude/skills/codebase-index/SKILL.md (or your agent's skills folder).
name
codebase-index
description
代码库速查索引库 —— docs/code-index/ 下每个 crate 一个速查表文件,把「我想做什么」映射到具体文件、入口函数与一句话关键逻辑。当用户想定位或修改某个行为("怎么改 compact 的触发阈值"、"keepgoing 判定在哪"、"加个 deferred 工具改哪里"、"事件链路怎么走")、想快速了解某个模块的结构、或要求重建/更新代码索引时使用。用户没提"索引"二字但任务是找代码位置、改某个逻辑、理清调用链时,也应先查索引,而不是直接全库搜索。

Codebase Index

索引是什么

  • 位置:docs/code-index/<crate>.md,跨模块链路在 docs/code-index/cross-crate.md
  • 本质:行为 → 文件 的速查表。查询者带着「我想改 X 的 Y」进来,带着文件路径和入口函数出去
  • 原则:只给定位信息 + 一句话关键逻辑;不解释原理、不复制规范正文、不替代设计文档
  • 体积:每个文件 100–200 行,全部读入没有负担。索引存在的意义就是让"找文件"这一步从几十次搜索变成一次读表

查找流程(查询者视角,最常用)

  1. 判断行为落在哪个 crate;不确定就 Glob docs/code-index/*.md 并全部读入
  2. 在速查表里按行为关键词匹配条目(compact / keepgoing / is_direct / cancel / middleware / prompt …)
  3. 打开主文件,跳转到入口函数
  4. 索引里的一句话关键逻辑只用于导航;行为细节一律以代码为准
  5. 跨模块链路看各索引的「跨模块契约」节或 cross-crate.md,那里指向 docs/standards/architecture-contracts.md 的 ARC 编号(不复制正文)

构建/更新流程(构建者视角)

触发时机:索引缺失、行为变更后索引过期、用户要求重建/扩充。

输入:目标 crate 源码 + 该 crate 的 CLAUDE.md + docs/standards/architecture-contracts.md(跨模块契约)+ 相关 docs/design/ 文档 + spec/issues/ 中最近的相关 issue。

步骤:

  1. 读 crate 的 CLAUDE.md,Scope / 数据流 / 稳定不变量直接进「架构速览」
  2. 用 Grep 验证每个文件路径、函数名、常量真实存在(记行号);禁止凭记忆写路径
  3. 逐子系统列条目;每条覆盖:功能 | 文件 | 入口/关键函数 | 一句话关键逻辑
  4. 关键逻辑写行为契约(阈值、顺序、条件、边界),一句话讲清,不复制文档正文
  5. 标注事实源关系:re-export / 配置事实源 / 注册面要写清归属(例:compact_v2/config.rs 仅 re-export peri-acp-types::compact::CompactConfig,注册面是 middleware collect_tools() 而非工具模块本体)
  6. doc comment 与代码不一致时以代码为准(本仓库出现过 mod.rs 顶部 doc 描述的触发语义与实际判断条件不符),并在索引里写实际行为
  7. 跨 crate 链路(事件、cancel、工具可见性、prompt frozen 等)进「跨模块契约」节,指向 ARC 编号;涉及多个 crate 的链路同时在相关 crate 的索引里互相可见
  8. TUI / UI 类 crate 额外列「关键控件/组件」表(kit 组件、widget 等)
  9. 自检:每条路径存在、函数名存在、行为描述与代码一致

索引文件格式(当前 canonical,经两轮检索实验验证)

markdown
# <crate> 代码索引

> 速查表:把「我想做什么」映射到文件。细节以代码为准。更新:YYYY-MM-DD
> 依据:<crate>/CLAUDE.md、docs/standards/architecture-contracts.md、源码

## 架构速览
- 数据流 / 循环入口 / 稳定不变量(来自 crate CLAUDE.md)

## 速查表
| 我想做什么 | 主文件 | 入口/关键函数 | 关键逻辑 |
| --- | --- | --- | --- |
| (行为/修改意图,如"改 compact 触发阈值") | (路径;事实源/re-export 关系标清) | (真实函数名 + 行号) | (一句话行为契约:阈值/顺序/条件) |

## 子系统
### <子系统名>
| 功能 | 文件 | 入口/关键点 |
| --- | --- | --- |

## 跨模块契约
- ARC-XXX-001:一句话要点 → `docs/standards/architecture-contracts.md`

实验结论(为什么是这个结构):

  • 「我想做什么」列直接匹配查询意图,subagent 检索时零推理成本命中(variant-b 模块卡片也准确但需自行提取,效率等价、推理略多)
  • 每行带真实入口函数名 + 行号,检索者打开文件即可跳转,不必再全库搜函数
  • 一句话行为契约(阈值/顺序/条件)让检索者先判断"这是不是我改的点",再读代码
  • 「跨模块契约」节 + ARC 编号指针足以支撑跨 crate 查询(事件链路等),无需复制契约正文
  • 索引错误会被"以代码为准"验证兜住,但构建时写对(标注 re-export/事实源关系、doc 与代码冲突时信代码)能避免误导

质量红线

  • 路径、函数名必须真实存在(构建时逐一验证),行号要准确
  • 行为描述与代码一致;与文档冲突时以代码为准,并在条目里标注
  • 不复制规范正文、不写设计理由;跨模块内容只指向 ARC 编号
  • 索引过期比没有索引更危险:行为变更后(阈值、顺序、入口改名)必须同步更新对应条目

© KonghaYao, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/codebase-index of KonghaYao/peri.

Open the folder on GitHubat commit d7ee444

Compare with similar skills

Codebase Index next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Codebase Index compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Codebase Index this skillKonghaYao/peri223—~661Automated safety check: PassApache-2.0
ccc Semantic Code Searchcocoindex-io/cocoindex-code2.7k—~938Automated safety check: PassApache-2.0
Context Engineeringabashev/vfs-s31069 repos~2.6kAutomated safety check: NotesApache-2.0
Repomix Codebase Packeryamadashy/repomix29k—~1.3kAutomated safety check: NotesMIT
Codebase Handbook BuilderRuhan-Wang/Harness_Handbook331—~2.2kAutomated safety check: PassApache-2.0
CodemapJordanCoin/codemap704—~1.8kAutomated safety check: PassMIT

Similar skills

  • ccc Semantic Code Search

    cocoindex-io/cocoindex-code

    Semantic code search and index management with the ccc CLI: the agent initializes, indexes and queries the project by concept, filtering by language or path.

    2.7k GitHub stars~938 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Context Engineering

    abashev/vfs-s3

    Optimizes agent context setup. An agent skill from abashev/vfs-s3.

    106 GitHub starsUsed in 9 repos~2.6k tokens
    Agent WorkflowsAuto-check: notes
  • Repomix Codebase Packer

    yamadashy/repomix

    Packs a local directory or remote GitHub repository into one AI-friendly file with Repomix, then searches it to explore structure, find patterns and count tokens.

    29k GitHub stars~1.3k tokensUpdated 4 days ago
    Agent WorkflowsAuto-check: notes
  • Codebase Handbook Builder

    Ruhan-Wang/Harness_Handbook

    Generates, refreshes, validates and uses a compact handbook that maps where a change touches in a repository, using the active Codex session and no external LLM API.

    331 GitHub stars~2.2k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Codemap

    JordanCoin/codemap

    Gives an agent a quick map of a codebase's structure, dependencies, changes and handoffs, and tunes per-project config so the output stays code-first.

    704 GitHub stars~1.8k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Repomix Context Skill

    sopaco/deepwiki-rs

    A skill your agent uses when an agent needs source code from the local repomix index under .terrain/agent/repomix.md (not committed; regenerate via Terrain scan).

    3.1k GitHub stars~671 tokensUpdated 23 days ago
    Agent WorkflowsAuto-check passed

More from KonghaYao/peri

All 19 skills in this repo
  • Queries Langfuse traces, prompts, datasets and sessions, and analyzes local LLM gateway logs for requests, context growth, token use and cache hits.

    223 GitHub stars~4.3k tokensUpdated today
    Auto-check: notes
  • Audits recent agent conversation history and turns repeated failures and successes into testable harness improvement proposals that later audits can check.

    223 GitHub stars~3.5k tokensUpdated today
    Auto-check passed
  • Runs commands, reads and edits files, and copies data on remote machines through a single-file Node script that wraps the system ssh and scp, in Chinese.

    223 GitHub stars~924 tokensUpdated today
    Auto-check: warnings
  • Advisor Consultation

    KonghaYao/peri

    Sends a compact, redacted decision packet to a tool-free Opus advisor subagent when a task has high-risk trade-offs or stalled investigations, then weighs the answer.

    223 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Scheduled Tasks Cron

    KonghaYao/peri

    Registers, lists and removes recurring agent tasks with five-field cron expressions, and sets safety rules so a schedule is created only when the user clearly asks.

    223 GitHub stars~683 tokensUpdated today
    Auto-check passed
  • Verifies and repairs a feature by using the real Peri terminal UI as a user would, looping verify, decide, fix and review until a fresh round shows no blockers.

    223 GitHub stars~2.1k tokensUpdated today
    Auto-check: notes

Categories

Questions about Codebase Index

What does Codebase Index do?

代码库速查索引库 —— docs/code-index/ 下每个 crate 一个速查表文件,把「我想做什么」映射到具体文件、入口函数与一句话关键逻辑。当用户想定位或修改某个行为("怎么改 compact 的触发阈值"、"keepgoing 判定在哪"、"加个 deferred…. Codebase Index is an agent skill from KonghaYao/peri.

When should I use Codebase Index?

Codebase Index fits situations like: tasks that involve Codebase knowledge for agents.

How do I install Codebase Index in Claude Code?

Run `npx skills add KonghaYao/peri --skill codebase-index -a claude-code`. Or copy the skill folder (.claude/skills/codebase-index in KonghaYao/peri) into .claude/skills/codebase-index in your project. Claude Code loads it when a task matches its description.

How do I install Codebase Index in Codex?

Run `npx skills add KonghaYao/peri --skill codebase-index -a codex`. Or copy the skill folder (.claude/skills/codebase-index in KonghaYao/peri) into .agents/skills/codebase-index in your project. Codex loads it when a task matches its description.

Can I use Codebase Index in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add KonghaYao/peri --skill codebase-index -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/codebase-index, .gemini/skills/codebase-index, .github/skills/codebase-index and .opencode/skills/codebase-index in your project.

What does Codebase Index need to run?

SKILL.md names no scripts, command-line tools or credentials: Codebase Index is instructions for the agent only.

Does Codebase Index access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Codebase Index safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Codebase Index use?

Codebase Index is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Codebase Index use?

About 661 tokens (SKILL.md is roughly 2.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Codebase Index?

Skills that share tags, products or a category with Codebase Index: ccc Semantic Code Search (cocoindex-io/cocoindex-code, 2.7k stars), Context Engineering (abashev/vfs-s3, 106 stars), Repomix Codebase Packer (yamadashy/repomix, 29k stars) and Codebase Handbook Builder (Ruhan-Wang/Harness_Handbook, 331 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Codebase Index?

KonghaYao (a GitHub user) maintains it in KonghaYao/peri, which has 223 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 7, 2026.

Source: KonghaYao/peri on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.