discipline
Applies to: **/*.{js,ts,jsx,tsx,py,go,rs,java,rb,sh}, **/*.{test,spec}.*
Discipline
Section titled “Discipline”Violating the letter IS violating the spirit.
TDD Mandate
Section titled “TDD Mandate”RED/GREEN/REFACTOR — no exceptions.
- Write a failing test (RED)
- Write minimal implementation to pass (GREEN)
- Refactor with safety net (REFACTOR)
Commit Order
Section titled “Commit Order”TDD requires strict commit order: test commit (test:) before implementation commit (feat:/fix:).
git commit -m "test: add failing test for X" ← RED commit (no implementation yet)git commit -m "feat: implement X" ← GREEN commitNever commit implementation without a prior test commit in the same feature. The git history must show RED before GREEN.
Common Rationalizations
Section titled “Common Rationalizations”| Excuse | Reality | Response |
|---|---|---|
| ”Too simple to test” | Simple code breaks too | ”30 seconds. Write it." |
| "Tests after” | Not TDD | ”Delete code. Test first." |
| "I know TDD” | Knowing ≠ doing | ”Follow it exactly." |
| "Just exploring” | Fine | ”Throw away. Then TDD." |
| "I’ll just try…” | Undisciplined | ”STOP. Return to process." |
| "This is urgent” | Urgency not an excuse | ”TDD is FASTER. Do it right." |
| "Test passed immediately” | Suspicious | ”Verify test fails without code." |
| "It’s just a small change” | Small changes break too | ”All changes need tests." |
| "I’m following the spirit” | No you’re not | ”Letter = spirit. Follow exactly." |
| "This is a special case” | No special cases | ”The rule applies. Always." |
| "I don’t have time” | TDD saves time | ”You don’t have time NOT to TDD.” |
Red Flags (Stop Immediately)
Section titled “Red Flags (Stop Immediately)”When you notice these patterns, STOP and return to process:
- “I’ll just try this quickly”
- “Maybe if I change…”
- “I think I know what’s wrong”
- “Let me just…”
- “This should work”
- “Just one more try”
- Multiple fixes without understanding
Response: “Red flag detected. Returning to process.”
The 3-Failure Rule
Section titled “The 3-Failure Rule”After 3 consecutive failures on the same task:
- Stop attempting
- Document what was tried
- Write down blockers and findings clearly
- Ask human for guidance
Never: Keep trying indefinitely hoping something works.