Agent skill
refactor-test-safety-net
[Code Quality] Establishes test coverage requirements before refactoring. Use to identify missing tests, create minimal safety net tests, and define verification strategy for behavior preservation.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/refactor-test-safety-net
SKILL.md
Refactor: Test Safety Net
Ensure adequate test coverage before making changes.
Pre-Refactoring Test Checklist
1. Coverage Assessment
- What's the current test coverage?
- Which paths are untested?
2. Test Types Needed
| Type | Purpose | When Required |
|---|---|---|
| Unit | Function behavior | Always |
| Integration | Component interaction | Cross-module changes |
| Snapshot | UI/Output structure | View refactoring |
| Regression | Known bug prevention | Bug-prone areas |
3. Minimal Safety Net
Priority 1: Happy path test Priority 2: Error handling test Priority 3: Edge case test
Rules
- Never refactor without tests on the target code
- Add tests BEFORE changes, not after
- Characterization tests capture behavior, not correctness
- Run tests after each small step
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?