home / skills / shotaiuchi / dotclaude / refactor-test
This skill analyzes test coverage and identifies gaps to guide pre-refactoring tests and verification checkpoints, reducing risk during code changes.
npx playbooks add skill shotaiuchi/dotclaude --skill refactor-testReview the files below or copy the command above to add this skill to your agents.
---
name: refactor-test
description: >-
Test coverage verification for refactoring. Apply when verifying existing
test coverage, identifying gaps, recommending pre-refactoring tests,
and defining verification checkpoints.
user-invocable: false
---
# Test Guardian Analysis
Verify existing test coverage and ensure tests will catch regressions during refactoring.
## Analysis Checklist
### Existing Coverage Analysis
- Map test coverage for all files in the refactoring scope
- Identify which behaviors are covered by unit vs integration tests
- Check for tests that depend on implementation details (brittle tests)
- Verify edge cases and error paths are covered
### Gap Identification
- Find critical code paths with no test coverage
- Identify untested boundary conditions and error handling
- Detect missing integration tests between affected modules
- Check for untested concurrent or async behavior
### Pre-Refactoring Tests
- Recommend characterization tests to capture current behavior
- Define golden master tests for complex output verification
- Suggest contract tests for public API boundaries
- Plan snapshot tests for UI components affected by changes
### Verification Checkpoints
- Define test gates between each migration step
- Specify performance benchmarks to verify no regression
- Plan smoke tests for critical user journeys
- Establish monitoring checks for post-deployment verification
### Test Refactoring Readiness
- Identify brittle tests that will break from structural changes
- Recommend test rewrites to depend on behavior not implementation
- Check test isolation to prevent cascade failures
- Verify test data setup is independent of internal structure
## Output Format
Report findings with impact ratings:
| Impact | Description |
|--------|-------------|
| Breaking | Missing tests for critical path, refactoring unsafe to start |
| High | Significant coverage gap that must be filled before proceeding |
| Medium | Coverage gap that should be addressed during refactoring |
| Low | Minor gap, acceptable risk with manual verification |
This skill verifies test coverage and readiness before refactoring to reduce regression risk. It maps current tests, identifies coverage gaps, and produces prioritized recommendations and verification checkpoints. The goal is to make refactoring safe, measurable, and incremental.
The skill inspects test suites and source files in the refactoring scope, classifies tests as unit, integration, or brittle implementation-dependent tests, and highlights untested code paths. It outputs a gap analysis with impact ratings, recommends characterization and golden-master tests, and defines stepwise verification gates and post-deployment checks.
What output will I get?
A prioritized report that maps coverage, lists gaps with Impact ratings (Breaking/High/Medium/Low), recommends pre-refactoring tests, and defines verification checkpoints.
How do you rate impact?
Impact is based on whether missing tests affect critical user paths or public contracts: Breaking (unsafe), High (must fix), Medium (address during refactor), Low (acceptable risk).