test-strategylisted
Install: claude install-skill buildproven/claude-kit
# Test Strategy Skill
## Current Project State
- Test runner: !`node -e "try{const p=require('./package.json');console.log(Object.keys(p.devDependencies||{}).filter(d=>['jest','vitest','mocha','playwright','cypress'].some(t=>d.includes(t))).join(', ')||'none detected')}catch{console.log('no package.json')}" 2>/dev/null`
- Test script: !`node -e "try{console.log(require('./package.json').scripts?.test||'none')}catch{console.log('none')}" 2>/dev/null`
Proactively suggest test cases when writing new code. Target 88%+ coverage across projects.
## When This Activates
- Writing a new function or module
- Creating a React component
- Building an API endpoint or route handler
- Implementing a custom hook
- Writing utility/helper functions
## Test Pyramid (Priority Order)
1. **Unit tests** (70%) - Fast, isolated, test one thing
2. **Integration tests** (20%) - Test module boundaries and data flow
3. **E2E tests** (10%) - Critical user paths only
## Required Test Patterns by Code Type
### React Component
```
- Renders without crashing (smoke test)
- Renders correct output for given props
- User interactions trigger expected behavior (click, type, submit)
- Conditional rendering works (loading, error, empty states)
- Accessibility: focusable, labeled, keyboard navigable
```
### API Endpoint / Route Handler
```
- Happy path returns expected status + shape
- Authentication: rejects unauthenticated requests (401)
- Authorization: rejects unauthorized requests (403)
- Validation