Skip to content

discipline

Applies to: **/*.{js,ts,jsx,tsx,py,go,rs,java,rb,sh}, **/*.{test,spec}.*

Violating the letter IS violating the spirit.

RED/GREEN/REFACTOR — no exceptions.

  1. Write a failing test (RED)
  2. Write minimal implementation to pass (GREEN)
  3. Refactor with safety net (REFACTOR)

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 commit

Never commit implementation without a prior test commit in the same feature. The git history must show RED before GREEN.

ExcuseRealityResponse
”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.”

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.”

After 3 consecutive failures on the same task:

  1. Stop attempting
  2. Document what was tried
  3. Write down blockers and findings clearly
  4. Ask human for guidance

Never: Keep trying indefinitely hoping something works.