Systematically explore your codebase to identify duplicated logic across files before starting refactoring work.
Explore Before You Refactor
When you're asked to refactor or restructure code, resist the urge to start immediately on the requested change. Instead, take time to explore the codebase first.
Why This Matters
Refactoring a single component often reveals a much larger opportunity. By exploring first, you can:
Identify duplicated logic scattered across multiple files
Understand the full scope of what needs to change
Avoid making changes that miss the bigger picture
Plan more efficient, consolidated solutions
How to Do It
Map the requested change: Understand what component or logic needs refactoring
Search for similar patterns: Look for equivalent or duplicated logic in other files
Document what you find: Note file locations, patterns, and variations
Assess scope: Determine if this is truly a single-component issue or a codebase-wide pattern
Report back: Share your findings with the user before proceeding with refactoring
Tips
Use search tools to find similar variable names, function patterns, or logic flows
Check related modules, utilities, and components that might contain variations of the same logic
Look at version control history to see if code was copy-pasted
Ask clarifying questions if the scope seems larger than expected
The exploration phase often takes 10-15 minutes but saves hours of incomplete refactoring work.
1---2name: explore-before-refactor3description: explore-before-refactor4---5# explore-before-refactor67Systematically explore your codebase to identify duplicated logic across files before starting refactoring work.89# Explore Before You Refactor1011When you're asked to refactor or restructure code, resist the urge to start immediately on the requested change. Instead, take time to explore the codebase first.1213## Why This Matters1415Refactoring a single component often reveals a much larger opportunity. By exploring first, you can:16- Identify duplicated logic scattered across multiple files17- Understand the full scope of what needs to change18- Avoid making changes that miss the bigger picture19- Plan more efficient, consolidated solutions2021## How to Do It22231. **Map the requested change**: Understand what component or logic needs refactoring242. **Search for similar patterns**: Look for equivalent or duplicated logic in other files253. **Document what you find**: Note file locations, patterns, and variations264. **Assess scope**: Determine if this is truly a single-component issue or a codebase-wide pattern275. **Report back**: Share your findings with the user before proceeding with refactoring2829## Tips3031- Use search tools to find similar variable names, function patterns, or logic flows32- Check related modules, utilities, and components that might contain variations of the same logic33- Look at version control history to see if code was copy-pasted34- Ask clarifying questions if the scope seems larger than expected3536The exploration phase often takes 10-15 minutes but saves hours of incomplete refactoring work.
Run npx skillmds@latest add claudiawong522/explore-before-refactor 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.
explore-before-refactor It is listed under Coding & Dev Tools 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.