test-quality
Guides strong, effective unit test generation using proven testing techniques. Use when writing unit tests, reviewing test quality, improving existing tests, generating test cases, checking test coverage strength, or when tests exist but may be weak. Triggers on: unit test, test quality, test coverage, write tests, improve tests, review tests, test strength, mutation testing, boundary testing.
Best use case
test-quality is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Guides strong, effective unit test generation using proven testing techniques. Use when writing unit tests, reviewing test quality, improving existing tests, generating test cases, checking test coverage strength, or when tests exist but may be weak. Triggers on: unit test, test quality, test coverage, write tests, improve tests, review tests, test strength, mutation testing, boundary testing.
Teams using test-quality should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/test-quality/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How test-quality Compares
| Feature / Agent | test-quality | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Guides strong, effective unit test generation using proven testing techniques. Use when writing unit tests, reviewing test quality, improving existing tests, generating test cases, checking test coverage strength, or when tests exist but may be weak. Triggers on: unit test, test quality, test coverage, write tests, improve tests, review tests, test strength, mutation testing, boundary testing.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Test Quality Guide Apply these principles when writing or reviewing tests. High line coverage does NOT mean strong tests — tests must verify correctness, not just exercise code paths. ## Principles Checklist When generating tests, systematically apply each technique: ### 1. Boundary Value Analysis (BVA) Test at the edges of valid ranges, not the middle. - Lower bound, upper bound, just past each bound - For `i < 10`: test 0, 9, 10 (and optionally -1) - For strings: empty string, single char, max length, max+1 ### 2. Equivalence Partitioning Group inputs into classes that should behave identically. Test one representative per class. - Valid vs invalid partitions - Reduces redundant tests while maintaining coverage ### 3. Decision Table Testing For combinatorial logic (multiple conditions → different outcomes): - Enumerate all condition combinations - Especially important for business rules with compound conditions - AI frequently misses edge combos — be exhaustive ### 4. State Transition Testing For stateful code (workflows, FSMs, connection pools): - Test all valid state transitions - Test INVALID transitions — verify they're rejected - Test sequences: what happens after multiple transitions? ### 5. Error Path Testing — AI's Biggest Blind Spot Explicitly test every failure mode: - Null/undefined/empty inputs - Malformed data (wrong types, invalid formats) - Timeouts and network failures - Permission denied / authorization failures - Resource exhaustion (full disk, OOM) - Concurrent access / race conditions - Empty collections, single-element collections ### 6. Property-Based Testing Define invariants that must ALWAYS hold, let the framework generate inputs: - `sort(x)` output is always ordered and same length - `encode(decode(x)) == x` (roundtrip) - `f(x) >= 0` for all valid x (domain constraints) Tools by language: - Python: `hypothesis` - JS/TS: `fast-check` - Java: `jqwik` - Rust: `proptest` ### 7. Assertion Quality Every test MUST verify something meaningful: - BAD: call function, assert no exception → proves nothing - BAD: assert result is not null → barely proves anything - GOOD: assert specific return value matches expected - GOOD: assert side effects occurred (DB write, API call, event emitted) - GOOD: assert error type AND message for failure cases ### 8. AAA Pattern Structure every test as: Arrange → Act → Assert - One logical assertion per test (multiple `assert` calls are fine if testing one behavior) - Test name describes the behavior being verified ### 9. Test Behavior, Not Implementation - Test the public contract / API surface - If mocking 3+ internal methods, the test is too coupled - Refactors should not break tests unless behavior changes ## Mutation Testing After writing tests, recommend running mutation testing to validate test strength: - **JS/TS**: Stryker (`npx stryker run`) - **Python**: mutmut (`mutmut run`) - **Java**: PIT (`mvn org.pitest:pitest-maven:mutationCoverage`) - **Rust**: cargo-mutants (`cargo mutants`) A mutation score below 60% with high line coverage = weak tests. ## When Writing New Tests 1. Identify the function/module under test 2. List input partitions (valid classes, invalid classes) 3. For each partition, identify boundaries 4. Write happy path tests with specific assertions 5. Write error path tests for every failure mode 6. Consider: are there invariants suitable for property-based tests? 7. Check: would a mutation (flipping `<` to `<=`, removing a line) be caught? ## When Reviewing Existing Tests Flag these weaknesses: - Tests that call code without meaningful assertions - Missing boundary values - No error/failure path tests - Over-mocking (testing mocks, not behavior) - Redundant tests in the same equivalence class ## Test Strength Summary After generating or reviewing tests, output a brief summary: ``` Test Strength: - Boundaries: [covered/partial/missing] — list any gaps - Error paths: [covered/partial/missing] — list untested failures - Assertion quality: [strong/moderate/weak] - Property-based candidates: [yes/no] — suggest if applicable - Mutation resilience: [likely high/moderate/likely low] ```
Related Skills
workflow-review
Reviews Claude Code sessions and proposes workflow improvements. Use when: (1) /workflow-review command, (2) "review my workflow", "how can I improve", (3) after long sessions when nudged, (4) start of session with pending review. Analyzes tool usage patterns, CLAUDE.md configuration, and compares against CC best practices. Proposes: CLAUDE.md updates, new skills, underused CC features. Saves session summaries to .claude/workflow-reviews/ for cross-session continuity.
voice-mode
Activates voice conversation mode using Pocket TTS Docker container. Use when user says "voice mode", "let's talk", "talk to me", "speak your responses", or wants Claude to respond with spoken audio. Speaks all responses through TTS and plays via speakers.
pr-review
Reviews code changes before merging. Use when reviewing PRs, checking staged changes, reviewing diffs, code review, merge readiness check, or validating changes before commit/push.
latex-presentation
Creates impressive LaTeX Beamer presentations with modern design. Generates .tex files with theme selection, font pairing, TikZ diagrams, overlays, and best practices. Use for LaTeX slides, Beamer presentations, scaffolding decks, slide design advice, or TikZ diagram generation.
git-commit
Plans and executes git commits with optional TICKET_ID prefix. Analyzes staged changes, proposes optimal commit structure (single or multiple), generates descriptive messages with technical context, and executes after user approval. Use when committing code changes, creating atomic commits, or splitting large changesets.
ctask
Manages tasks using the ctask CLI wrapper over a local SQLite database. Use when tracking work items, creating tasks, managing dependencies, adding comments, labeling, or reviewing task status. Triggers on task tracking, ticket management, work planning, backlog management.
codex
AI peer review via OpenAI Codex CLI. Use when reviewing code changes, validating technical decisions, comparing implementation approaches, or getting a second opinion on architecture choices. Triggers on /codex, /codex-review, or auto-triggers when presenting significant alternatives to user.
codemap
Generate navigational codebase maps with architecture diagrams. Use when mapping a codebase, creating architecture docs, visualizing project structure, generating infrastructure diagrams, understanding repo layout, or onboarding to a new project.
clarice
Conducts realistic mock interviews with detailed feedback and scoring. Use for interview prep, behavioral questions, technical interviews, STAR practice, system design interviews, or interview coaching.
c7
Fetches up-to-date library documentation from Context7 and saves to /tmp/context7/. Use when needing current API docs, code examples, library references, SDK documentation, or checking latest library versions. Triggers: context7, c7, library docs, fetch docs, current documentation, api reference.
swe-developing-e2e-test-with-playwright
Playwright E2E testing standards from authoritative docs/explanation/software-engineering/automation-testing/tools/playwright/ documentation
docs-applying-content-quality
Universal markdown content quality standards for active voice, heading hierarchy, accessibility compliance (alt text, WCAG AA contrast, screen reader support), and professional formatting. Essential for all markdown content creation across docs/, web sites, plans/, and repository files. Auto-loads when creating or editing markdown content.