
test-quality-analysis
Test quality analysis skill that flags overmocking, flaky tests, weak assertions, and coverage gaps.
- version
- 3.12.0
- GitHub stars
- 250
What it does
- Adds a
test-quality-analysisskill that detects test smells, overmocking, flaky tests, and coverage issues - Covers FIRST principles, the AAA pattern, mock usage guidelines, 80%+ coverage goals, and naming conventions
- Flags fragile tests that break on unrelated changes, plus weak or missing assertions in test code
- Designed for code review of test suites and for improving test maintainability and reliability
Detect test smells, overmocking, flaky tests, and coverage issues. Analyze test effectiveness, maintainability, and reliability. Use when reviewing tests or improving test quality.
Add marketplace
/plugin marketplace add secondsky/claude-skillsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install test-quality-analysis@claude-skillsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceTest Quality Analysis
Expert knowledge for analyzing and improving test quality - detecting test smells, overmocking, insufficient coverage, and testing anti-patterns.
Core Dimensions
- Correctness: Tests verify the right behavior
- Reliability: Tests are deterministic, not flaky
- Maintainability: Tests are easy to understand
- Performance: Tests run quickly
- Coverage: Tests cover critical code paths
- Isolation: Tests don't depend on external state
Test Smells
Overmocking
Problem: Mocking too many dependencies makes tests fragile.
// ❌ BAD: Overmocked
test('calculate total', () => {
const mockAdd = vi.fn(() => 10)
const mockMultiply = vi.fn(() => 20)
// Testing implementation, not behavior
})
// ✅ GOOD: Mock only external dependencies
test('calculate order total', () => {
const mockPricingAPI = vi.fn(() => ({ tax: 0.1 }))
const total = calculateTotal(order, mockPricingAPI)
expect(total).toBe(38)
})
Detection: More than 3-4 mocks, mocking pure functions, complex mock setup.
Fix: Mock only I/O boundaries (APIs, databases, filesystem).
Fragile Tests
Problem: Tests break with unrelated code changes.
// ❌ BAD: Tests implementation details
await page.locator('.form-container > div:nth-child(2) > button').click()
// ✅ GOOD: Semantic selector
await page.getByRole('button', { name: 'Submit' }).click()
Flaky Tests
Problem: Tests pass or fail non-deterministically.
// ❌ BAD: Race condition
test('loads data', async () => {
fetchData()
await new Promise(resolve => setTimeout(resolve, 1000))
expect(data).toBeDefined()
})
// ✅ GOOD: Proper async handling
test('loads data', async () => {
const data = await fetchData()
expect(data).toBeDefined()
})
Poor Assertions
// ❌ BAD: Weak assertion
test('returns users', async () => {
const users = await getUsers()
expect(users).toBeDefined() // Too vague!
})
// ✅ GOOD: Strong, specific assertions
test('creates user with correct attributes', async () => {
const user = await createUser({ name: 'John' })
expect(user).toMatchObject({
id: expect.any(Number),
name: 'John',
})
})
Analysis Tools
# Vitest coverage (prefer bun)
bun test --coverage
open coverage/index.html
# Check thresholds
bun test --coverage --coverage.thresholds.lines=80
# pytest-cov (Python)
uv run pytest --cov --cov-report=html
open htmlcov/index.html
Best Practices Checklist
Unit Test Quality (FIRST)
- Fast: Tests run in milliseconds
- Isolated: No dependencies between tests
- Repeatable: Same results every time
- Self-validating: Clear pass/fail
- Timely: Written alongside code
Mock Guidelines
- Mock only external dependencies
- Don't mock business logic or pure functions
- Use real implementations when possible
- Limit to 3-4 mocks per test maximum
Coverage Goals
- 80%+ line coverage for business logic
- 100% for critical paths (auth, payment)
- All error paths tested
- Boundary conditions tested
Test Structure (AAA Pattern)
test('user registration', async () => {
// Arrange
const userData = { email: 'user@example.com' }
// Act
const user = await registerUser(userData)
// Assert
expect(user.email).toBe('user@example.com')
})
Code Review Checklist
- Tests verify behavior, not implementation
- Assertions are specific and meaningful
- No flaky tests (timing, ordering issues)
- Proper async/await usage
- Test names clearly describe behavior
- Minimal code duplication
- Critical paths have tests
- Both happy path and error cases covered
Common Anti-Patterns
Testing Implementation Details
// ❌ BAD
const spy = vi.spyOn(Math, 'sqrt')
calculateDistance()
expect(spy).toHaveBeenCalled() // Testing how, not what
// ✅ GOOD
const distance = calculateDistance({ x: 0, y: 0 }, { x: 3, y: 4 })
expect(distance).toBe(5) // Testing output
Mocking Too Much
// ❌ BAD
const mockAdd = vi.fn((a, b) => a + b)
// ✅ GOOD: Use real implementations
import { add } from './utils'
// Only mock external services
const mockPaymentGateway = vi.fn()
See Also
vitest-testing- TypeScript/JavaScript testingplaywright-testing- E2E testingmutation-testing- Validate test effectiveness
Readme
Test Quality Analysis Skill
Detect test smells, overmocking, flaky tests, and coverage issues.
Overview
Expert guidance for analyzing and improving test quality by identifying anti-patterns, weak assertions, and maintainability issues.
When to Use
- Reviewing test code quality
- Detecting test smells (overmocking, flaky tests)
- Improving test maintainability
- Analyzing test effectiveness
- Code review for test suites
Key Detections
- Overmocking: Too many mocks disconnecting tests from reality
- Fragile Tests: Tests that break with unrelated changes
- Flaky Tests: Non-deterministic test results
- Poor Assertions: Weak or missing verification
- Insufficient Coverage: Missing critical paths
Best Practices Covered
- FIRST principles (Fast, Isolated, Repeatable, Self-validating, Timely)
- AAA pattern (Arrange, Act, Assert)
- Mock usage guidelines
- Coverage goals (80%+)
- Test naming conventions
Auto-Trigger Keywords
- test smells
- test quality
- overmocking
- flaky tests
- test coverage analysis
- test maintainability
- test anti-patterns
Source
Adapted from laurigates/dotfiles
Details
- Marketplace
- secondsky/claude-skills
- Source
- plugins/test-quality-analysis
- Category
- Testing
- Keywords
- test-quality-analysis, test, quality, analysis, testing, tests, unit-tests
- Listed since
- Apr 7, 2026
More from secondsky/claude-skills
All 122- thesys-generative-uiv3.12.0
- threejsv3.12.0
- turborepov3.12.0
- typescript-migrationv3.12.0
- ultracitev3.12.0
- unknowns-discoveryv3.12.0
- vitest-testingv3.12.0
- vulnerability-scanningv3.12.0
- web-performance-auditv3.12.0
- web-performance-optimizationv3.12.0
- websocket-implementationv3.12.0
- woocommerce-backend-devv3.12.0
- woocommerce-code-reviewv3.12.0
- woocommerce-copy-guidelinesv3.12.0
- woocommerce-dev-cyclev3.12.0
- wordpress-plugin-corev3.12.0
- xss-preventionv3.12.0
- zodv3.12.0
- zustand-state-managementv3.12.0
- aceternity-uiv3.12.0
- api-authenticationv3.12.0
- api-changelog-versioningv3.12.0
- api-contract-testingv3.12.0
- api-design-principlesv3.12.0
Similar to test-quality-analysis
More Testing & QA
test-quality-analysisSkillsecondsky/claude-skills474 installsPractical review guide that flags test smells such as overmocking, fragile selectors, flaky async code, and weak assertions.
performance-testing-reviewPluginwshobson/agents42.8K starsPerformance analysis, test coverage review, and AI-powered code quality assessment
test-coveragePluginmahidalhan/claude-hacks34 starsAnalyze and improve test coverage for code changes.
testing-toolkitPluginarmanzeroeight/fastagent-plugins29 starsComprehensive testing toolkit for test strategy, coverage analysis, and test data generation. Includes test strategist agent for planning optimal testing approa
test-auditPlugindashed/claude-marketplace27 starsDecide whether a test earns its place: an authoring gate for new tests (what it protects, which regression fails it, why coverage misses it, no test-only seams,
test-results-analyzerPluginrohitg00/awesome-claude-code-toolkit2.8K starsAnalyze test failures, identify patterns, and suggest targeted fixes