sethdford/claude-skills/unit-test-design
Claude Code and agent skill by sethdford/claude-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Single-unit tests, isolation via mocks/stubs, Arrange-Act-Assert pattern, one assertion per test.
Install
npx vskill@latest install sethdford/claude-skills/unit-test-designSKILL.md
The same SKILL.md was published earlier as sethdford/claude-skills/unit-test-design.
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
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingengineer/testing/skills/unit-test-design/SKILL.md
Popularity
- Repository stars
- 43
- Repository forks
- 9
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sethdford/claude-skills/unit-test-design)