Systematically check for dead code and regressions after refactoring to ensure code quality and functionality.
Post-Refactor Audit
After completing a refactoring task, run a structured audit to catch dead code and regressions before declaring the work done.
Steps
Identify unused code
Search for variables, functions, and imports that are no longer referenced
Use your editor's "Find References" feature to confirm nothing calls removed code
Pay special attention to old helper functions that may have been duplicated in the refactor
Check for overlapping logic
Look for duplicate renders, state management, or side effects
Verify that components don't handle the same responsibility twice
Ensure event handlers aren't firing multiple times due to lingering code
Test core functionality
Run the app and manually test key user flows
Check browser console for errors and warnings
Test edge cases that might have been affected by structural changes
Review side effects and state
Verify useEffect dependencies are correct
Check that state updates happen in expected order
Look for memory leaks or cleanup functions that may have been missed
Clean up findings
Remove all confirmed dead code
Fix any regressions discovered
Update related tests and documentation
Tips
Refactoring often reveals overlapping code that wasn't obvious before—this is valuable
Large monolithic components frequently have hidden duplicate logic when broken down
Run a linter to catch obvious issues automatically
Consider writing a quick integration test for the refactored section before cleanup
1---2name: post-refactor-audit3description: post-refactor-audit4---5# post-refactor-audit67Systematically check for dead code and regressions after refactoring to ensure code quality and functionality.89# Post-Refactor Audit1011After completing a refactoring task, run a structured audit to catch dead code and regressions before declaring the work done.1213## Steps14151. **Identify unused code**16 - Search for variables, functions, and imports that are no longer referenced17 - Use your editor's "Find References" feature to confirm nothing calls removed code18 - Pay special attention to old helper functions that may have been duplicated in the refactor19202. **Check for overlapping logic**21 - Look for duplicate renders, state management, or side effects22 - Verify that components don't handle the same responsibility twice23 - Ensure event handlers aren't firing multiple times due to lingering code24253. **Test core functionality**26 - Run the app and manually test key user flows27 - Check browser console for errors and warnings28 - Test edge cases that might have been affected by structural changes29304. **Review side effects and state**31 - Verify useEffect dependencies are correct32 - Check that state updates happen in expected order33 - Look for memory leaks or cleanup functions that may have been missed34355. **Clean up findings**36 - Remove all confirmed dead code37 - Fix any regressions discovered38 - Update related tests and documentation3940## Tips4142- Refactoring often reveals overlapping code that wasn't obvious before—this is valuable43- Large monolithic components frequently have hidden duplicate logic when broken down44- Run a linter to catch obvious issues automatically45- Consider writing a quick integration test for the refactored section before cleanup
Run npx skillmds@latest add claudiawong522/post-refactor-audit in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
post-refactor-audit It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
claudiawong522 (@claudiawong522) published this skill. Their other Agent Skills are listed on their SkillMD profile.