Skip to content
Back to skills

Principles

ASecurity

Test design WHY (Beck, Khorikov): TDD, four pillars, refactoring resistance, Classical vs London, test doubles, observable behavior, Humble Object, test pyramid, integration/property/characterization, output/state/communication tests, coverage, legacy code, anti-patterns. Use when 'should I mock this', 'red green refactor'. Not for running tests.

  • 34 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 2, 2026
ai-agentsrustgoexpresstestingrefactoringdatabase

Security analysis

A100/100

Pro scans all 15 files and shows the line behind each finding

Scanned November 28, 2026

npx -y skills add melodic-software/claude-code-plugins --skill principles --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Principles?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Principles
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/melodic-software-principles-claude-code-plugins/badge)](https://www.skillsdirectory.com/skills/melodic-software-principles-claude-code-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: "Test design WHY (Beck, Khorikov): TDD, four pillars, refactoring resistance, Classical vs London, test doubles, observable behavior, Humble Object, test pyramid, integration/property/characterization, output/state/communication tests, coverage, legacy code, anti-patterns. Use when 'should I mock this', 'red green refactor'. Not for running tests."
argument-hint: "[question or concept]"
user-invocable: true
disable-model-invocation: false
metadata:
  workflow-stage: test
  summary: Answer test design questions from authoritative TDD sources
---

# TDD Knowledge Base

The Beck and Khorikov files are distilled from cover-to-cover reading of those books. Two files are not: [property-based-testing.md](reference/property-based-testing.md) and [characterization-testing.md](reference/characterization-testing.md) are built from web sources, listed separately under [Sources](#sources). Reference files in `reference/` have author-attributed sections with synthesis where authors overlap.

## Routing Table

| Query about... | Load |
|---|---|
| TDD cycle, red-green-refactor, when/why TDD, step size, courage, stress, fear | [methodology-beck.md](reference/methodology-beck.md) |
| What makes a good test, what to test, 3A, Fixture, test naming, parameterized tests | [test-design.md](reference/test-design.md) |
| Mocks, stubs, fakes, mock/stub taxonomy, CQS connection, 5 mocking best practices | [test-doubles.md](reference/test-doubles.md) |
| Refactoring safely, design patterns in TDD, Humble Object, four types of code | [refactoring-under-test.md](reference/refactoring-under-test.md) |
| Four Pillars of a good test, brittle tests, false positives, resistance to refactoring | [four-pillars-khorikov.md](reference/four-pillars-khorikov.md) |
| Code coverage metrics, branch vs statement, goal of unit testing | [code-coverage-khorikov.md](reference/code-coverage-khorikov.md) |
| Classical vs London school, dependency taxonomy, shared/private/out-of-process | [classical-vs-london-khorikov.md](reference/classical-vs-london-khorikov.md) |
| Observable behavior, implementation details, hexagonal architecture, encapsulation | [observable-behavior-khorikov.md](reference/observable-behavior-khorikov.md) |
| Output/state/communication styles, functional architecture, functional core | [testing-styles-khorikov.md](reference/testing-styles-khorikov.md) |
| Four types of code 2x2, Humble Object, CRM refactoring, CanExecute/Execute, domain events, preconditions | [testable-architecture-khorikov.md](reference/testable-architecture-khorikov.md) |
| Integration tests, managed vs unmanaged deps, Test Pyramid, database testing, logging, interfaces, reads vs writes | [integration-testing-khorikov.md](reference/integration-testing-khorikov.md) |
| Anti-patterns: private methods, exposing state, domain knowledge, code pollution, time | [anti-patterns-khorikov.md](reference/anti-patterns-khorikov.md) |
| Beck's Money example, Value Object, Expression metaphor, Factory Method | [money-example-beck.md](reference/money-example-beck.md) |
| Beck's xUnit example, bootstrap, Template Method, Composite, Collecting Parameter | [xunit-example-beck.md](reference/xunit-example-beck.md) |
| Property-based testing: properties as specification, property patterns, properties beside example tests, agent-written properties | [property-based-testing.md](reference/property-based-testing.md) (web-sourced) |
| Legacy code, characterization tests, code that cannot be put in a test harness yet, seam types, Strangler Fig, sabotage check, pins prove sameness not correctness | [characterization-testing.md](reference/characterization-testing.md) (web-sourced) |

Load the most relevant file first. Load a second only if the first doesn't fully answer.

**Quick decision guide** (no file load needed):

- "Should I write a test for this?" → Yes, unless it's third-party code you trust or trivial code (bottom-left quadrant of the 2x2 matrix: low complexity, few collaborators)
- "Should I mock this?" → Only if it's an unmanaged dependency (message bus, SMTP). Use real instances for managed deps (database)
- "Fake It or Obvious Implementation?" → If confident, Obvious. If surprised by red, back off to Fake It
- "Is this test too big?" → If it needs >3 changes to work, write a smaller Child Test first
- "Test before or after?" → Before. Always. "You won't test after"
- "Output, state, or communication test?" → Output-based first. State-based second. Communication-based only for inter-system with visible side effects
- "Is this code testable?" → Check the 2x2 matrix. High complexity + many collaborators = split it (Humble Object)
- "Should I introduce an interface?" → Only for unmanaged deps you need to mock. Concrete classes for managed deps. Never for in-process deps
- "Should I test this precondition?" → Yes if it has domain significance (e.g., non-negative employees). No if it's purely technical (array length check)
- "Should I test this read operation?" → Higher threshold than writes. Writes corrupt data, so always test. Reads: only the most complex/important ones
- "Domain event or direct call?" → Use domain events when the domain model needs to trigger external notifications without depending on out-of-process deps
- "Why is my test brittle?" → It's probably coupled to implementation details. Check: are you asserting on observable behavior or internal structure?

## Sources

- **Beck**: Kent Beck, *Test-Driven Development: By Example* (2003)
- **Khorikov**: Vladimir Khorikov, *Unit Testing: Principles, Practices, and Patterns* (2020)
- **Ousterhout** (secondary, cross-referenced only): John Ousterhout, *A Philosophy of Software Design*, cited in one editorial-synthesis section of [test-doubles.md](reference/test-doubles.md)
- **Mutation-testing literature** (secondary, cross-referenced only): the primary sources on mutation testing, cited in one clearly-labeled editorial note in each of [code-coverage-khorikov.md](reference/code-coverage-khorikov.md) and [four-pillars-khorikov.md](reference/four-pillars-khorikov.md), where a claim of Khorikov's has a measurable partial exception he does not cover. Both notes are marked as outside his text and leave his claim standing. The material itself is owned by `/mutation-testing:principles` (if enabled); without it, each note carries its own one-line fallback.

### Web-sourced references (not book readings)

These two files were built from web pages and papers' abstract and HTML pages read on 2026-10-06,
not from reading a book. Each file lists its sources with read depth and a recheck
trigger; this list is rechecked when either file's trigger fires.

- [property-based-testing.md](reference/property-based-testing.md): Maaz et al. (arXiv
  2510.09907, NeurIPS 2025 workshop paper); Vikram et al. (arXiv 2307.04346); PROBE (ACL 2026
  Findings). No property-based testing book was read.
- [characterization-testing.md](reference/characterization-testing.md): Michael Feathers' 2016
  "Characterization Testing" page; of his book *Working Effectively with Legacy Code*, only the
  publisher's sample chapter 4 and preface; Mark Seemann's 2025 "Empirical characterization
  testing" post; Martin Fowler's "Strangler Fig" page.

## Naming convention

- `{concept}.md` is shared across authors, with attributed sections inside
- `{concept}-{author}.md` is used when only one author covers it substantively

## Next

`/testing:write`

Puts the test-design reasoning into the tests themselves.

## Related

- Expected-value provenance and test-value taxonomy: /testing:test-value.
- Mutation-testing principles and coverage limits: /mutation-testing:principles.

## What this skill does not do

This skill is **knowledge** (WHY behind testing decisions), not **workflow** (HOW to run tests). For running, filtering, or scaffolding tests, use your project's own test tooling, conventions, and workflow skills. This skill informs the design decisions those workflows execute.

Files in this skill

  • SKILL.md6.3 KB
  • reference/anti-patterns-khorikov.md10.3 KB
  • reference/classical-vs-london-khorikov.md8.3 KB
  • reference/code-coverage-khorikov.md7.9 KB
  • reference/four-pillars-khorikov.md7 KB
  • reference/integration-testing-khorikov.md20 KB
  • reference/methodology-beck.md8.7 KB
  • reference/money-example-beck.md7.1 KB
  • reference/observable-behavior-khorikov.md10.1 KB
  • reference/refactoring-under-test.md6.3 KB
  • reference/test-design.md13 KB
  • reference/test-doubles.md8.2 KB
  • reference/testable-architecture-khorikov.md13.9 KB
  • reference/testing-styles-khorikov.md16 KB
  • reference/xunit-example-beck.md5.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.