首页
/ Language and Framework Quick Reference

Language and Framework Quick Reference

2026-09-06 18:18:18作者:温艾琴Wonderful

Language and Framework Quick Reference

Use these hints to improve tag and edge accuracy. These supplement your training knowledge.

Signal Tag(s) Note
File in hooks/, exports function starting with use hook, service React custom hook
File in contexts/, exports a Provider service, state React context
File in pages/ or views/ ui, routing Page-level component
File in store/, slices/, reducers/ state State management
File in services/, api/ service Data-fetching / API client
__init__.py with re-exports entry-point, barrel Python package root
manage.py at project root entry-point Django management entry
File named mod.rs barrel Rust module barrel
File named main.go in cmd/ entry-point Go binary entry

For React: create depends_on edges from components to hooks they call. Create publishes/subscribes edges for Context provider/consumer patterns.


### 编排层面的改动

SKILL.md Phase 2 的 "Build the combined prompt template" 块中删除第 2、3 步:

- **删除** Step 2(语言上下文注入:按检测语言读取 `./languages/<language-id>.md`);
- **删除** Step 3(Framework 附件注入:按检测框架读取 `./frameworks/<framework-id>.md`);
- **保留** Step 1(读取基础模板 `./file-analyzer-prompt.md`)。

Phase 4 的附件注入步骤**保持不变**(只运行一次)。

### Token 节省估算

| | 批次数 | 附件 Token/批 | 合计 |
|---|---|---|---|
| Before(C2 之后) | 20 | ~1,300(TS+React) | ~26,000 |
| After | 20 | ~150(内联速查表) | ~3,000 |
| **节省** | | | **~23,000** |

---

## 六、C4 — 瘦身 Phase 4 与 Phase 5 的载荷

**消除的根因**:Phase 5(tour builder)接收全部节点(file + function + class)与全部边(imports + contains + calls + exports + ...)。对一个 500 文件项目,这可能包含 **1,500+ 节点和 3,000+ 边**——而其中绝大多数数据对 tour 设计并无用处。

### Phase 4(Architecture Analyzer)— 轻度修剪

Phase 4 本就只发送文件类型节点(方向正确),只需显式地从每个节点对象中剥掉 `languageNotes`(对分层判断无用且冗长)和 `name`(恒等于 `filePath` 的 basename,可随时推导)。

- **Before per node**:`{id, name, filePath, summary, tags, complexity, languageNotes?}`
- **After per node**:`{id, filePath, summary, tags}`

节省约 15-20% 的每节点 Token,Phase 4 总计约 3,000-5,000 Token。

### Phase 5(Tour Builder)— 主要修剪

编排器注入 tour-builder 子代理的数据做三项变更:

**1. 仅保留文件节点(剥离 function/class 节点)**
Tour 通过节点 ID 做 wayfinding,实际运行中 tour 步骤永远引用 `file:` 节点——function/class 节点只会出现在 dashboard 的 NodeInfo 侧栏中,tour 本身停留在文件层级导航。
- **Before**:全部节点(file + function + class),500 文件可能 1,500+ 节点;
- **After**:仅 file 类型节点——500 个。

**2. 精简节点格式**
tour-builder 脚本的图计算只用节点 ID、name、type。summary/tags 是 Phase 2(教学叙事撰写)的输入,应当从注入载荷中剥离可选的重字段:
- **Before per node**:`{id, name, filePath, summary, type, tags, complexity, languageNotes?}`
- **After per node**:`{id, name, filePath, summary, type}`(去掉 tags、complexity、languageNotes)

**3. 精简边与层**
Tour 的 BFS 遍历只走 `imports` 与 `calls` 两种边;`contains`、`exports`、`tested_by`、`depends_on` 等对遍历毫无增益,只会撑大载荷。层数据只用于决定叙事弧(先介绍哪一层、再介绍哪一层),不需要完整 `nodeIds` 数组。

- **Before edges**:全部边类型(~3,000+ 条,含到 function/class 节点的全部 `contains` 边);
- **After edges**:仅 `imports` 与 `calls`(典型项目约 400-800 条);
- **Before per layer**:`{id, name, description, nodeIds: [...hundreds of IDs]}`;
- **After per layer**:`{id, name, description}`(去掉 nodeIds)。

### Phase 5 节省估算

| 数据 | Before | After |
|---|---|---|
| 节点数 | ~1,500 × ~180 chars | ~500 × ~120 chars |
| 节点 Token | ~67,500 | ~15,000 |
| 边数 | ~3,000 × ~80 chars | ~600 × ~80 chars |
| 边 Token | ~60,000 | ~12,000 |
| 层 Token | ~5,000 | ~500 |
| **Phase 5 合计** | **~132,500** | **~27,500** |
| **节省** | | **~105,000** |

### SKILL.md 中的对应改动

Phase 4 派发模板的文件节点格式:

File nodes: [list of {id, filePath, summary, tags} for all file-type nodes]


Phase 5 派发模板的三段载荷规格:

Nodes (file nodes only): [list of {id, name, filePath, summary, type} for all file-type nodes only — do NOT include function or class nodes]

Key edges (imports and calls only): [list of edges where type is "imports" or "calls" only]

Layers: [list of {id, name, description} — omit nodeIds]

登录后查看全文
热门项目推荐
相关项目推荐