Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

test-driven-development

/test-driven-development

Określa kontrakt wykonania test-first: czerwony przed kodem, zielony minimalną zmianą, refaktoryzacja przy przechodzących testach oraz zasady i eskalację.

Licencja
MIT
Ostatnia zmiana repozytorium
21.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Określa kontrakt wykonania test-first: czerwony przed kodem, zielony minimalną zmianą, refaktoryzacja przy przechodzących testach oraz zasady i eskalację.

Oryginalny opis (EN)

Provides the test-first execution contract: RED before any implementation code, GREEN with the minimum change, REFACTOR under passing tests, plus its rules, verification and escalation, with deep-dive rationale on demand. Squad-internal execution contract loaded by agents via their Methodology Dependencies table. Also directly invocable: when a user asks for this on named files outside a pipeline, the Orchestrator delegates to the skill's owning persona — the agent whose Methodology Dependencies table loads it — and never applies the Worker Execution Contract itself.

Jak działa

  1. Direct invocation
  2. Quick card
  3. Worker Execution Contract
  4. Deep Dive
Sekcje z nagłówków SKILL.md, w oryginale · 93 linii, 1 501 słów
Podgląd SKILL.md
---
name: test-driven-development
description: "Provides the test-first execution contract: RED before any implementation code, GREEN with the minimum change, REFACTOR under passing tests, plus its rules, verification and escalation, with deep-dive rationale on demand. Squad-internal execution contract loaded by agents via their Methodology Dependencies table. Also directly invocable: when a user asks for this on named files outside a pipeline, the Orchestrator delegates to the skill's owning persona — the agent whose Methodology Dependencies table loads it — and never applies the Worker Execution Contract itself."
risk: unknown
source: community
date_added: "2026-02-27"
---

# Test-Driven Development (TDD)

## Direct invocation

Direct asks on named files are a deliberate refinement of agent-audit Metric 12, not a trigger collision. Direct invocation: the Orchestrator delegates to the skill's owning persona — the agent whose Methodology Dependencies table loads it — and never applies the Worker Execution Contract itself. Owner: **Mason**/**Nova** (UI). No editing tests to pass. Over three files or shared behaviour → `/bg`.

## Quick card

