원클릭으로
test-driven-development
TDD: enforce RED-GREEN-REFACTOR cycle. Tests before code, always.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
TDD: enforce RED-GREEN-REFACTOR cycle. Tests before code, always.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Karpathy-inspired guidelines: Think before coding, Simplicity first, Surgical changes, Goal-driven execution
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Write an actionable markdown plan before implementation. Bite-sized tasks, exact paths, complete code.
Write clear Conventional Commits. Imperative subject, explain why not what, one logical change per commit.
Optimize based on measurement, never guesswork. Profile first, fix the real bottleneck, verify the win.
Refactor code without changing behavior. Small steps, green tests after every change, no mixing with feature work.
| name | test-driven-development |
| description | TDD: enforce RED-GREEN-REFACTOR cycle. Tests before code, always. |
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Delete it. Start over. No exceptions.
Write one minimal test showing what should happen:
func TestRetriesFailedOperations(t *testing.T) {
attempts := 0
operation := func() error {
attempts++
if attempts < 3 {
return errors.New("fail")
}
return nil
}
err := retryOperation(operation)
if err != nil {
t.Fatalf("expected success, got %v", err)
}
if attempts != 3 {
t.Fatalf("expected 3 attempts, got %d", attempts)
}
}
Use bash to run it:
go test -run TestRetriesFailedOperations ./path/
Expected: FAIL — function not defined.
Write the absolute minimum code to make the test pass:
func retryOperation(op func() error) error {
var err error
for i := 0; i < 3; i++ {
err = op()
if err == nil {
return nil
}
}
return err
}
Run again: go test -run TestRetriesFailedOperations ./path/
Expected: PASS
Now that tests pass, improve the code:
Run tests after each refactor step.
If you find yourself thinking: