Skip to content
Skills Library
Programming · Testing

tdd

/tdd

Test-driven development through public seams: one failing test, the least code to pass it, repeat. Covers what makes a test worth keeping and the anti-patterns to avoid. Use when building features or fixing bugs test-first.

Licence
MIT
Last repository change
09.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 09.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Test-driven development through public seams: one failing test, the least code to pass it, repeat. Covers what makes a test worth keeping and the anti-patterns to avoid. Use when building features or fixing bugs test-first.

Original author description

Test-driven development through public seams: one failing test, the least code to pass it, repeat. Covers what makes a test worth keeping and the anti-patterns to avoid. Use when building features or fixing bugs test-first.

How it works

  1. Test at the seam
  2. The loop
  3. What makes a good test
  4. Anti-patterns
Original SKILL.md headings · 38 lines, 441 words
SKILL.md preview
---
name: tdd
description: Test-driven development through public seams: one failing test, the least code to pass it, repeat. Covers what makes a test worth keeping and the anti-patterns to avoid. Use when building features or fixing bugs test-first.
---

# tdd

Red, then green, one slice at a time. The tests you end up with should describe what the system does, and keep passing when its insides change.

## Test at the seam

A test exercises behavior through a public interface: an endpoint, an exported function, a rendered screen. It never reaches inside.

- Agree the seams before writing tests. They're in the spec's **Test seams** section; if they aren't, propose them (what each catches, what it misses) and confirm.
- Prefer one high seam that covers a whole flow over many low ones.
- Name tests as behavior: `refund over the order total is rejected`, not `test_validate_2`.

## The loop

1. **Red.** Write one test for the next small behavior. Run it. It must fail, and fail for the reason you expect (an assertion, not a typo or import error).
2. **Green.** Write the least code that makes it pass. Don't build ahead for the next test.
3. **Repeat** with the next behavior. Each test should respond to what the last one taught you.

Refactoring is a separate step after a slice is green, not part of the red-green cycle. Keep tests passing while you do it.

For a bug: first write a test that reproduces it and fails. Then fix. The test stays as the regression guard.

## What makes a good test

- **Expected values come from outside the code:** a literal, a worked example, the spec. Never recompute the answer the way the code does (`expect(add(a, b)).toBe(a + b)` can't fail).
- **One behavior per test**, with a clear arrange, act, assert.
- **Deterministic.** Control time, randomness and network. A test that sometimes fails is a bug in the test or the code; find out which.
- **Fast enough to run on every change.** Keep slow end-to-end tests few and focused on the main paths.
- **Real collaborators when cheap.** Use an in-memory database or a local service over a mock where you can. Mock only at system edges you don't own (payment provider, email, clock).

## Anti-patterns

- **Testing the implementation:** mocking internal collaborators, testing private functions, checking the database directly instead of reading back through the interface. The sign: the test breaks on a refactor that didn't change behavior.
- **All tests first, then all code.** You end up testing the shape you imagined, not the behavior you needed. Go one test at a time.
- **Tests that pass by construction:** snapshots nobody checked, assertions that mirror the code, catch-all mocks.
- **Weakening a test to make it pass.** If a test is wrong, fix it on purpose and say why in the commit.

Versions

RepositoryScoreLicence
This page · LeMarkk/agent-skills100MIT
kdlbs/kandev100AGPL-3.0
sentimony/skills100MIT
sentimony/skills100MIT
TerminalSkills/skills100Apache-2.0
duronext/jig100MIT
xoai/sage100MIT
rolemodel/skills100MIT
matteocodogno/wellforge100MIT

Database snapshot: 13.11.2026 · package version 14864d9a1b75 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95tdd-workflow
    Test-driven development workflow for R using testthat. Use when writing new features, fixing bugs, or refactoring code. Enforces test-first development with 80%+ coverage.
  • 100test-driven-development
    Use when writing new functions, adding features, fixing bugs, or refactoring by applying TDD principles - write failing tests before implementation code, make them pass, then refactor.
  • 100test-driven-development
    Build features and fix bugs test-first with red-green-refactor: write one failing test, watch it fail for the right reason, write the least code that makes it pass, then refactor while green. Use this skill whenever you implement a feature, add a function or endpoint, change…
  • 90test-driven-development
    Use when implementing a feature or fixing a bug test-first: write a failing test, make it pass with the minimum code, then refactor. Covers the red-green-refactor loop, what is worth testing, and the common pitfalls that make TDD backfire.
  • 100054-design-tdd
    Use when Java implementation work should be guided by Test-Driven Development, including maintaining a test list, choosing the next behavior, writing a failing test first, implementing only enough production code to pass, and refactoring while keeping tests green. This should…
  • 100tdd-workflow
    Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.