skills/coverage-analyzer/SKILL.md
Automatically analyze test coverage when user asks which code is tested, mentions coverage gaps, or shows code asking about testing. Identifies untested code paths and suggests test additions. Invoke when user asks "what's not tested?", "coverage", "untested code", or "which tests are missing?".
npx skillsauth add kanopi/cms-cultivator coverage-analyzerInstall 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.
Automatically analyze test coverage and identify untested code.
Knowing what's tested gives confidence to refactor and prevents regressions.
Activate this skill when the user:
Before analyzing coverage, consider:
Check for:
phpunit --coverage-textjest --coveragePrimary metrics:
Priority order:
User asks about coverage
↓
Determine scope (file/component/project)
↓
Check for existing test files
↓
Run coverage tool (PHPUnit/Jest/Cypress)
↓
Analyze gaps (prioritize critical paths)
↓
Report coverage with recommendations
↓
Suggest specific tests for gaps
PHP (PHPUnit):
# Check for test files
find tests/ -name "*Test.php"
# Check specific class
test -f "tests/src/Unit/DataProcessorTest.php" && echo "Tests exist"
JavaScript (Jest):
# Check for test files
find . -name "*.test.js" -o -name "*.spec.js"
PHP:
# Generate coverage report
vendor/bin/phpunit --coverage-text
# For Kanopi projects
ddev exec vendor/bin/phpunit --coverage-text
JavaScript:
# Jest coverage
npm run test -- --coverage
# Or directly
npx jest --coverage
Common untested areas:
## Test Coverage Analysis
### Summary
- **Overall Coverage**: 72%
- **Files Analyzed**: 45
- **Tested**: 32 files
- **Untested**: 13 files
### Coverage by Type
- Classes: 85% (34/40)
- Methods: 68% (156/230)
- Lines: 72% (2,340/3,250)
- Branches: 58% (89/153)
### 🔴 Critical Gaps (No Tests)
**1. PaymentProcessor.php** - 0% coverage
- **Risk**: High - handles money
- **Methods untested**: processPayment(), refund(), validate()
- **Recommendation**: Add unit tests immediately
**2. AuthenticationService.php** - 0% coverage
- **Risk**: Critical - security component
- **Methods untested**: authenticate(), validateToken()
- **Recommendation**: Add security tests ASAP
### 🟡 Partial Coverage
**3. UserManager.php** - 45% coverage
- ✅ Tested: getUser(), createUser()
- ❌ Untested: deleteUser(), updatePermissions()
- **Recommendation**: Add tests for delete and permission methods
### ✅ Well Tested
- DataProcessor.php - 95%
- EmailService.php - 88%
- ValidationHelper.php - 100%
### Suggested Actions
1. **Immediate** (Critical):
- Add tests for PaymentProcessor
- Add tests for AuthenticationService
2. **This Sprint**:
- Complete UserManager tests
- Add integration tests for checkout flow
3. **Next Sprint**:
- Increase overall coverage to 80%
- Add E2E tests for critical paths
## DataProcessor.php Coverage
| Method | Tested? | Coverage | Priority |
|--------|---------|----------|----------|
| processData() | ✅ Yes | 100% | - |
| validateInput() | ✅ Yes | 90% | Low |
| handleError() | ❌ No | 0% | High |
| formatOutput() | ⚠️ Partial | 60% | Medium |
### Untested Code Paths
**handleError() method:**
```php
public function handleError($error) {
// Line 45: No test coverage
if ($error instanceof ValidationException) {
return $this->formatValidationError($error);
}
// Line 49: No test coverage
if ($error instanceof DatabaseException) {
return $this->formatDatabaseError($error);
}
// Line 53: Tested
return $this->formatGenericError($error);
}
Missing test cases:
Suggested test:
public function testHandleValidationException(): void {
$exception = new ValidationException('Invalid input');
$result = $this->processor->handleError($exception);
$this->assertStringContains('validation error', $result);
}
## Integration with /test-coverage Command
- **This Skill**: Quick coverage checks
- "Is this function tested?"
- "What's missing tests?"
- Single file/class analysis
- **`/test-coverage` Command**: Comprehensive coverage analysis
- Full project coverage report
- Trend analysis over time
- CI/CD integration
- Detailed HTML reports
## Coverage Goals
### Industry Standards
- **Minimum**: 70% coverage
- **Good**: 80% coverage
- **Excellent**: 90%+ coverage
**But remember**: 100% coverage ≠ bug-free code
### What to Focus On
**High Priority:**
- Authentication/authorization
- Payment processing
- Data validation
- Security-sensitive code
- Critical business logic
**Medium Priority:**
- API endpoints
- Form handlers
- Data transformations
- Email notifications
**Low Priority:**
- Simple getters/setters
- Configuration classes
- View rendering
- Logging statements
## Quick Commands
### PHP (PHPUnit)
```bash
# Text coverage report
vendor/bin/phpunit --coverage-text
# HTML coverage report
vendor/bin/phpunit --coverage-html coverage/
# Coverage for specific test
vendor/bin/phpunit --coverage-text tests/Unit/DataProcessorTest.php
# Kanopi projects
ddev exec vendor/bin/phpunit --coverage-html coverage/
# Terminal coverage
npm test -- --coverage
# HTML report
npm test -- --coverage --coverageReporters=html
# Watch mode with coverage
npm test -- --coverage --watch
# Coverage for specific file
npm test -- --coverage DataProcessor.test.js
Untested:
try {
$this->processData($data);
} catch (Exception $e) {
// Untested catch block
$this->logger->error($e->getMessage());
}
Solution:
public function testProcessDataWithException(): void {
$this->expectException(ProcessingException::class);
$this->processor->processData([]);
}
Untested:
Solution: Add tests for each edge case
Untested:
Solution: Add integration tests or use mocks
tools
Strategist-focused site audit for discovery and pre-discovery. Given a site URL and optional qualitative research data, navigates the site via CoWork, audits against all 21 UX Laws from lawsofux.com, reviews content hierarchy, synthesises qualitative data, runs Lighthouse, and produces two deliverables — a Project Knowledge Summary (Markdown for Claude Desktop Projects) and a polished, iterable HTML Artifact for client sharing. Use when a strategist, UX lead, or PM asks for a discovery audit, UX laws audit, content hierarchy review, pre-discovery site review, "audit this site for strategy", "strategist audit", "UX audit", or pastes a site URL with discovery context. Not for developer audits — use accessibility-audit, performance-audit, or live-site-audit for those.
development
Provide story point estimation guidance with hour calculations for software development tasks. Uses Fibonacci sequence (1, 2, 3, 5, 8, 13, 21, 34+) and converts story points to hours. Includes platform-specific adjustments and velocity calculations.
tools
Perform a full QA review of a Teamwork task by reading the task and all its comments for context, extracting the multi-dev URL, generating dynamic validation steps tailored to the task type, and using CoWork browser automation to execute those steps on the multi-dev environment. Produces a structured validation report with pass/fail per step, screenshots, internal notes, and a client-facing summary — all shown in chat. Use this skill whenever the user asks to QA, test, validate, or review a Teamwork task or multi-dev environment — even if they just say "can you QA this?" or paste a Teamwork link. Also triggers for phrases like "run QA on", "check the multi-dev", "validate this task", "test the dev link", or "review the ticket". Works across Drupal/CMS updates, WordPress/plugin updates, bug fixes, new feature development, and general web development tasks.
tools
Generate a client-facing project heartbeat / status update message for a Kanopi project, ready to be posted as a Teamwork message. Use this skill whenever the user asks to write, draft, generate, or send a project update, heartbeat, status update, or progress report to a client. Also triggers when the user says things like "time for a project update", "draft the heartbeat", "write up the update for [project]", or "it's been two weeks, let's send an update". Always use this skill — even if the user doesn't say "heartbeat" — whenever the intent is to summarise recent project activity for a client audience.