一键导入
implementing-with-tdd
Use when implementing bug fixes, features, or any code changes where test-first development is appropriate.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementing bug fixes, features, or any code changes where test-first development is appropriate.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when receiving feature requests, architectural discussions, or multi-step implementation needs that require design before coding.
Manages task lifecycle transitions including starting, completing, and blocking tasks with enforcement gates and Trello synchronization.
Manages feature planning workflow with provider-agnostic PM operations. Detects active provider and adapts commands accordingly.
Manages feature planning workflow including budget validation, task creation, and Trello synchronization.
Use when reviewing code changes, checking PRs, or evaluating code quality.
Use when promoting a new tranche, modifying the manifest, or otherwise about to push changes that affect the deploy-side build. Runs the same deterministic checks as the release-gate CI workflow.
| name | implementing-with-tdd |
| description | Use when implementing bug fixes, features, or any code changes where test-first development is appropriate. |
| skills | ["implementing-with-tdd"] |
| agent-roles | ["driver"] |
Write ONE small test, make it pass, refactor, repeat. Never write all tests upfront.
Before writing a single line of code:
test_parser_validation.py, test_parser_edge_cases.pytest_parser.pyExample cycle plan for a parser task:
Cycle 1: parse empty input → returns empty result (1 test)
Cycle 2: parse single valid entry → returns correct fields (2 tests)
Cycle 3: parse malformed input → raises ValueError (2 tests)
Cycle 4: parse batch input → handles multiple entries (2 tests)
Write tests for ONE behavior only. Maximum 5 test functions per RED phase.
# Run the new tests — they MUST fail
pytest tests/path/to/test_file.py -v -k "test_new_behavior"
If tests pass without implementation, the tests are wrong. Fix them.
Write ONLY enough production code to make the failing tests pass. No more.
# Run tests — they must now pass
pytest tests/path/to/test_file.py -v
If files are growing large, refactor NOW (not later):
# Tests must still pass after refactor
pytest tests/path/to/test_file.py -v
After every 3-5 completed cycles, run architecture check:
bpsai-pair arch check <modified-production-files>
Fix any violations before continuing to the next cycle.
| Guideline | Rule |
|---|---|
| Naming | Name by behavior, not just module: test_parser_validation.py |
| Split point | Create a new file when reaching 15 test functions |
| Fixtures | Share via conftest.py when used by 2+ test files |
| Imports | Keep under 30 per test file |
| Line count | Warning at 400, error at 600 (relaxed from production limits) |
# Run specific test
pytest tests/path/test_module.py::test_function -v
# Run all tests
pytest -v
# Run with coverage
pytest --cov
# Run only failed tests
pytest --lf
# Stop on first failure
pytest -x
MANDATORY: Before completing any task:
bpsai-pair arch check <path-to-modified-files>
Test files have relaxed limits (600/400/50/40/30) but still enforced. Production files have strict limits (400/200/50/15/20).
See also: architecting-modules skill for decomposition patterns.
After all cycles complete, tests pass, AND arch check passes:
bpsai-pair ttask done TRELLO-XX --summary "...".paircoder/context/state.md (NON-NEGOTIABLE)