一键导入
tdd
Test-Driven Development workflow with red-green-refactor cycle. Use only when explicitly asked for TDD, not for general test writing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Test-Driven Development workflow with red-green-refactor cycle. Use only when explicitly asked for TDD, not for general test writing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | tdd |
| description | Test-Driven Development workflow with red-green-refactor cycle. Use only when explicitly asked for TDD, not for general test writing. |
Drive implementation through tests using the red-green-refactor cycle.
Adapted from Matt Pocock's TDD skill
Do not activate for general "write tests for X" or "add test coverage" requests. This skill is specifically for the TDD workflow where tests lead implementation.
Test behavior, not implementation. Every test should verify what the code does from the outside, not how it works inside. See deep-modules.md for the reasoning behind this.
Good tests act as a contract: they define what the module promises to its callers. If you can swap the internals completely and your tests still pass, they're testing the right thing.
Before writing any code, decide the public surface area:
Design for the caller, not the implementation. See interface-design.md.
Start with one test that exercises the simplest meaningful path through the feature. This test should:
RED: test exists, code does not
Run the test. Confirm it fails for the right reason (missing function, wrong return value — not a syntax error).
Write the minimum code to pass that one test. Do not write more than what the test demands. Hardcode return values if that's all it takes. The goal is a green test suite, not elegant code.
GREEN: test passes with minimal implementation
With the test passing, clean up. Remove duplication, improve names, extract helpers — but only while tests stay green. See refactoring.md.
REFACTOR: improve code quality, tests still pass
Add the next test. Pick the next simplest behavior that isn't covered. Follow the same cycle:
Build up complexity incrementally. Each cycle should take minutes, not hours.
After the core behavior works, add tests for:
Once all behavior is covered, do a final pass:
Use real dependencies when practical. Mock only at system boundaries — network calls, databases, file systems, clocks. See mocking.md for detailed guidance.
Write tests that are readable, independent, and fast. See tests.md for patterns on naming, structure, and assertion style.
Setup guide for essential MCP servers. Use when configuring MCP servers or when user asks about search, SQLite, or MCP management.
Query Claude Code session analytics from ccrecall database. Use when user asks about token usage, session history, or wants to analyze their Claude Code usage patterns.
High-leverage prompts that challenge Claude's defaults. Use for "grill me", "prove it works", "scrap this", "what would 10x engineer do", "find ways this fails".
Maintain CLAUDE.md files effectively. Use when adding lessons learned, updating conventions, or restructuring project instructions.
Multi-agent orchestration patterns for Claude Code team mode. Use when coordinating teammates, decomposing complex tasks, or managing shared task lists.
Enhanced Research-Plan-Implement workflow with structured phase gates. Use when tackling complex tasks that benefit from a phased approach with user checkpoints.