code-quality-plugin/skills/code-test-quality/SKILL.md
Analyze test quality: smells, empty assertions, flaky patterns, coverage gaps. Use when tests are unreliable, coverage is misleading, or after major refactors.
npx skillsauth add laurigates/claude-plugins code-test-qualityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze test suite for quality issues and reliability.
| Use this skill when... | Use something else when... | |---|---| | Test suite passes but bugs still ship | Setting up test framework → /configure:tests | | Coverage numbers are high but quality feels low | Setting up coverage thresholds → /configure:coverage | | Tests are flaky or timing-dependent | Looking for code anti-patterns → /code:antipatterns | | After major refactor, need test health check | Running tests → /test:run |
find . -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*.py" -o -name "*_test.py" -o -name "*_test.go" -o -name "*_test.rs" \) -not -path "*/node_modules/*"find . -maxdepth 2 \( -name "vitest.config.*" -o -name "jest.config.*" -o -name "pytest.ini" -o -name "pyproject.toml" -o -name "conftest.py" \) -type f$1: Path to analyze (defaults to current directory)--focus: Analysis focus — smells (default), coverage, flaky, or allExecute this test quality analysis:
Scan the target path for test files. Categorize by:
Scan test files for these anti-patterns:
Empty tests (Critical):
expect() or assert never calledWeak assertions (High):
expect(result).toBeTruthy() on objects (always passes)assert result without specific value checksassertEqual(len(result), len(result)) (tautologies)Test duplication (Medium):
Missing edge cases (Medium):
Flaky patterns (High):
setTimeout / sleep in testsOverly broad mocks (Medium):
If coverage data is available:
Print categorized results:
Test Quality Report
===================
Test files: N
Test-to-source ratio: N:1
Smells Found:
Critical: N (empty tests, no assertions)
High: N (weak assertions, flaky patterns)
Medium: N (duplication, missing edge cases)
Low: N (style issues)
Top Issues:
1. [file:line] Empty test - "should handle X" has no assertions
2. [file:line] Flaky - uses setTimeout(500) instead of async await
3. [file:line] Weak assertion - toBeTruthy on object (always passes)
Recommendations:
- Add assertions to N empty tests
- Replace N setTimeout calls with proper async patterns
- Add error path tests for N untested handlers
For each finding, provide specific fix guidance:
/configure:tests/configure:coverage| Context | Command |
|---|---|
| Find empty tests (JS) | grep -rn "it\|test" --include="*.test.*" -l then check for assertions |
| Find sleeps in tests | grep -rn "setTimeout\|sleep\|time.sleep" --include="*.test.*" |
| Coverage report (Vitest) | npx vitest run --coverage --reporter=json |
| Coverage report (pytest) | pytest --cov --cov-report=json |
| Quick smell scan | Grep for assertion-free test bodies |
testing
Verify accumulated bug claims at upstream HEAD and dedup against trackers before filing issues. Use when filing upstream reports from backlogs, audit docs, or git-history findings.
documentation
Gate outward-bound text (upstream issues, docs, PR bodies) through isolated haiku fresh-reader critique before publishing. Use when an artifact must survive a reader with zero project context.
tools
Suggest improvements to SKILL.md content, descriptions, or tool config from eval results. Use when raising pass rates, fixing triggering, or iterating on a skill after evaluation.
tools
deadbranch CLI for stale-branch cleanup — dry-run preview, TUI or non-interactive delete, protects main/develop/WIP. Use when asked to clean up branches, prune branches, or remove stale branches.