一键导入
tdd
Test-Driven Development workflow. Write failing test first, then implement to make it pass. Use for new features, bug fixes, or refactoring with confidence.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Test-Driven Development workflow. Write failing test first, then implement to make it pass. Use for new features, bug fixes, or refactoring with confidence.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Automated visual testing with Playwright MCP - test web apps, presentations, websites, and documents with scalable reviewer perspectives
Expert guidance on RAG (Retrieval-Augmented Generation) system design including chunking strategies, embedding selection, retrieval methods, and vector database choices
Design complex system architectures, evaluate tradeoffs, and make critical technical decisions requiring deep reasoning
Deep code analysis identifying subtle bugs, security issues, performance problems, and architectural concerns requiring expert-level reasoning
Efficient context state inspection, task lifecycle management, and session tracking
Systematic codebase onboarding. Builds a mental model of a new or unfamiliar project by exploring structure, architecture, key data models, entry points, and auth patterns.
| name | tdd |
| description | Test-Driven Development workflow. Write failing test first, then implement to make it pass. Use for new features, bug fixes, or refactoring with confidence. |
Strict Red → Green → Refactor TDD cycle.
/tdd validate_user_email function # TDD a specific function
/tdd rate limiting middleware # TDD a new middleware
/tdd # TDD current task from CONTEXT_STATE.md
Read the specification (task description, docstring, or requirements)
Identify the smallest testable behavior
Write ONE test that captures that behavior:
test_<function>_<scenario>_<expected_outcome>Run test → confirm it fails for the right reason:
pytest tests/ -k "your_test_name" -v
Write the minimum code to make the test pass
Run test → confirm it passes:
pytest tests/ -k "your_test_name" -v
Run full suite → confirm no regressions:
pytest tests/ -q
Improve code quality WITHOUT changing behavior:
Run tests after each refactor step:
pytest tests/ -q
Repeat from step 2 for the next behavior
One behavior per test: Each test asserts exactly one behavior Arrange-Act-Assert:
def test_validate_email_rejects_missing_at_sign():
# Arrange
invalid_email = "not-an-email"
# Act
result = validate_email(invalid_email)
# Assert
assert result is False
Test behaviors, not implementation:
# ❌ Tests implementation
assert validator._regex.pattern == r"^[^@]+@[^@]+\.[^@]+$"
# ✅ Tests behavior
assert validate_email("user@example.com") is True
assert validate_email("bad-email") is False
Edge cases to always test:
Before writing tests, check for existing patterns:
search_code_graph("test patterns for <component type>")
hybrid_search("testing <domain> in Python")
After completing the TDD cycle:
## TDD Summary
**Feature**: <what was implemented>
**Tests added**: N
- test_<name>: <what it covers>
- test_<name>: <what it covers>
**All tests**: ✅ N passing
**Refactors applied**: <what was cleaned up, or "none needed">