Derived from the contract below for a ≤ 3-file change; no new rules (convention #8 — deliberately narrower than the full contract, which binds inside any lane).

1. Capture the new test failing — a second `evidence/` capture through the lane's wrapper — before the code exists (§ The Iron Law).
2. Write the minimum code to pass — no speculative options or abstractions (§ Workflow, GREEN).
3. One behaviour per test, AAA, named for the behaviour (§ Rules).
4. Real code the test imports; mock only true external boundaries (§ Rules).
5. Full suite green with pristine output before closing; three RED-RED cycles → escalate (§ Escalate When).

- Brief → the quick note (What / Where / How verified)
- Artifact → the capture at `{quick-root}/evidence/check.md`
- Handoff → the `## Result` bullet in `note.md`

## Worker Execution Contract

For a change of ≤ 3 files outside a pipeline, the Quick card above is the contract; the full contract applies inside a lane.

### The Iron Law

```
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
```

**Never skip RED** (RED-before-implementation). Wrote code before the test? DELETE it — not kept as "reference", not adapted, not looked at. Delete means delete; implement fresh from tests.

### Workflow

1. **RED**: Write one failing test for the next behavior. Verify it fails for the expected reason (feature missing — not a typo or error).
2. **GREEN**: Write the minimum code to pass — no speculative features, options, or abstractions (YAGNI). Verify it passes; run the full suite and confirm all green, output pristine.
   - **Retries are instrumentation, not treatment: a pass that needed a retry is a flake signal, not a GREEN.** Tightens this step's "Verify it passes" (convention #8 — deliberately narrower: a run that only went green after a retry no longer counts as "passes" here). Enforced mechanically (convention #9) by `check_red_green.py --no-flaky-pass`, which scans the GREEN capture's runner output for a pass-on-retry marker (Playwright's flaky summary or retry-attempt line, pytest-rerunfailures' `RERUN`) and fails closed when one is found.
   - **A flaky test is quarantined within 24h**: pulled out of the merge-blocking suite into a named triage list kept in the project's `.docs/{project-name}/` memory — never deleted (deleting an unreconciled flake deletes a bug report, not the bug) — and re-enters the suite only after a retry-free GREEN. This stays prose (convention #9): which test is quarantined and when is a scheduling decision, not a moment where an agent is tempted to skip a restraint at the point of commit.
3. **REFACTOR**: Clean up without changing behavior. Tests stay green.
4. Repeat for the next behavior.

### Rules

- One logical assertion / one behavior per test.
- Test names describe behavior: `"should reject empty email"`, not `"test validateInput"`. Name needs "and" → split the test.
- AAA structure: Arrange → Act → Assert.
- Parameterize tests for multiple input variants rather than duplicating.
- NEVER test implementation details (private methods, internal state).
- NEVER write dummy assertions (`expect(true).toBe(true)`) or stub tests: tests must rigorously mount, exercise, and assert the full state, style variations, and behavior of the target component or function.
- Prefer real code. Mock ONLY true external boundaries you don't own — network APIs, databases, the filesystem, clock/randomness. NEVER mock your own code under test.
- **A test must fail when the production code it names is deleted** — the deletion test. A test that defines the logic it asserts (in the file or inside a browser `evaluate`), reads production source as text and evaluates a slice of it, or renders stub HTML instead of the application proves nothing and is rejected by `check_test_authenticity.py` (codes `test_no_production_import`, `test_inline_reimplementation`, `test_source_eval`, `test_synthetic_dom`) at every lane's gate. When the real surface cannot run — environment down, login blocked, data missing — the honest result is `BLOCKED` with the reason (`base-persona.md` § Evidence Integrity), never a simulation that goes green.
  - Refines "Prefer real code; mock only true external boundaries" above (convention #8): mocking nothing is not testing the product.
- Stack execution contracts (e.g. `dotnet-backend-patterns`) take precedence over the boundary list above where they conflict — e.g. on .NET, integration tests never mock the database.
- **Negative-half proof — no gate or test is trusted until it has been observed FAILING on a deliberate violation.** This is RED applied to everything that renders a verdict, including checks that are not TDD output: a lint or contract-check script, an accessibility scan, a state-matrix assertion, a CI job. Introduce the violation the gate exists to catch, run it, capture the non-zero exit or failure output, revert, and record that capture alongside the passing run. Until then, a hollow assertion and a real one are indistinguishable — both are green. (Failure modes and rationale: [deep dive](references/tdd-deep-dive.md).)
- **Permanent regression test for permanent invariants**: a hard invariant or Must-Have NFR that must hold permanently (a stable wire/serialization format, byte-for-byte compatibility, a public-API surface) MUST be covered by a PERMANENT automated regression test committed to the suite. A throwaway harness may supplement, never replace it — this overrides any plan or checklist step that says "manual check", "temporary check", or "verify once".
- **Mock Fidelity Rule**: a mock is derived from the authoritative contract, never authored from the consumer's expectations.
  - **Shape**: the mocked return matches the **post-middleware/post-interceptor** structure the application actually receives at runtime, not the raw HTTP envelope.
  - **Field identity**: field names, casing, nullability, and nesting come from the contract artifact — the API spec, schema, or frozen interface definition; every mocked field must trace back to it. Type the contract boundary from the contract too — no `any`, no untyped destructuring.
  - **Fixture identity**: the rule covers **seeded state**, not only mocked responses. Any fixture pre-populating application state (auth storage-state, cookies, cached entities, feature flags) derives its storage mechanism *and* its exact keys from the application's own accessor code, never from the test framework's default idiom.
  - No contract artifact? Capture one real response first and derive the mock from that. "I read the calling code and matched it" is the failure mode, not the method. (Why field identity bites: [testing anti-patterns](references/testing-anti-patterns.md).)
- **Closed-set assertions pin exact cardinality and membership**: asserting anything about a set meant to be closed — an exemption or allowlist, a route table, enum members, registered handlers or providers, a public export surface — assert its **exact length and exact members** (`=== n` plus the membership check), NEVER `<=`, `>=`, or "contains".
- **A feature is not done until a test reaches it through its real composition root** (the composition-root rule). Register new units where the application actually resolves them — route table, DI container, module export, plugin/handler registry — and the test that authorizes the feature must arrive through that entry point, not by importing the unit directly.

### Verification Checklist

Before marking work complete:

- [ ] Every behavior from the requirements has a corresponding test
- [ ] Watched each test fail before implementing, and it failed for the expected reason
- [ ] Every gate or check script authored or touched has been observed failing on a deliberate violation, with the failure output captured (negative-half proof)
- [ ] Wrote minimal code to pass each test
- [ ] All tests pass (`GREEN`), output pristine (no errors, warnings)
- [ ] No test depends on another test's state or execution order
- [ ] Tests use real code; mocks only at true external boundaries
- [ ] Test names describe behavior, not implementation
- [ ] Edge cases and errors covered

Can't check all boxes? You skipped TDD. Start over.

### Escalate When

- Repo has no test infrastructure → do NOT silently skip verification and do NOT unilaterally drop TDD. The manager sets the verification standard in the briefing; absent test infra it degrades to build-success plus public-API-surface invariance (no unintended signature/contract changes), never "no verification". No standard in the briefing → escalate for one before writing code.
- 3 consecutive RED-RED cycles (can't reach GREEN) → halt and report to manager.
- Unclear requirement makes it impossible to define expected behavior → ask manager.

## Deep Dive

Read these on demand — not needed to execute the contract above:

- [TDD deep dive](references/tdd-deep-dive.md) — worked RED/GREEN examples, the Red-Green-Refactor diagram, "Why Order Matters", the Common Rationalizations table, red flags, a bug-fix walkthrough, when-stuck guidance, and rule rationale (negative-half proof, closed-set assertions, composition root).
- [Testing anti-patterns](references/testing-anti-patterns.md) — read when adding mocks or test utilities: testing mock behavior, test-only methods in production, incomplete mocks, mocking without understanding dependencies, and mock-fidelity rationale.
Pliki w paczce (4)
  • SKILL.md 10 KB
  • references/quinn-test-procedure.md 3 KB
  • references/tdd-deep-dive.md 11 KB
  • references/testing-anti-patterns.md 9 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · muhammadshaharyarnaeem/blackgoat-agentskills100MIT
GanyuanRan/Aegis100MIT
lucasouzadev/agent-kit-skill100MIT
zeative/satgas100AGPL-3.0
nikospavlopoulos/devops-mutant-powers100MIT
JohnStrunk/CommonCast100LGPL
Sanit-mann/The-Insectoids100MIT
mastro993/fstack100MIT
jelvodev/yaap100MIT

Migawka bazy z 13.11.2026 · wersja paczki f72fbb7e8a0e (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100code-review-and-quality
    Prowadzi wieloosiowy code review jako wewnętrzny kontrakt wykonawczy zespołu agentów, wywoływany także bezpośrednio dla wskazanych plików.
  • 100source-driven-development
    Opiera decyzje implementacyjne na oficjalnej dokumentacji i służy agentom zespołu jako wewnętrzny kontrakt wykonawczy.
  • 100tdd
    Prowadzi pracę test-first w cyklu czerwony, zielony, refaktoryzacja, przy nowych funkcjach i poprawkach błędów.
  • 100tdd
    Prowadzi pracę test-first w cyklu czerwony, zielony, refaktoryzacja, przy nowych funkcjach i poprawkach błędów.
  • 100tdd
    Prowadzi pracę test-first w cyklu czerwony, zielony, refaktoryzacja, przy nowych funkcjach i poprawkach błędów.
  • 100tdd
    Prowadzi pracę test-first w cyklu czerwony, zielony, refaktoryzacja, przy nowych funkcjach i poprawkach błędów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.