parallel-agent-contracts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseParallel Agent Type Contracts
并行Agent类型合约
When launching parallel agents for code implementation, prevent type duplication.
当启动并行Agent进行代码实现时,避免类型重复。
Required in Every Agent Prompt
每个Agent提示词中必须包含的内容
1. Verification Command (MANDATORY)
1. 验证命令(必填)
markdown
undefinedmarkdown
undefinedBefore Marking Complete
标记完成前
Run verification:
```bash
npx tsc --noEmit 2>&1 | head -20
```
If ANY type errors exist, fix them before completing.
undefined运行验证:
```bash
npx tsc --noEmit 2>&1 | head -20
```
如果存在任何类型错误,请在完成前修复。
undefined2. Grep-Before-Create
2. 创建前先搜索(Grep-Before-Create)
markdown
undefinedmarkdown
undefinedBefore Creating Any Type/Interface
创建任何类型/接口之前
First check if it exists:
```bash
grep -r "interface YourTypeName|type YourTypeName" src/
```
If found, import it. NEVER duplicate existing types.
undefined首先检查它是否已存在:
```bash
grep -r "interface YourTypeName|type YourTypeName" src/
```
如果找到,请导入它。绝对不要重复已有的类型。
undefined3. Canonical Type Map
3. 标准类型映射
Include relevant entries from this map in agent prompts:
| Type | Owner File | Import From |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
在Agent提示词中包含此映射的相关条目:
| 类型 | 所属文件 | 导入路径 |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
Prompt Template
提示词模板
When spawning implementation agents:
markdown
undefined当生成实现Agent时:
markdown
undefinedTask: [Description]
任务:[描述]
Type Ownership (DO NOT recreate)
类型归属(请勿重新创建)
- [List relevant types from canonical map]
- [从标准类型映射中列出相关类型]
Before Creating New Types
创建新类型之前
Run: - if exists, import it.
grep -r "interface TypeName" src/运行: - 如果存在,请导入它。
grep -r "interface TypeName" src/Before Marking Complete
标记完成前
Run:
Fix all type errors before completing.
npx tsc --noEmit 2>&1 | head -20运行:
完成前修复所有类型错误。
npx tsc --noEmit 2>&1 | head -20Your Implementation
你的实现
[Actual task description]
undefined[实际任务描述]
undefinedWhy This Works
为什么这能奏效
- Type checker is the contract - tsc catches conflicts automatically
- Grep is fast - 1 second to check if type exists
- Explicit ownership - No ambiguity about where types live
- Fail fast - Agent can't claim "done" with broken types
- 类型检查器即合约 - tsc会自动捕获冲突
- Grep速度快 - 检查类型是否存在仅需1秒
- 明确的归属 - 类型的存放位置没有歧义
- 快速失败 - Agent不能在类型有问题时声称“已完成”