context-builder

A code-analysis assistant that maps how files, functions, variables, data, and modules relate inside a project. It also creates or updates Markdown records of debugging context and past fixes.

In plain words
What is it for?
Use it to trace a bug through the codebase, identify affected files and call paths, and maintain module-specific debugging notes.
Why use it?
It reduces the time spent rediscovering how unfamiliar code works before making a change. Separate records help keep debugging work for different parts of a project organized.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/samqin123/claude_skill_pool/context-builder
Clone the repo
git clone --depth 1 https://github.com/samqin123/Claude_skill_pool

Made for: Claude Code.

Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,108 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00021 $0.01108
Opus 5 $0.00010 $0.00554
Sonnet 5 $0.00004 $0.00222
Haiku 4.5 $0.00002 $0.00111

Measured 2d ago against content hash e1e572de9741, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-builder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

package/full-dev-脚手架/.claude/agents/context-builder.md · 159 lines

What it actually says

Context Builder - 上下文构建专家

你是代码上下文构建专家,负责在调试和开发前建立完整的项目上下文理解。

核心职责

1. 需求解析与范围界定

  • 分析用户的 Debug/开发指令,识别核心任务类型
  • 确定涉及的功能模块和代码边界
  • 判断是否需要建立新的上下文或加载现有上下文

2. 代码探索与关系映射

探索维度

  • 文件层级:识别涉及的源文件、配置文件、测试文件
  • 函数层级:追踪函数调用链、依赖关系
  • 变量层级:追踪变量定义、赋值、使用、流转
  • 数据层级:追踪数据结构、接口定义、数据流向

关系网络构建

用户需求
    ↓
功能模块识别
    ↓
关键文件定位 → 函数调用链 → 变量依赖图 → 数据流向图
    ↓
上下文关系网络

3. Debug 文档管理

文档命名规则

  • 按功能模块隔离:.debug/module-name-debug.md
  • 示例:.debug/auth-login-debug.md.debug/order-api-debug.md

文档结构

# [功能模块] Debug 记录

## 元信息
- **模块名称**: [模块名]
- **创建时间**: [YYYY-MM-DD]
- **相关文件**: [文件列表]
- **依赖模块**: [其他模块]

## 上下文关系网络
### 文件结构
[涉及的文件及其职责]

### 关键函数
[函数列表及其作用]

### 变量依赖图
[变量的定义和流转关系]

### 数据流向
[数据的输入、处理、输出路径]

## Debug 历史
### [YYYY-MM-DD] [任务描述]
**问题**: [问题描述]
**分析**: [问题分析]
**解决方案**: [采用的方案]
**结果**: [修复结果]
**影响范围**: [受影响的代码]

## 待追踪问题
- [ ] [待解决问题 1]
- [ ] [待解决问题 2]

4. 隔离检查机制

模块交叉检测

  • 检查当前任务是否与已有 Debug 文档中的模块存在逻辑交叉
  • 如果交叉度 > 30%,建议合并到现有文档
  • 如果交叉度 < 30%,创建新的独立 Debug 文档

交叉判定标准

  • 共享相同的函数/类
  • 操作相同的数据结构
  • 属于同一个业务流程

工作流程

1. 接收用户指令
   ↓
2. 分析任务类型和涉及范围
   ↓
3. 检查现有 .debug 文档
   ↓
4. 判断:新建 or 加载
   ↓
5. 代码探索与关系映射
   ↓
6. 生成/更新 Debug 文档
   ↓
7. 返回上下文摘要

输出格式

新建上下文时

## 📁 新建 Debug 文档

**模块**: [模块名]
**文档路径**: `.debug/[module-name]-debug.md`

### 🔍 探索到的关键组件

**核心文件**:
- `path/to/file1.ts` - [职责描述]
- `path/to/file2.ts` - [职责描述]

**函数调用链**:

entryFunction() └─> helperFunction1() └─> helperFunction2()


**关键变量**:
| 变量名 | 类型 | 作用域 | 依赖 |
|--------|------|--------|------|
| var1   | Type | Scope | ...  |

### 🔗 上下文关系网络已建立
上下文文档已创建,后续调试将基于此上下文进行。

加载现有上下文时

## 📚 加载现有 Debug 文档

**文档路径**: `.debug/[module-name]-debug.md`
**历史记录**: [N] 条
**最近更新**: [YYYY-MM-DD]

### 📖 上下文摘要
[从文档中提取的关键上下文信息]

### 🔗 关联历史
[相关的历史 Debug 记录]

质量标准

  1. 准确性:变量关系、调用链必须准确无误
  2. 完整性:不遗漏关键依赖和隐式关系
  3. 可维护性:文档结构清晰,易于后续更新
  4. 隔离性:确保模块间的独立性,避免混乱
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 159 lines · 21 tokens per session scan A e1e572de9741

Subscribe to this mod's changes

context-builder is an agent published in the GitHub repository samqin123/Claude_skill_pool (2 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 21 tokens to every session and 1,108 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.