Skill: Test-Driven Development (TDD) Workflow
This skill ensures software development follows a test-first pattern, ensuring modularity, reliability, and regression proofing.
Steps
- Define Interface & Contracts: Specify standard parameter types, output structures, and Zod boundaries before writing any execution logic.
- Write a Failing Test: Draft unit/component tests in the testing suite under
__tests__using Vitest or RTL. Run the tests viapnpm testto verify they fail for the correct reason. - Write Minimal Code: Implement the simplest possible structural execution to make the test pass. Avoid adding extra logic not specified in the test.
- Pass & Refactor: Confirm that the test suite passes. Immediately refactor the code (abstractions, function sizes, type clarity) in accordance with the
clean-code.mdrules. Verify tests still pass after refactoring.