代理模式
- 作者仓库星标 2,235
- 作者仓库 claude-code-plugins-plus-skills
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @jeremylongshore · 未声明许可证
- 上下文用量评级
- 中等消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- Python
- 检测到的文件与系统行为
-
- 只读
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Agent Patterns
## Overview
Agent Patterns defines the coordination protocol for multi-agent sprint execution within the Sprint plugin. It governs how the project architect spawns implementation and testing agents, how agents communicate results via structured reports, and how parallel agents avoid conflicts.
## Prerequisites
- Sprint plugin installed and configured (`/plugin install sprint`)
- Sprint directory initialized at `.claude/sprint/[N]/`
- `specs.md` written with clear scope and testing configuration
- Familiarity with the sprint phase lifecycle (see the `sprint-workflow` skill)
## Instructions
1. Structure every agent spawn using the SPAWN REQUEST format. Include the agent name, the specification file it should read, and any scope constraints:
```
SPAWN REQUEST
Agent: python-dev
Specs: .claude/sprint/1/backend-specs.md
Contract: .claude/sprint/1/api-contract.md
Scope: Authentication endpoints only
```
2. Ensure each spawned agent receives only the files relevant to its scope. Pass the `api-contract.md` as a shared interface so backend and frontend agents stay synchronized.
3. Collect structured reports from every agent upon completion. Each report must include: work completed, files modified, tests added, and conformity status against the specification.
4. When running agents in parallel, partition work by domain boundary (e.g., backend vs. frontend vs. CI/CD). Never assign overlapping file paths to concurrent agents.
5. Feed agent reports back to the project architect for review. The architect decides whether to iterate (re-spawn with narrowed specs) or advance to the next phase.
6. For testing agents, pass the UI test report format shown in `${CLAUDE_SKILL_DIR}/references/ui-test-report.md` so results follow a consistent schema including test counts, coverage, failures, and console errors.
## Output
- SPAWN REQUEST blocks consumed by the sprint orchestrator to launch agents
- Structured agent reports containing: summary, files changed, test results, and conformity status
- UI test reports with pass/fail counts, coverage details, failure descriptions, and console error logs
- Updated `status.md` reflecting completed and remaining work after each iteration
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| Agent receives wrong specification file | Incorrect path in SPAWN REQUEST | Verify the sprint directory number and file name before spawning |
| Overlapping file modifications from parallel agents | Scope boundaries not clearly defined | Partition work by domain; assign distinct directories to each agent |
| Agent report missing required fields | Agent instructions lack report format | Include the structured report template in the agent prompt |
| Infinite iteration loop | Specs never fully satisfied | Check `status.md` for blocking issues; the orchestrator pauses after 5 iterations |
| Agent not found | Misspelled agent name in SPAWN REQUEST | Verify agent markdown files exist in `agents/` directory |
## Examples
**Spawning parallel implementation agents:**
```
SPAWN REQUEST
Agent: python-dev
Specs: .claude/sprint/1/backend-specs.md
Contract: .claude/sprint/1/api-contract.md
SPAWN REQUEST
Agent: nextjs-dev
Specs: .claude/sprint/1/frontend-specs.md
Contract: .claude/sprint/1/api-contract.md
```
Both agents share the same `api-contract.md` to ensure API compatibility.
**Structured agent report format:**
```
AGENT REPORT
Agent: python-dev
Status: COMPLETE
Files Modified: src/auth/routes.py, src/auth/models.py, tests/test_auth.py
Tests: 12 passed, 0 failed
Conformity: All backend-specs requirements implemented
Notes: JWT token expiry set to 24h per spec
```
**Testing agent coordination:**
```
SPAWN REQUEST
Agent: qa-test-agent
Specs: .claude/sprint/1/specs.md
Run After: python-dev, nextjs-dev
SPAWN REQUEST
Agent: ui-test-agent
Specs: .claude/sprint/1/specs.md
Run After: qa-test-agent
```
## Resources
- `${CLAUDE_SKILL_DIR}/references/ui-test-report.md` -- Structured UI test report format with coverage and failure tracking
- Sprint workflow skill for phase lifecycle context
- API contract skill for shared interface design
- Sprint plugin README for agent architecture overview
章节与文件索引
按说明文件中的顺序排列。
先决条件
使用说明
输出
错误处理
示例
文件/命令 -> /plugin install sprint · .claude/sprint/[N]/ · specs.md · sprint-workflow · api-contract.md · ${CLAUDE_SKILL_DIR}/references/ui-test-report.md · status.md · agents/
内容校验值 -> ad918564b3ec
当前原文的自动摘译,尚未人工审校。
先决条件
安装和配置 Sprint 插件 (
/plugin install sprint) 在.claude/sprint/[N]/specs.md初始化的 Sprint 目录,编写了清晰的范围和测试配置熟悉 sprint 阶段生命周期(参见sprint-workflow技能)使用说明
使用 SPAWN REQUEST 格式构造每个代理生成。包括代理名称、应读取的规范文件以及任何范围限制:确保每个生成的代理仅接收与其范围相关的文件。将
api-contract.md作为共享接口传递,以便后端和前端代理保持同步。完成后从每个代理处收集结构化报告。每份报告必须包括:完成的工作、修改的文件、添加的测试以及对规范的符合性状态。输出
sprint 协调器使用 SPAWN REQUEST 块来启动代理 结构化代理报告包含:摘要、更改的文件、测试结果和一致性状态 UI 测试报告,包含通过/失败计数、覆盖详细信息、失败描述和控制台错误日志 更新的
status.md反映每次迭代后已完成和剩余的工作错误处理
错误 · 原因 · 解决方案 代理接收到错误的规范文件 · SPAWN REQUEST 中的路径不正确 · 在生成之前验证 sprint 目录号和文件名 来自并行代理的重叠文件修改 · 范围边界未明确定义 · 按域划分工作;为每个代理分配不同的目录 代理报告缺少必填字段 · 代理指令缺少报告格式 · 在代理提示中包含结构化报告模板
示例
生成并行实现代理:两个代理共享相同的
api-contract.md以确保API兼容性。结构化代理报告格式: 测试代理协调: