Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

tdd-cycle

/tdd-cycle

Narzuca rygor czerwony, zielony, refaktor z obserwowanymi błędami, zwłaszcza gdy test przechodzi podejrzanie za pierwszym razem.

Repozytorium
rcode ↗
Licencja
MIT
Ostatnia zmiana repozytorium
09.11.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
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 09.11.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

Narzuca rygor czerwony, zielony, refaktor z obserwowanymi błędami, zwłaszcza gdy test przechodzi podejrzanie za pierwszym razem.

Oryginalny opis (EN)

Strict red-green-refactor discipline with observed failures. Read when running /tdd, /sparc refinement, or whenever implementing behavior test-first, or when a test passes suspiciously on its first run.

Jak działa

  1. The loop
  2. Choosing the next test
  3. Observed-result contract
  4. Styles
  5. Anti-patterns
Sekcje z nagłówków SKILL.md, w oryginale · 60 linii, 550 słów
Podgląd SKILL.md
---
name: tdd-cycle
description: Strict red-green-refactor discipline with observed failures. Read when running /tdd, /sparc refinement, or whenever implementing behavior test-first, or when a test passes suspiciously on its first run.
---

# The TDD cycle

The value of TDD comes from **watching each test fail for the right reason** before making it pass. A test you never saw fail might be testing nothing.

## The loop

```
pick next behavior → RED (write one test, see it fail on an assertion)
                   → GREEN (minimal code, see it pass)
                   → REFACTOR (clean up with tests green)
                   → repeat
```

### Red
1. Write **one** test for the next small behavior. Name it as a behavior: `rejects passwords shorter than 12 characters`.
2. Run only that test (single-test command, not the whole suite).
3. Read the failure. It must be an **assertion failure about the behavior**:
   - Good: `expected false, received true`; `expected 400, got 200`.
   - Not yet: `Cannot find module`, `X is not a function`, `NameError`, syntax errors. Add the minimum scaffolding (an empty function, a type, an export) and re-run until the failure is the assertion.
4. If it **passes** immediately: either the behavior already exists (delete the test or keep it as characterization, and say so) or the test is wrong (it does not exercise what you think). Find out which before continuing.

### Green
1. Write the least code that makes the test pass. Hardcoding a return value is legitimate when the next test will force generalization.
2. Run the single test, then the file. Do not add behavior no test asks for.

### Refactor
1. Only on green. Remove duplication, improve names, extract functions, in production and test code.
2. Re-run after each change. If red, undo the refactor step rather than debugging forward.

## Choosing the next test

Order: degenerate case (empty, zero, null) → simplest happy path → variations that force generalization (triangulation) → boundaries → error paths → interactions.
When stuck, pick a smaller behavior. If a test needs more than ~10 lines of setup, the design is telling you something: extract a collaborator or a builder.

## Observed-result contract

- Report each red and green with the exact command, exit code, and the relevant failure line.
- Skipped, filtered-out, or unrun tests are **not** success. Check the runner's summary counts: "0 tests ran" is a failure of the harness, not a pass.
- Never write "this should pass now"; run it.
- The final suite run happens **after the last edit**, including refactors and formatting.

## Styles

- **Classicist (Chicago):** real collaborators where cheap; assert on outcomes and state. Default choice; tests survive refactors.
- **Mockist (London):** mock collaborators to drive out interfaces from the outside in; assert on interactions. Useful at boundaries and for designing roles; brittle if overused on internals.
Mix: outside-in with a mock at the boundary you are designing, classicist inside.

## Anti-patterns

- Writing several tests before any implementation.
- Changing the test to match the implementation without a stated reason.
- Testing private functions directly instead of through behavior.
- Assertion-free tests, or asserting only that "no error was thrown" when there is a return value to check.
- Snapshot tests as the only assertion for logic.
- `.only`, `.skip`, retries, or extended timeouts left in.
- Mocking the unit under test, or mocking so much that the test re-states the implementation.

Adapted from ruflo-testgen `tdd-workflow` (MIT, ruvnet) and agentic-qe `strict-tdd` and `tdd-london-chicago` (MIT, Agentic QE Contributors).

Wersje

RepozytoriumWynikLicencja
Ta strona · rudycelekli/rcode100MIT
andreibesleaga/gabbe90CC-BY-4.0

Migawka bazy z 13.11.2026 · wersja paczki f15ea20a9f94 (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

  • 100tdd
    Prowadzi cykl czerwony, zielony, refaktor z obserwowanymi błędami: najpierw failujący test, dopiero potem kod produkcyjny.
  • 100tdd-workflow
    Pisze funkcje i poprawki test-first w cyklu czerwony, zielony, refaktor.
  • 100tdd
    Egzekwuje ścisłe TDD w cyklu czerwony, zielony, refaktoryzacja, przy pisaniu testów jednostkowych i funkcji.
  • 90tdd
    Prowadzi cykl czerwony-zielony-refaktor przy zadaniach, których weryfikacja opiera się na testach, np. w pętli wdrożeniowej.
  • 90tdd-workflow
    Prowadzi znormalizowany cykl TDD: czerwony, zielony, refaktor i weryfikacja, z dbaniem o pokrycie testami i brak regresji.
  • 90tdd-loop
    Prowadzi cykl czerwony, zielony, refaktoryzacja przy dodawaniu zachowania albo naprawie błędu, zaczynając od testu, który nie przechodzi.

Uwagi i zgłoszenia

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