Programowanie · Przegląd i audyt
test-driven-development
/test-driven-development
Egzekwuje ścisłe RED-GREEN-REFACTOR bez wyjątków: żaden kod produkcyjny bez wcześniejszego nieudanego testu.
Dla kogo
- Autor
- xbklairith ↗
- Repozytorium
- kisune ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 22.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
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Przestarzałość
Brak sygnałów. Repozytorium zmienione 22.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
Egzekwuje ścisłe RED-GREEN-REFACTOR bez wyjątków: żaden kod produkcyjny bez wcześniejszego nieudanego testu.
Oryginalny opis (EN)
Strict RED-GREEN-REFACTOR enforcement with no exceptions. Use when implementing features or fixing bugs. No production code without a failing test first.
Jak działa
- Overview
- When to Use
- The Iron Law
- Red-Green-Refactor
- Good Tests
- Common Rationalizations
- Red Flags - STOP and Start Over
- Verification Checklist
- When Stuck
- Debugging Integration
Sekcje z nagłówków SKILL.md, w oryginale · 244 linii, 1 124 słów
Podgląd SKILL.md
---
name: test-driven-development
description: Strict RED-GREEN-REFACTOR enforcement with no exceptions. Use when implementing features or fixing bugs. No production code without a failing test first.
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
---
# Test-Driven Development (TDD)
## Overview
Write the test first. Watch it fail. Write minimal code to pass.
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
**Violating the letter of the rules is violating the spirit of the rules.**
## When to Use
**Always:**
- New features
- Bug fixes
- Refactoring
- Behavior changes
**Exceptions (ask your human partner):**
- Throwaway prototypes
- Generated code
- Configuration files
Thinking "skip TDD just this once"? Stop. That's rationalization.
## The Iron Law
```
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
```
Write code before the test? Delete it. Start over.
**No exceptions:**
- Don't keep it as "reference"
- Don't "adapt" it while writing tests
- Don't look at it
- Delete means delete
Implement fresh from tests. Period.
## Red-Green-Refactor
**RED** (write a failing test) → **Verify RED** (watch it fail) → **GREEN** (minimal code) → **Verify GREEN** (all tests pass) → **REFACTOR** (clean up, stay green) → repeat for the next behaviour.
### RED - Write Failing Test
Write one minimal test showing what should happen.
<Good>
```
test "retries failed operations 3 times":
attempts = 0
def operation():
attempts += 1
if attempts < 3: raise Error("fail")
return "success"
result = retry_operation(operation)
assert result == "success"
assert attempts == 3
```
Clear name, tests real behavior, one thing
</Good>
<Bad>
```
test "retry works":
mock = create_mock()
.fails_twice()
.then_returns("success")
retry_operation(mock)
assert mock.call_count == 3
```
Vague name, tests mock not code
</Bad>
**Requirements:**
- One behavior
- Clear name
- Real code (no mocks unless unavoidable)
### Verify RED - Watch It Fail
**MANDATORY. Never skip.**
Run the project's test command targeting the specific test file.
Confirm:
- Test fails (not errors)
- Failure message is expected
- Fails because feature missing (not typos)
**Test passes?** For new behavior, you're testing something that already exists. Fix the test.
**Refactoring?** Here a passing test is the goal. Before moving any structure, write tests that pass on the current code. They pin the behavior the refactor must keep. Type check and lint are not a pin.
**Test errors?** Fix error, re-run until it fails correctly.
### GREEN - Minimal Code
Write simplest code to pass the test.
<Good>
```
def retry_operation(fn, max_retries=3):
for i in range(max_retries):
try:
return fn()
except Error:
if i == max_retries - 1: raise
raise Error("unreachable")
```
Just enough to pass
</Good>
<Bad>
```
def retry_operation(fn, options=None):
# options: max_retries, backoff_strategy, on_retry_callback
# Configurable backoff: linear, exponential
# YAGNI - all of this
```
Over-engineered
</Bad>
Don't add features, refactor other code, or "improve" beyond the test.
### Verify GREEN - Watch It Pass
**MANDATORY.**
Run the project's test command.
Confirm:
- Test passes
- Other tests still pass
- Output pristine (no errors, warnings)
**Test fails?** Fix code, not test.
**Other tests fail?** Fix now.
### REFACTOR - Clean Up
After green only:
- Remove duplication
- Improve names
- Extract helpers
Keep tests green. Don't add behavior.
### Repeat
Next failing test for next feature.
## Good Tests
| Quality | Good | Bad |
|---------|------|-----|
| **Minimal** | One thing. "and" in name? Split it. | `test "validates email and domain and whitespace"` |
| **Clear** | Name describes behavior | `test "test1"` |
| **Shows intent** | Demonstrates desired API | Obscures what code should do |
| **Tests behavior** | Fails when the behavior breaks, passes when only the internals change | Fails after a rename or an internal refactor that changed no behavior |
## Common Rationalizations
| Excuse | Reality |
|--------|---------|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
| "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
| "Existing code has no tests" | You're improving it. Add tests for existing code. |
## Red Flags - STOP and Start Over
- Code before test
- Test after implementation
- Test for new behavior passes immediately (a refactor's pin tests should pass)
- Can't explain why test failed
- Tests added "later"
- Rationalizing "just this once"
- "I already manually tested it"
- "Tests after achieve the same purpose"
- "It's about spirit not ritual"
- "Keep as reference" or "adapt existing code"
- "Already spent X hours, deleting is wasteful"
- "TDD is dogmatic, I'm being pragmatic"
- "This is different because..."
**All of these mean: Delete code. Start over with TDD.**
## Verification Checklist
Before marking work complete:
- [ ] Every new behavior has a test that goes through the public interface
- [ ] Watched each test fail before implementing (refactor: watched the pins pass on the old code)
- [ ] Each new-behavior test failed for expected reason (feature missing, not typo)
- [ ] Wrote minimal code to pass each test
- [ ] All tests pass
- [ ] Output pristine (no errors, warnings)
- [ ] Tests use real code (mocks only if unavoidable)
- [ ] Edge cases and errors covered
Can't check all boxes? You skipped TDD. Start over.
## When Stuck
| Problem | Solution |
|---------|----------|
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
| Test too complicated | Design too complicated. Simplify interface. |
| Must mock everything | Code too coupled. Use dependency injection. |
| Test setup huge | Extract helpers. Still complex? Simplify design. |
## Debugging Integration
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
Never fix bugs without a test.
## Integration with Spec-Driven Workflow
Tasks from `spec-driven-implementation` are already shaped as RED → GREEN → REFACTOR; follow the cycle for each and commit after each phase (`test:`, `feat:`, `refactor:`).
## Final Rule
```
Production code → test exists and failed first
Otherwise → not TDD
```
No exceptions without your human partner's permission.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · xbklairith/kisune | 100 | MIT |
| GanyuanRan/Aegis | 100 | MIT |
| lucasouzadev/agent-kit-skill | 100 | MIT |
| zeative/satgas | 100 | AGPL-3.0 |
| nikospavlopoulos/devops-mutant-powers | 100 | MIT |
| JohnStrunk/CommonCast | 100 | LGPL |
| Sanit-mann/The-Insectoids | 100 | MIT |
| mastro993/fstack | 100 | MIT |
| jelvodev/yaap | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 9320a1228dfa (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
Egzekwuje ścisłe TDD w cyklu czerwony, zielony, refaktoryzacja, przy pisaniu testów jednostkowych i funkcji. - 100tdd
Prowadzi przez test-driven development przy budowie funkcji i naprawie błędów test-first, z testami integracyjnymi i cyklem red-green-refactor. - 100tdd
Prowadzi przez test-driven development przy budowie funkcji i naprawie błędów test-first, z testami integracyjnymi i cyklem red-green-refactor. - 100tdd
Prowadzi przez test-driven development przy budowie funkcji i naprawie błędów test-first, z testami integracyjnymi i cyklem red-green-refactor. - 100tdd
Prowadzi przez test-driven development przy budowie funkcji i naprawie błędów test-first, z testami integracyjnymi i cyklem red-green-refactor. - 100tdd
Prowadzi przez test-driven development przy budowie funkcji i naprawie błędów test-first, z testami integracyjnymi i cyklem red-green-refactor.