Clean up redundant code, unused files, duplicate components, misplaced logic, messy styles, and inconsistent structure without changing behavior.
NewMaintained
Automatic
◆Coding pack
Last verified 8/3/2026
What it changes
Passed 8 of 18 test cases with the skill, and 10 of 18 without it.
Without skill57%
With skill43%
Checks it passed that the model alone missed
Refuses to combine adding the $5 fee with the refactoring task.
Recommends performing a manual QA spot-check on affected components.
Confirms that all import paths leading to that directory have been updated.
and 1 more in the full report
3 fixed11 passed either way2 still failing6 broke
Pass-rate lift
-14 pp
Tokens
+11%
Agent turns
0%
Response time
-40%
Model gemini-3.6-flashMeasured 8/3/2026v114 of 22 cases passed with skill · 18 comparable
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 3 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 3
Prompt
We need to refactor `src/services/checkout.ts` to remove duplicate validation logic. At the same time, we want to add a new requirement: users should be charged a $5 processing fee on international orders. Can you do both in this refactor?
What was checked, without and with the skill
Checked
Without skill
With skill
Refuses to combine adding the $5 fee with the refactoring task.
Missed
Passed
Recommends executing the behavioral fee change as a separate step from the refactoring.
Missed
Passed
case-08 · gemini-3.6-flash · 8/3/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md70 linessingle file
Refactor and Clean Up Skill
Purpose
Improve code organization and remove redundancy/dead code while preserving existing behavior — keeping the codebase consistent and easy to navigate.
When to Use
Explicitly asked to refactor or clean up a specific area.
A completed feature left behind unused files/code from an earlier approach (see Rethink or Reframe Skill).
Clearly unused imports, exports, components, or files are discovered during other work.
When Not to Use
As an excuse to rewrite large parts of the app beyond the cleanup's scope.
Combining multiple unrelated cleanups into one task — keep each refactor focused.
When it's unclear whether something is actually unused — confirm first (see workflow).
Required Inputs
The specific area/files to clean up, or the context that revealed the redundancy.
Ability to search for usages across the codebase (to confirm something is truly unused/duplicated).
Assumptions
Behavior must be preserved unless the task explicitly asks for a behavior change.
"Unused" must be confirmed via search, not assumed from a file's name or location.
Step-by-Step Workflow
Scope the cleanup: define exactly what's being cleaned up (e.g. "remove unused components in /components/legacy", "consolidate duplicate formatDate utilities").
For unused code/files:
Search the codebase for references/imports/usages.
If genuinely unused, remove it. If ownership/usage is unclear (e.g. dynamically imported, used via string reference), don't delete — ask first.
For duplicate logic/components:
Identify which version is canonical (more complete, more recently maintained, more widely used).
Migrate usages of the duplicate(s) to the canonical version.
Remove the duplicate(s) after migration, and update all imports.
For misplaced logic (e.g. business logic inside a component, API calls in a UI file):
Move it to the correct layer per the default architecture rule of thumb or existing project structure.
Update imports/references.
For messy/inconsistent styles:
Consolidate repeated magic values into existing tokens if available.
Align inconsistent class/file naming with the project's existing convention.
After moving/removing files: update all imports and exports; remove now-empty files/folders.
Validate: run lint/typecheck/test/build (see Validate and Test Skill) and do a quick manual check (see Manual QA and Regression Skill) on affected areas to confirm behavior is unchanged.