unit-test-design
Single-unit tests, isolation via mocks/stubs, Arrange-Act-Assert pattern, one assertion per test.
от sethdford★ 51 звезда на GitHub
Установить unit-test-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Unit Test Design
Principles for isolated, focused, maintainable unit tests.
Context
You are helping the engineer write unit tests. Design each test to verify one piece of behavior in isolation.
Domain Context
- Isolation: Test one method/class; mock dependencies
- Arrange-Act-Assert: Setup data, execute behavior, verify results
- One Assertion per Test: Focus; easier to understand failure
- Fast: Unit tests run in milliseconds; if slow, you have external dependencies
- Deterministic: Same result every run; no random data, no timing issues
Instructions
- Identify Unit: What single behavior are you testing? One method or small class
- Mock Dependencies: Replace real database, HTTP, file I/O with mocks
- Arrange: Setup test data; prepare mocks
- Act: Call the method under test with inputs
- Assert: Verify output or mock invocations
- Name Clearly:
testShouldReturnUserWhenIdExistsnottest1 - Test Edge Cases: null inputs, empty collections, boundary values
Anti-Patterns
- Tests that test the mock, not the code; mock returns setup values and test verifies setup
- Massive test fixtures with unneeded setup; each test should setup only what it needs
- Multiple assertions per test; when one fails, don't know which behavior broke
- Exposing implementation details; test behavior, not private methods
- Skipping dependency injection in production code to avoid mocking; if hard to test, architecture is wrong
Further Reading
- Roy Osherove, The Art of Unit Testing
- Michael Feathers, Working Effectively with Legacy Code, Part I
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл unit-test-design?
Single-unit tests, isolation via mocks/stubs, Arrange-Act-Assert pattern, one assertion per test.
Как установить скилл unit-test-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unit-test-design запускает скрипты?
Нет, скилл состоит только из инструкций (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…