test-audit
Test coverage analysis to ensure adequate testing, Storybook coverage, and test quality.
от huseyindeniz★ 15 звёзд на GitHub
Установить test-audit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Purpose
Analyze test coverage in your codebase to ensure:
- Adequate test files for business logic (60%+ baseline)
- Storybook stories for UI components (40%+ baseline)
- No incomplete tests (TODO/FIXME/HACK comments)
- Clean test infrastructure
Testing Checks
1. Test Coverage Check
Rule: Maintain at least 60% test coverage baseline for business logic.
Analyzes:
- Total source files vs test files
- Coverage estimate based on file naming
- Untested files list
- Test ratio percentage
Coverage Calculation:
- Looks for
.test.ts(x)or.spec.ts(x)files - Matches test files to source files by naming convention
- Estimates coverage (heuristic, not actual line coverage)
Example:
Coverage Summary
--------------------------------------------------------------------------------
Total source files: 150
Test files: 95 (63%)
Story files: 45 (30%)
Tested files: 105
Untested files: 45
Coverage estimate: ~70%
✅ Test coverage is 70% (>= 60% threshold)
Recommendations:
- Add
.test.ts(x)files for business logic - Focus on critical paths first (auth, payments, etc.)
- Run actual test runner (vitest, jest) for precise coverage
Check: check_test_coverage.mjs
2. Storybook Coverage Check
Rule: Maintain at least 40% story coverage for UI components.
Analyzes:
- Total component files vs story files
- Components without stories
- Story coverage percentage
Detection:
- Looks for files in
components/orui/directories - Matches
.stories.ts(x)files to components - Calculates story coverage ratio
Example:
Story Coverage Summary
--------------------------------------------------------------------------------
Total components: 60
Story files: 28
Components without stories: 32
Story coverage: ~47%
✅ Story coverage is 47% (>= 40% threshold)
Benefits of Storybook:
- Component documentation
- Visual testing and debugging
- Isolated component development
- Design system showcase
Recommendations:
- Add
.stories.ts(x)for reusable UI components - Focus on design system components first
- Document props, variants, and states
Check: check_story_coverage.mjs
3. Test TODOs Check
Rule: Test files should not contain TODO/FIXME/HACK comments.
Why: Incomplete tests indicate gaps in coverage and technical debt.
Detects:
- TODO comments (incomplete tests)
- FIXME comments (broken/flaky tests)
- HACK comments (technical debt)
Violations:
// ❌ WRONG - TODO in test file
test('should handle edge case', () => {
// TODO: Implement this test
});
// ❌ WRONG - FIXME indicates broken test
test('should update user', () => {
// FIXME: This test is flaky
});
// ✅ CORRECT - Complete tests only
test('should handle edge case', () => {
const result = handleEdgeCase(input);
expect(result).toBe(expected);
});
// ✅ CORRECT - Use test.skip for intentionally skipped tests
test.skip('should handle future feature', () => {
// Test for future implementation
});
Impact:
- TODO = incomplete test coverage
- FIXME = known failing/flaky tests
- HACK = technical debt in test infrastructure
Recommendations:
- Complete TODOs before merging
- Fix FIXMEs immediately
- Refactor HACKs
- Use test.skip() for intentionally skipped tests
Check: check_test_todos.mjs
Running Checks
Run All Checks
node ./.claude/skills/test-audit/scripts/run_all_checks.mjs
Run Individual Checks
# Test coverage check
node ./.claude/skills/test-audit/scripts/check_test_coverage.mjs
# Storybook coverage check
node ./.claude/skills/test-audit/scripts/check_story_coverage.mjs
# Test TODOs check
node ./.claude/skills/test-audit/scripts/check_test_todos.mjs
Generating Reports (Optional)
To save a comprehensive markdown report of all checks:
node ./.claude/skills/test-audit/scripts/generate_report.mjs
Output: reports/{YYYY-MM-DD_HH-MM}/test-audit-report.md
Report includes:
- Executive summary with pass/fail counts
- Results table for all checks
- Detailed results for failed checks (collapsible)
- Summary of passed checks
- Testing principles verified
- Prioritized recommendations
Environment variable:
# Custom report directory
export REPORT_DIR="reports/my-custom-timestamp"
node ./.claude/skills/test-audit/scripts/generate_report.mjs
Usage patterns:
# Option 1: Console output only (default)
node ./.claude/skills/test-audit/scripts/run_all_checks.mjs
# Option 2: Console output + Save report
node ./.claude/skills/test-audit/scripts/generate_report.mjs
# Option 3: Specific check only
node ./.claude/skills/test-audit/scripts/check_test_coverage.mjs
Report structure:
reports/
└── 2025-11-01_14-30/ # Includes hours and minutes for multiple runs per day
├── test-audit-report.md # This skill's report
├── security-audit-report.md # S
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- scripts/check_story_coverage.mjs
- scripts/check_test_coverage.mjs
- scripts/check_test_todos.mjs
- scripts/generate_report.mjs
- scripts/run_all_checks.mjs
FAQ
Что делает скилл test-audit?
Test coverage analysis to ensure adequate testing, Storybook coverage, and test quality.
Как установить скилл test-audit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-audit запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…