بنقرة واحدة
test-driven-development
Enforce RED-GREEN-REFACTOR TDD cycle
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Enforce RED-GREEN-REFACTOR TDD cycle
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
| name | test-driven-development |
| description | Enforce RED-GREEN-REFACTOR TDD cycle |
| alwaysInclude | false |
| requiredBins | [] |
| platforms | ["darwin","linux"] |
| version | 1.0.0 |
| tenantIds | [] |
Follow the strict RED → GREEN → REFACTOR cycle when writing code. Every behavioral change starts with a failing test.
┌──────────┐ ┌──────────┐ ┌──────────┐
│ RED │────▶│ GREEN │────▶│ REFACTOR │
│ │ │ │ │ │
│ Write a │ │ Write │ │ Clean up │
│ failing │ │ minimal │ │ without │
│ test │ │ code to │ │ changing │
│ │ │ pass │ │ behavior │
└──────────┘ └──────────┘ └──────────┘
▲ │
└────────────────────────────────┘
# Run the test and confirm it FAILS
ShellExec: pytest tests/test_feature.py::test_new_behavior -x
The failure message should clearly indicate the missing behavior, not an infrastructure problem.
# Run ALL tests to verify nothing broke
ShellExec: pytest tests/ -x
# Confirm refactor is safe
ShellExec: pytest tests/ -x
test_login_rejects_expired_token over test_login_3.Move to the next RED phase when:
Progress from simple to complex:
When a hardcoded return passes a test, add a second test with different inputs to force generalization:
# Test 1: passes with hardcoded return "fizz"
def test_fizzbuzz_3():
assert fizzbuzz(3) == "fizz"
# Test 2: forces real implementation
def test_fizzbuzz_6():
assert fizzbuzz(6) == "fizz"
| Anti-Pattern | Problem |
|---|---|
| Writing tests after code | Tests confirm what you wrote, not what you need |
| Multiple failing tests at once | Lose focus, unclear which behavior to implement next |
| Skipping REFACTOR | Technical debt accumulates immediately |
| Testing implementation details | Tests break on refactor, defeating the purpose |
| Large steps | Each cycle should take minutes, not hours |
Decompose and route work through multi-agent Kanban systems
Task lifecycle management and workspace handoff for Kanban workers
Terminal-based Node.js debugging via V8 inspector protocol
Python debugging with pdb, debugpy, and remote attach
Root-cause investigation methodology before applying fixes
Extract YouTube transcripts and transform into structured content