What problem does it solve?
This Skill enforces the Test-Driven Development (TDD) methodology, preventing common pitfalls like writing tests after code, which often leads to incomplete or ineffective test coverage. It ensures every piece of production code is backed by a failing-then-passing test, drastically reducing bugs and improving code quality.
Core Features & Use Cases
- Red-Green-Refactor Cycle: Guides you through writing a failing test, writing minimal code to pass it, and then refactoring.
- Iron Law Enforcement: Strictly prevents writing production code without a preceding failing test, ensuring true TDD adherence.
- Bug Prevention & Regression Safety: Catches bugs early and prevents regressions by ensuring tests verify actual behavior.
- Use Case: When implementing a new feature, use this Skill to systematically build out the functionality, ensuring each component is thoroughly tested and verified before integration, leading to more stable and maintainable code.
Quick Start
Start with a failing test for new behavior
test('retries failed operations 3 times', async () => {
let attempts = 0;
const operation = () => {
attempts++;
if (attempts < 3) throw new Error('fail');
return 'success';
};
const result = await retryOperation(operation);
expect(result).toBe('success');
expect(attempts).toBe(3);
});
Run tests, watch it fail, then write minimal code to pass.