test-driven-development

Solid

This skill should be used when implementing new features, fixing bugs, or writing new code. Enforces RED-GREEN-REFACTOR.

Code & Development 17 stars 1 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 79/100

Stars 20%
42
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Test-Driven Development Enforce the RED-GREEN-REFACTOR cycle for all implementation work. Tests define the design. Code satisfies the tests. Refactoring improves the design without changing behavior. ## Iron Law > **TESTS FIRST, ALWAYS** > > Write the failing test before the production code. No exceptions. If you catch > yourself writing production code without a failing test, stop immediately, delete > the production code, write the test, watch it fail, then write the minimum code > to make it pass. The test IS the specification. --- ## The Cycle ### Step 1: RED — Write a Failing Test Write a test that describes the behavior you want. Run it. Watch it fail. The failure message IS your specification. ``` Describe what the code SHOULD do, not how it does it. One behavior per test. One assertion per test (ideally). Name tests as sentences: "returns error when email is invalid" ``` **Checkpoint:** The test MUST fail before proceeding. A test that passes immediately proves nothing. ### Step 2: GREEN — Write Minimum Code to Pass Write the simplest production code that makes the failing test pass. No more, no less. ``` Hardcode first if that's simplest. Generalize when the next test forces it. Don't write code "you'll need later." Write code the test demands NOW. Don't optimize. Don't refactor. Don't clean up. Just pass the test. ``` **Checkpoint:** All tests pass. If any test fails, fix it before moving on. ### Step 3: REFACTOR — Improve Without Changing Behavior ...

Details

Author
dean0x
Repository
dean0x/devflow
Created
10 months ago
Last Updated
yesterday
Language
TypeScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category