Skip to content
Skills Library
Programming · Testing

tdd

/tdd

BDD-driven test implementation: red-green loop mechanics, seams, mocking, and test quality under BDD Automation. Use when the user wants to write or improve tests during BDD implementation, needs guidance on test structure, or asks about test seams, mocking, or anti-patterns.

Repository
dotclaude ↗
Licence
MIT
Last repository change
26.09.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
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.09.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

BDD-driven test implementation: red-green loop mechanics, seams, mocking, and test quality under BDD Automation. Use when the user wants to write or improve tests during BDD implementation, needs guidance on test structure, or asks about test seams, mocking, or anti-patterns.

Original author description

BDD-driven test implementation: red-green loop mechanics, seams, mocking, and test quality under BDD Automation. Use when the user wants to write or improve tests during BDD implementation, needs guidance on test structure, or asks about test seams, mocking, or anti-patterns.

How it works

  1. CRITICAL: BDD scenarios come first
  2. What a good test is
  3. Seams: where tests go
  4. Anti-patterns
  5. Rules of the loop
  6. CRITICAL: BDD-Driven — not standalone TDD
  7. When to invoke
Original SKILL.md headings · 62 lines, 791 words
SKILL.md preview
---
name: tdd
description: "BDD-driven test implementation: red-green loop mechanics, seams, mocking, and test quality under BDD Automation. Use when the user wants to write or improve tests during BDD implementation, needs guidance on test structure, or asks about test seams, mocking, or anti-patterns."
---

# BDD-Driven TDD (Automation)

BDD cycles through three phases: **Discovery** (conversations → examples), **Formulation** (Gherkin scenarios), **Automation** (red-green-refactor, driven by BDD). This skill is the **BDD-driven Automation** reference — the how of test implementation, once `/mattpocock:bdd` has defined the what.

When invoked during `/mattpocock:implement` or `/mattpocock:bdd`, use this skill as the test-writing authority. The `/mattpocock:bdd` skill governs the scenario design and Iron Law; this skill governs the test code quality under BDD discipline.

## CRITICAL: BDD scenarios come first

If you reached this skill directly (not via `/mattpocock:bdd` or `/mattpocock:implement`), stop and ask the user: **"Have you defined the Gherkin scenarios for this behavior yet?"**

- If **no** → invoke `/mattpocock:bdd` first to define the scenarios via Discovery → Formulation, then return here for Automation.
- If **yes** → confirm the scenarios are in `.feature` files or equivalent, then proceed with the red-green loop below.

## What a good test is

Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.

See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.

## Seams: where tests go

A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.

**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.

Ask: "What's the public interface, and which seams should we test?"

When the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with "mattpocock:codebase-design" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.

## Anti-patterns

- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.
- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.

## Rules of the loop

- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
- **One slice at a time.** One seam, one test, one minimal implementation per cycle.
- **Refactoring is not part of the loop.** It belongs to the review stage (see `/mattpocock:code-review`), not the red → green implementation cycle.

## CRITICAL: BDD-Driven — not standalone TDD

This skill is the **Automation** phase of the BDD lifecycle. It always runs under `/mattpocock:bdd` or `/mattpocock:implement` as **BDD-driven TDD**. If invoked directly, see the CRITICAL check at the top of this file — confirm scenarios exist before writing test code.

1. **Discovery** (what behavior matters) — owned by `/mattpocock:bdd` via Gherkin scenarios
2. **Formulation** (scenario as specification) — owned by `/mattpocock:bdd` via `.feature` files
3. **Automation** (this skill) — the red-green loop that makes the scenario pass

## When to invoke

Invoke this skill explicitly when:
- The user asks "how should I test this?" during BDD implementation
- The user asks about mocking, seams, or test structure
- The user writes a test that looks implementation-coupled
- The user asks about mocking strategy at system boundaries
- The user is unsure whether a test is good or tautological

When invoked directly, first check if Gherkin scenarios exist (see the CRITICAL check at the top). If not, redirect to `/mattpocock:bdd` before proceeding with Automation.

The `/mattpocock:bdd` and `/mattpocock:implement` skills load this automatically during the Automation phase — you do not need to invoke it separately in those flows.
Files in this package (4)
  • SKILL.md 5 KB
  • mocking.md 1 KB
  • tests.md 2 KB
  • agents/openai.yaml 1 KB

Versions

RepositoryScoreLicence
This page · FradSer/dotclaude100MIT
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 e9477f5b0c36 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

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

Similar skills

  • 100test-driven-development
    Use when implementing new features or logic that requires tests — before writing implementation code. Covers Red-Green-Refactor cycle, stack-specific test patterns, test naming conventions, and mocking. Triggers: "write tests first", "TDD", "test-driven", "failing test",…
  • 100testing
    TDD/BDD testing principles. Use when writing tests, reviewing test coverage, setting up testing, or discussing test strategy and test architecture.
  • 100testing
    Comprehensive software testing skill covering unit tests, integration tests, TDD/BDD, mocking strategies, and test automation across multiple languages. Use this skill when writing test cases, designing test strategies, implementing test automation, or need guidance on testing…
  • 80alpha-core:testing-patterns
    Provides testing strategies including test pyramid, TDD/BDD, unit/integration/E2E patterns, mocking strategies, test data factories, snapshot testing, and mutation testing. Use when designing test strategies, writing tests, or improving test coverage.
  • 100test-review
    Evaluates test suites for coverage gaps, TDD/BDD compliance, and anti-patterns. Use when auditing test quality or before a major release.
  • 100test-driven-development
    Test-Driven Development methodology and red-green-refactor workflow (formerly test-tdd). This skill should be used when practicing TDD, writing tests first, designing tests before implementation, or reviewing test-first approaches. Triggers on "write tests first", "test before…

Feedback and reports

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