mochammadshenna/go-adk-q/code-refactor-iteration
- community
Checking that the SKILL.md file is still in the repository.
Iterate on a refactor in progress. Handle unexpected scope growth, failing tests, and mid-refactor discoveries cleanly.
Install
npx vskill@latest install mochammadshenna/go-adk-q/code-refactor-iterationSKILL.md
Code Refactor Iteration
Use when a refactor is in progress and you've hit a complication: tests went red, scope grew, or you discovered the current structure is more tangled than expected.
Common mid-refactor problems
Tests went red after a "safe" step
This means the step wasn't as safe as it looked. The most common causes:
- Implicit state dependency — the extracted function relies on side effects from earlier in the original function. Fix: pass the state explicitly as parameters.
- Interface change — the refactor changed what callers expected. Fix: update callers first, or add a compatibility wrapper temporarily.
- Test was testing implementation, not behaviour — the test breaks on rename or restructure. Fix: rewrite the test to test observable output, not internal structure.
Immediately run:
Identify the smallest sub-step that stays green. Do that, commit, then continue.
Scope grew unexpectedly
You started refactoring function A and discovered that doing it right requires also changing B, C, and the interface between them.
Stop. Revert to the last green commit. Reassess.
Options:
- Narrow the scope — refactor A only, leave B and C as-is with a comment noting the future work
- Plan the full refactor — write a plan covering A, B, and C before touching anything
- Abandon this refactor — if the scope is too large, it's not a refactor, it's a rewrite. Plan it as one.
Do not continue expanding scope mid-refactor. You'll end up with a 500-line diff that's impossible to review.
You don't understand part of the code
If you encounter code you can't confidently say "I know what this does", stop refactoring that part.
Options:
- Read it carefully, trace through it, write a test that documents its behaviour
- Leave it alone and refactor around it
- Ask for clarification before touching it
Iteration rhythm
Never let the codebase stay red for more than one commit worth of changes. If you've been in a red state for more than 15 minutes, revert and try a smaller step.
Tracking progress
Keep a running diff of what the refactor has accomplished:
If the diff is growing unexpectedly, you're likely doing more than a refactor. Stop and re-evaluate.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/engineering/code-refactor-iteration/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mochammadshenna/go-adk-q/code-refactor-iteration)