# Explore Before Refactor

> explore-before-refactor

- Skill: `claudiawong522/explore-before-refactor` (Agent Skill)
- Install (CLI): `npx skillmds@latest add claudiawong522/explore-before-refactor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/claudiawong522/explore-before-refactor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: claudiawong522 (https://skillmd.com/u/claudiawong522)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/claudiawong522/explore-before-refactor

---

# explore-before-refactor

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

1. **Map the requested change**: Understand what component or logic needs refactoring
2. **Search for similar patterns**: Look for equivalent or duplicated logic in other files
3. **Document what you find**: Note file locations, patterns, and variations
4. **Assess scope**: Determine if this is truly a single-component issue or a codebase-wide pattern
5. **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.

