tdd-green-bar-patterns
Installation
SKILL.md
Green Bar Patterns
Treat a red bar as a condition to fix as fast as possible. Get to green by the quickest honest route, even with code you would not keep for more than an hour, then clean it up under green. Shift gears with confidence: Obvious Implementation when sure, Fake It or Triangulate when not.
Fake It ('Til You Make It)
Question: What is your first implementation once you have a broken test? Answer: Return a constant. Once the test passes, gradually turn the constant into an expression using variables.
// test
expect(summary(result)).toBe("1 run, 0 failed");
// step 1: return "1 run, 0 failed";
// step 2: return `${result.runCount} run, 0 failed`;
// step 3: return `${result.runCount} run, ${result.failureCount} failed`;