tdd

Solid

Test-driven development — write a failing test that names the behavior, watch it fail, implement the minimum to make it pass, then refactor with tests green. Works for new features, bug fixes, and behavior changes. Use when the user says "tdd", "test-first", "write tests first", or wants a change built test-first.

AI & Automation 73 stars 34 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 84/100

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

Skill Content

# TDD: red, green, refactor Write the test before the code. A test written first specifies the behavior, fails for a known reason, and gives you a definition of done you can run. A test written after tends to describe whatever the code happens to do — bugs included. ## Step 1: Find the test runner Don't assume the command. Detect how this project runs and writes tests: look at existing test files for the framework and conventions, and at the build/config for the invocation (`go test ./...`, `npm test`, `pytest`, `cargo test`, …). Match what's already there — same framework, same layout, same style. ## Step 2: Name the behavior as tests (RED) State the change as concrete cases before writing any implementation: - The main success path — the behavior actually requested. - The edges — empty, zero, boundary, maximum, unexpected input. - The failures — what should error, and how it should error. Write these as tests. For a bug fix, the first test **reproduces the bug**. Keep each test focused on one behavior with a clear name. ## Step 3: Watch them fail Run the tests and confirm they fail — and fail for the *right* reason (the behavior is missing), not a typo or an import error. A test you never saw fail proves nothing. This is the gate: do not write implementation until you've seen red. ## Step 4: Implement to green Write the **minimum** code that makes the tests pass. No features the tests don't demand, no speculative abstraction. Run the tests until they're green. #...

Details

Author
genai-io
Repository
genai-io/san
Created
1 years ago
Last Updated
today
Language
Go
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category