Principles
Test design WHY (Beck, Khorikov): TDD, four pillars, refactoring resistance, Classical vs London, test doubles, observable behavior, Humble Object, test…
от melodic-software★ 34 звезды на GitHub
Установить Principles в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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 and characterization-testing.md are built from web sources, listed separately under 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 |
| What makes a good test, what to test, 3A, Fixture, test naming, parameterized tests | test-design.md |
| Mocks, stubs, fakes, mock/stub taxonomy, CQS connection, 5 mocking best practices | test-doubles.md |
| Refactoring safely, design patterns in TDD, Humble Object, four types of code | refactoring-under-test.md |
| Four Pillars of a good test, brittle tests, false positives, resistance to refactoring | four-pillars-khorikov.md |
| Code coverage metrics, branch vs statement, goal of unit testing | code-coverage-khorikov.md |
| Classical vs London school, dependency taxonomy, shared/private/out-of-process | classical-vs-london-khorikov.md |
| Observable behavior, implementation details, hexagonal architecture, encapsulation | observable-behavior-khorikov.md |
| Output/state/communication styles, functional architecture, functional core | testing-styles-khorikov.md |
| Four types of code 2x2, Humble Object, CRM refactoring, CanExecute/Execute, domain events, preconditions | testable-architecture-khorikov.md |
| Integration tests, managed vs unmanaged deps, Test Pyramid, database testing, logging, interfaces, reads vs writes | integration-testing-khorikov.md |
| Anti-patterns: private methods, exposing state, domain knowledge, code pollution, time | anti-patterns-khorikov.md |
| Beck's Money example, Value Object, Expression metaphor, Factory Method | money-example-beck.md |
| Beck's xUnit example, bootstrap, Template Method, Composite, Collecting Parameter | xunit-example-beck.md |
| Property-based testing: properties as specification, property patterns, properties beside example tests, agent-written properties | 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 (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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- reference/anti-patterns-khorikov.md
- reference/characterization-testing.md
- reference/classical-vs-london-khorikov.md
- reference/code-coverage-khorikov.md
- reference/four-pillars-khorikov.md
- reference/integration-testing-khorikov.md
- reference/methodology-beck.md
- reference/money-example-beck.md
- reference/observable-behavior-khorikov.md
- reference/property-based-testing.md
- reference/refactoring-under-test.md
- reference/test-design.md
- reference/test-doubles.md
- reference/testable-architecture-khorikov.md
- reference/testing-styles-khorikov.md
- reference/xunit-example-beck.md
FAQ
Что делает скилл Principles?
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.
Как установить скилл Principles?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Principles запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…