Unit Test Design
Single-unit tests, isolation via mocks/stubs, Arrange-Act-Assert pattern, one assertion per test.
Install
/plugin marketplace add sethdford/claude-skillsThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add sethdford/claude-skills --skill unit-test-designgit clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/engineer/testing/skills/unit-test-design ~/.claude/skills/unit-test-designPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# 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 1. **Identify Unit**: What single behavior are you testing? One method or small class 2. **Mock Dependencies**: Replace real database, HTTP, file I/O with mocks 3. **Arrange**: Setup test data; prepare mocks 4. **Act**: Call the method under test with inputs 5. **Assert**: Verify output or mock invocations 6. **Name Clearly**: `testShouldReturnUserWhenIdExists` not `test1` 7. **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
Details
- Skill name
unit-test-design- Repository
- sethdford/claude-skills
- Path
engineer/testing/skills/unit-test-design/SKILL.md- License
- MIT
- Repo updated
- 11 March 2026
FAQ
What does the Unit Test Design skill do?
Single-unit tests, isolation via mocks/stubs, Arrange-Act-Assert pattern, one assertion per test.
How do I install the Unit Test Design skill?
Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Unit Test Design popular?
It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.
Related skills
A B Test Design
48sethdford/claude-skills
Design rigorous A/B tests with hypotheses, variants, metrics, and sample size calculations.
A B Test Design Pm
48sethdford/claude-skills
Analytics and experimentation skill for product managers.
Abuse Case Design
48sethdford/claude-skills
Design abuse cases (negative use cases) showing how attackers misuse system features. Use when identifying attacks that exploit intended functionality or business logic flaws.
Usability Test Plan
48sethdford/claude-skills
Design a usability test plan with tasks, success metrics, participant criteria, and facilitation guide. Use when planning moderated or unmoderated usability testing sessions.
Test Strategy Design
48sethdford/claude-skills
Design comprehensive test strategies aligned with project goals, risks, and constraints. Use when planning testing efforts for new projects or major releases.
Use Case Testing
48sethdford/claude-skills
Derive test scenarios from use case specifications to validate end-to-end user workflows including main success, alternate, and exception paths. Use for acceptance testing and requirements validation.
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.