test-driven-development
/test-driven-development
Prowadzi TDD z workflow red-green-refactor: testy najpierw, odtwarzanie błędów padającym testem, asercje o zachowaniu i bezpieczna refaktoryzacja kodu pod testami.
- Autor
- pantheon-org ↗
- Repozytorium
- tekhne ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 21.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 81
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 2
Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Prowadzi TDD z workflow red-green-refactor: testy najpierw, odtwarzanie błędów padającym testem, asercje o zachowaniu i bezpieczna refaktoryzacja kodu pod testami.
Wyzwalacze z opisu
Oryginalny opis (EN)
Guides TDD (test-driven development) with red-green-refactor workflows, test-first feature delivery, bug reproduction through failing tests, behavior-focused assertions, and refactoring safety. Use when writing unit tests, implementing new functions, adding test coverage, fixing regressions, changing APIs, or restructuring code under test — especially when a user says "write tests first", "TDD", or "test before code".
Jak działa
- When to Use
- When Not to Use
- Scope
- Workflow
- Quick Commands
- Anti-Patterns
- Verification
- References
Podgląd SKILL.md
---
name: test-driven-development
description: Guides TDD (test-driven development) with red-green-refactor workflows, test-first feature delivery, bug reproduction through failing tests, behavior-focused assertions, and refactoring safety. Use when writing unit tests, implementing new functions, adding test coverage, fixing regressions, changing APIs, or restructuring code under test — especially when a user says "write tests first", "TDD", or "test before code".
---
# Test-Driven Development
Navigation hub for applying TDD in day-to-day implementation work.
## When to Use
- "Write tests first for this feature."
- "How should I do red-green-refactor here?"
- "I need to reproduce a bug with a failing test first."
- "I want to refactor safely while preserving behavior."
## When Not to Use
- End-to-end scenario design across full systems.
- Performance benchmarking and load testing.
- Security testing workflows.
## Scope
### In Scope
- Unit test design and behavior-driven assertions.
- Red-Green-Refactor cycle execution.
- Mock/stub isolation strategy.
- Naming and organization conventions for maintainable tests.
### Out of Scope
- Full E2E harness setup and browser automation pipelines.
- Infra-only test framework bootstrapping.
- Non-deterministic perf profiling.
## Workflow
1. Write the smallest failing test that expresses one behavior.
2. Run tests and verify failure is for the expected reason.
3. Implement minimal code to make the test pass.
4. Refactor while keeping the suite green.
5. Repeat for next behavior/edge case.
### Example: Red-Green-Refactor Cycle (TypeScript)
**RED — write the failing test first:**
```typescript
// add.test.ts
import { add } from "./add";
test("add returns the sum of two numbers", () => {
expect(add(2, 3)).toBe(5);
});
// ❌ Fails: cannot find module './add'
```
**GREEN — implement the minimum code to pass:**
```typescript
// add.ts
export function add(a: number, b: number): number {
return a + b;
}
// ✅ Test passes
```
**REFACTOR — improve without breaking green:**
```typescript
// add.ts — no logic change needed here, but you might rename,
// extract constants, or improve types while the suite stays green.
export const add = (a: number, b: number): number => a + b;
// ✅ Still green
```
### Example: Elixir variant
```elixir
# test/math_test.exs (RED)
test "add/2 returns the sum" do
assert Math.add(2, 3) == 5
end
# lib/math.ex (GREEN)
defmodule Math do
def add(a, b), do: a + b
end
```
## Quick Commands
```bash
# Run full suite
bun test
```
```bash
# Watch mode while iterating
bun test --watch
```
```bash
# Run a specific file
bun test path/to/file.test.ts
```
```bash
# Elixir variant
mix test
```
## Anti-Patterns
### NEVER implement feature code before writing a failing test
WHY: skipping RED phase removes behavior-first design pressure.
```typescript
// BAD: production code written first, test added after
export function greet(name: string) { return `Hello, ${name}!`; }
// ... then test written to match existing impl
// GOOD: test written first, impl follows
test("greet returns a personalised greeting", () => {
expect(greet("Ada")).toBe("Hello, Ada!");
});
// ❌ red → write greet() → ✅ green
```
### NEVER test implementation details instead of behavior
WHY: implementation-coupled tests break during valid refactors.
```typescript
// BAD: asserting internal call sequence
expect(mockFormatter.format).toHaveBeenCalledBefore(mockLogger.log);
// GOOD: assert observable output
expect(result).toBe("Hello, Ada!");
```
### NEVER combine multiple behaviors into one test case
WHY: failures become ambiguous and debugging slows down.
```typescript
// BAD: one test covers create/login/update/delete flow
test("user lifecycle", () => { /* 40 lines */ });
// GOOD: one behavior per test
test("createUser returns a user with the given name", () => { ... });
test("login returns a session token for valid credentials", () => { ... });
```
### NEVER use arbitrary sleeps in unit tests
WHY: fixed waits create flaky and slow suites.
```typescript
// BAD
await sleep(1000);
expect(result).toBeDefined();
// GOOD: synchronize with deterministic signals
await expect(promise).resolves.toBeDefined();
```
## Verification
```bash
# Evaluate skill quality
pantheon-skill-auditor evaluate test-driven-development --json
```
```bash
# Lint this skill docs
rumdl check skills/test-driven-development
```
## References
| Topic | Reference |
| --- | --- |
| Red-Green-Refactor cycle | [references/cycle-write-test-first.md](references/cycle-write-test-first.md) |
| Verify failing tests first | [references/cycle-verify-test-fails-first.md](references/cycle-verify-test-fails-first.md) |
| AAA and behavior-first design | [references/design-aaa-pattern.md](references/design-aaa-pattern.md) |
| Avoid implementation-detail tests | [references/design-test-behavior-not-implementation.md](references/design-test-behavior-not-implementation.md) |
| Isolation and dependency injection | [references/isolate-use-dependency-injection.md](references/isolate-use-dependency-injection.md) |
| Flakiness and speed | [references/perf-fix-flaky-tests.md](references/perf-fix-flaky-tests.md) |
- [Kent Beck - Test Driven Development](https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530)
- [Testing Implementation Details (Kent C. Dodds)](https://kentcdodds.com/blog/testing-implementation-details)
Pliki w paczce (81)
- CHANGELOG.md 1 KB
- SKILL.md 5 KB
- .audits/latest 1 KB
- .audits/2026-02-21/analysis.md 8 KB
- .audits/2026-02-21/audit.json 1 KB
- .audits/2026-02-21/remediation-plan.md 1 KB
- .audits/2026-02-22/analysis.md 8 KB
- .audits/2026-02-22/audit.json 1 KB
- .audits/2026-02-22/remediation-plan.md 1 KB
- .audits/2026-02-23/analysis.md 8 KB
- .audits/2026-02-23/audit.json 1 KB
- .audits/2026-02-23/remediation-plan.md 1 KB
- .audits/2026-03-02/analysis.md 1 KB
- .audits/2026-03-02/audit.json 1 KB
- .audits/2026-03-02/remediation-plan.md 2 KB
- .audits/2026-10-02/Analysis.md 1 KB
- .audits/2026-10-02/Remediation.md 1 KB
- .audits/2026-10-02/audit.json 1 KB
- .audits/2026-10-03/Analysis.md 1 KB
- .audits/2026-10-03/Remediation.md 1 KB
- .audits/2026-10-03/audit.json 1 KB
- .tekhne/plugin.json 1 KB
- evals/instructions.json 3 KB
- evals/summary.json 1 KB
- evals/scenario-1/capability.txt 1 KB
- evals/scenario-1/criteria.json 4 KB
- evals/scenario-1/task.md 1 KB
- evals/scenario-2/capability.txt 1 KB
- evals/scenario-2/criteria.json 4 KB
- evals/scenario-2/task.md 1 KB
- evals/scenario-3/capability.txt 1 KB
- evals/scenario-3/criteria.json 4 KB
- evals/scenario-3/task.md 1 KB
- evals/scenario-4/capability.txt 1 KB
- evals/scenario-4/criteria.json 4 KB
- evals/scenario-4/task.md 2 KB
- evals/scenario-5/capability.txt 1 KB
- evals/scenario-5/criteria.json 4 KB
- evals/scenario-5/task.md 2 KB
- references/assert-custom-matchers.md 2 KB
- references/assert-error-messages.md 2 KB
- references/assert-no-assertions-antipattern.md 2 KB
- references/assert-snapshot-testing.md 2 KB
- references/assert-specific-assertions.md 2 KB
- references/cycle-maintain-test-list.md 2 KB
- references/cycle-minimal-code-to-pass.md 2 KB
- references/cycle-refactor-after-green.md 2 KB
- references/cycle-small-increments.md 2 KB
- references/cycle-verify-test-fails-first.md 2 KB
- references/cycle-write-test-first.md 2 KB
- references/data-avoid-mystery-guests.md 2 KB
- references/data-builder-pattern.md 3 KB
- references/data-minimal-setup.md 2 KB
- references/data-unique-identifiers.md 2 KB
- references/data-use-factories.md 2 KB
- references/design-aaa-pattern.md 2 KB
- references/design-avoid-logic-in-tests.md 2 KB
- references/design-descriptive-test-names.md 2 KB
- references/design-one-assertion-per-test.md 2 KB
- references/design-test-behavior-not-implementation.md 2 KB
- references/design-test-edge-cases.md 2 KB
- references/isolate-deterministic-tests.md 2 KB
- references/isolate-mock-external-dependencies.md 2 KB
- references/isolate-no-shared-state.md 2 KB
- references/isolate-prefer-stubs-over-mocks.md 2 KB
- references/isolate-use-dependency-injection.md 2 KB
- references/org-file-structure.md 2 KB
- references/org-group-by-behavior.md 2 KB
- references/org-parameterized-tests.md 2 KB
- references/org-setup-teardown.md 2 KB
- references/org-test-utilities.md 2 KB
- references/perf-avoid-network-calls.md 2 KB
- references/perf-avoid-sleep.md 2 KB
- references/perf-fast-unit-tests.md 2 KB
- references/perf-fix-flaky-tests.md 2 KB
- references/perf-parallelize-tests.md 2 KB
- references/strat-coverage-targets.md 2 KB
- references/strat-e2e-critical-paths.md 2 KB
- references/strat-integration-boundaries.md 2 KB
- references/strat-mutation-testing.md 2 KB
- references/strat-test-pyramid.md 2 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · pantheon-org/tekhne | 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 4b566940f4f9 (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
- 100red-green-refactor
Prowadzi przez cykl TDD red-green-refactor: najpierw test, który pada, potem minimalny kod przechodzący test i refaktoryzacja przy zielonych testach. - 100054-design-tdd
Prowadzi zmiany w Javie metodą TDD: najpierw test, który nie przechodzi, potem minimalny kod i refaktoryzacja. - 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.