workflow-patterns by wshobson/agents
npx skills add https://github.com/wshobson/agents --skill workflow-patterns使用 Conductor 的 TDD 工作流实现任务的指南,管理阶段检查点,处理 git 提交,并执行确保整个实现过程质量的验证协议。
为每个任务遵循以下 11 个步骤:
阅读 plan.md 并识别下一个待处理的 [ ] 任务。在当前阶段内按顺序选择任务。不要跳到后面的阶段。
更新 plan.md 以将任务标记为 [~]:
- [~] **Task 2.1**: Implement user validation
将此状态变更与实现分开提交。
在编写实现之前,编写定义预期行为的测试:
示例:
def test_validate_user_email_valid():
user = User(email="test@example.com")
assert user.validate_email() is True
def test_validate_user_email_invalid():
user = User(email="invalid")
assert user.validate_email() is False
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
编写使测试通过所需的最少代码:
在测试通过后,改进代码:
检查测试覆盖率是否达到 80% 的目标:
pytest --cov=module --cov-report=term-missing
如果覆盖率低于 80%:
如果实现偏离了计划或引入了新的依赖项:
为任务创建一个专注的提交:
git add -A
git commit -m "feat(user): implement email validation
- Add validate_email method to User class
- Handle empty and malformed emails
- Add comprehensive test coverage
Task: 2.1
Track: user-auth_20250115"
提交消息格式:
添加详细的任务摘要作为 git 注释:
git notes add -m "Task 2.1: Implement user validation
Summary:
- Added email validation using regex pattern
- Handles edge cases: empty, no @, no domain
- Coverage: 94% on validation module
Files changed:
- src/models/user.py (modified)
- tests/test_user.py (modified)
Decisions:
- Used simple regex over email-validator library
- Reason: No external dependency for basic validation"
更新 plan.md 以使用提交 SHA 标记任务完成:
- [x] **Task 2.1**: Implement user validation `abc1234`
提交计划状态更新:
git add conductor/tracks/*/plan.md
git commit -m "docs: update plan - task 2.1 complete
Track: user-auth_20250115"
当一个阶段的所有任务都完成后,执行验证协议:
列出自上一个检查点以来修改的所有文件:
git diff --name-only <last-checkpoint-sha>..HEAD
对于每个修改的文件:
执行完整的测试套件:
pytest -v --tb=short
所有测试必须在继续之前通过。
创建手动验证清单:
## Phase 1 Verification Checklist
- [ ] User can register with valid email
- [ ] Invalid email shows appropriate error
- [ ] Database stores user correctly
- [ ] API returns expected response codes
向用户呈现验证清单:
Phase 1 complete. Please verify:
1. [ ] Test suite passes (automated)
2. [ ] Coverage meets target (automated)
3. [ ] Manual verification items (requires human)
Respond with 'approved' to continue, or note issues.
没有明确批准,不要继续。
批准后,创建检查点提交:
git add -A
git commit -m "checkpoint: phase 1 complete - user-auth_20250115
Verified:
- All tests passing
- Coverage: 87%
- Manual verification approved
Phase 1 tasks:
- [x] Task 1.1: Setup database schema
- [x] Task 1.2: Implement user model
- [x] Task 1.3: Add validation logic"
更新 plan.md 中的检查点表格:
## Checkpoints
| Phase | Checkpoint SHA | Date | Status |
| ------- | -------------- | ---------- | -------- |
| Phase 1 | def5678 | 2025-01-15 | verified |
| Phase 2 | | | pending |
在标记任何任务完成之前,验证这些关卡:
如果适用:
<type>(<scope>): <subject>
<body>
<footer>
类型:
feat:新功能fix:错误修复refactor:无功能/修复的代码变更test:添加测试docs:文档chore:维护将详细注释附加到提交:
git notes add -m "<detailed summary>"
查看注释:
git log --show-notes
好处:
完成任务时始终记录提交 SHA:
- [x] **Task 1.1**: Setup schema `abc1234`
- [x] **Task 1.2**: Add model `def5678`
这实现了:
检查点为语义回滚创建还原点:
在以下情况后创建检查点:
在检查点提交中包含:
用于回滚:
# Revert to end of Phase 1
git revert --no-commit <phase-2-commits>...
git commit -m "revert: rollback to phase 1 checkpoint"
用于审查:
# See what changed in Phase 2
git diff <phase-1-sha>..<phase-2-sha>
在实施过程中,可能会出现与计划的偏差。系统性地处理它们:
范围增加 发现原始规范中未包含的需求。
范围缩减 在实施过程中认为不必要的功能。
[-](已跳过)并说明原因技术偏差 与计划不同的实现方法。
需求变更 在工作过程中对需求的理解发生变化。
当完成一个有偏差的任务时:
- [x] **Task 2.1**: Implement validation `abc1234`
- DEVIATION: Used library instead of custom code
- Reason: Better edge case handling
- Impact: Added email-validator to dependencies
如果在达到绿阶段后测试失败:
如果用户拒绝一个检查点:
如果任务无法进行:
[!] 并附上阻塞描述RED: Write test for model creation and validation
GREEN: Implement model class with fields
REFACTOR: Add computed properties, improve types
RED: Write test for request/response contract
GREEN: Implement endpoint handler
REFACTOR: Extract validation, improve error handling
RED: Write test for component interaction
GREEN: Wire components together
REFACTOR: Improve error propagation, add logging
RED: Add characterization tests for current behavior
GREEN: Apply refactoring (tests should stay green)
REFACTOR: Clean up any introduced complexity
当修改带有现有测试的代码时:
当重构改变测试结构时:
在任何更改之后:
在请求批准之前运行:
# Test suite
pytest -v --tb=short
# Coverage
pytest --cov=src --cov-report=term-missing
# Linting
ruff check src/ tests/
# Type checking (if applicable)
mypy src/
对于手动项目,提供具体说明:
## Manual Verification Steps
### User Registration
1. Navigate to /register
2. Enter valid email: test@example.com
3. Enter password meeting requirements
4. Click Submit
5. Verify success message appears
6. Verify user appears in database
### Error Handling
1. Enter invalid email: "notanemail"
2. Verify error message shows
3. Verify form retains other entered data
保持测试套件快速:
保持提交原子性:
每周安装
3.4K
仓库
GitHub 星标
32.2K
首次出现
Jan 20, 2026
安全审计
安装于
claude-code2.6K
gemini-cli2.5K
opencode2.5K
cursor2.4K
codex2.4K
github-copilot2.1K
Guide for implementing tasks using Conductor's TDD workflow, managing phase checkpoints, handling git commits, and executing the verification protocol that ensures quality throughout implementation.
Follow these 11 steps for each task:
Read plan.md and identify the next pending [ ] task. Select tasks in order within the current phase. Do not skip ahead to later phases.
Update plan.md to mark the task as [~]:
- [~] **Task 2.1**: Implement user validation
Commit this status change separately from implementation.
Write tests that define the expected behavior before writing implementation:
Example:
def test_validate_user_email_valid():
user = User(email="test@example.com")
assert user.validate_email() is True
def test_validate_user_email_invalid():
user = User(email="invalid")
assert user.validate_email() is False
Write the minimum code necessary to make tests pass:
With green tests, improve the code:
Check test coverage meets the 80% target:
pytest --cov=module --cov-report=term-missing
If coverage is below 80%:
If implementation deviated from plan or introduced new dependencies:
Create a focused commit for the task:
git add -A
git commit -m "feat(user): implement email validation
- Add validate_email method to User class
- Handle empty and malformed emails
- Add comprehensive test coverage
Task: 2.1
Track: user-auth_20250115"
Commit message format:
Add rich task summary as git note:
git notes add -m "Task 2.1: Implement user validation
Summary:
- Added email validation using regex pattern
- Handles edge cases: empty, no @, no domain
- Coverage: 94% on validation module
Files changed:
- src/models/user.py (modified)
- tests/test_user.py (modified)
Decisions:
- Used simple regex over email-validator library
- Reason: No external dependency for basic validation"
Update plan.md to mark task complete with commit SHA:
- [x] **Task 2.1**: Implement user validation `abc1234`
Commit the plan status update:
git add conductor/tracks/*/plan.md
git commit -m "docs: update plan - task 2.1 complete
Track: user-auth_20250115"
When all tasks in a phase are complete, execute the verification protocol:
List all files modified since the last checkpoint:
git diff --name-only <last-checkpoint-sha>..HEAD
For each modified file:
Execute complete test suite:
pytest -v --tb=short
All tests must pass before proceeding.
Create checklist of manual verifications:
## Phase 1 Verification Checklist
- [ ] User can register with valid email
- [ ] Invalid email shows appropriate error
- [ ] Database stores user correctly
- [ ] API returns expected response codes
Present verification checklist to user:
Phase 1 complete. Please verify:
1. [ ] Test suite passes (automated)
2. [ ] Coverage meets target (automated)
3. [ ] Manual verification items (requires human)
Respond with 'approved' to continue, or note issues.
Do NOT proceed without explicit approval.
After approval, create checkpoint commit:
git add -A
git commit -m "checkpoint: phase 1 complete - user-auth_20250115
Verified:
- All tests passing
- Coverage: 87%
- Manual verification approved
Phase 1 tasks:
- [x] Task 1.1: Setup database schema
- [x] Task 1.2: Implement user model
- [x] Task 1.3: Add validation logic"
Update plan.md checkpoints table:
## Checkpoints
| Phase | Checkpoint SHA | Date | Status |
| ------- | -------------- | ---------- | -------- |
| Phase 1 | def5678 | 2025-01-15 | verified |
| Phase 2 | | | pending |
Before marking any task complete, verify these gates:
If applicable:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixrefactor: Code change without feature/fixtest: Adding testsdocs: Documentationchore: MaintenanceAttach detailed notes to commits:
git notes add -m "<detailed summary>"
View notes:
git log --show-notes
Benefits:
Always record the commit SHA when completing tasks:
- [x] **Task 1.1**: Setup schema `abc1234`
- [x] **Task 1.2**: Add model `def5678`
This enables:
Checkpoints create restore points for semantic reversion:
Create checkpoint after:
Include in checkpoint commit:
For reverting:
# Revert to end of Phase 1
git revert --no-commit <phase-2-commits>...
git commit -m "revert: rollback to phase 1 checkpoint"
For review:
# See what changed in Phase 2
git diff <phase-1-sha>..<phase-2-sha>
During implementation, deviations from the plan may occur. Handle them systematically:
Scope Addition Discovered requirement not in original spec.
Scope Reduction Feature deemed unnecessary during implementation.
[-] (skipped) with reasonTechnical Deviation Different implementation approach than planned.
Requirement Change Understanding of requirement changes during work.
When completing a task with deviation:
- [x] **Task 2.1**: Implement validation `abc1234`
- DEVIATION: Used library instead of custom code
- Reason: Better edge case handling
- Impact: Added email-validator to dependencies
If tests fail after reaching GREEN:
If user rejects a checkpoint:
If task cannot proceed:
[!] with blocker descriptionRED: Write test for model creation and validation
GREEN: Implement model class with fields
REFACTOR: Add computed properties, improve types
RED: Write test for request/response contract
GREEN: Implement endpoint handler
REFACTOR: Extract validation, improve error handling
RED: Write test for component interaction
GREEN: Wire components together
REFACTOR: Improve error propagation, add logging
RED: Add characterization tests for current behavior
GREEN: Apply refactoring (tests should stay green)
REFACTOR: Clean up any introduced complexity
When modifying code with existing tests:
When refactoring changes test structure:
After any change:
Run before requesting approval:
# Test suite
pytest -v --tb=short
# Coverage
pytest --cov=src --cov-report=term-missing
# Linting
ruff check src/ tests/
# Type checking (if applicable)
mypy src/
For manual items, provide specific instructions:
## Manual Verification Steps
### User Registration
1. Navigate to /register
2. Enter valid email: test@example.com
3. Enter password meeting requirements
4. Click Submit
5. Verify success message appears
6. Verify user appears in database
### Error Handling
1. Enter invalid email: "notanemail"
2. Verify error message shows
3. Verify form retains other entered data
Keep test suite fast:
Keep commits atomic:
Weekly Installs
3.4K
Repository
GitHub Stars
32.2K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code2.6K
gemini-cli2.5K
opencode2.5K
cursor2.4K
codex2.4K
github-copilot2.1K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装