711
Prompt

Code Refactor Advisor Prompt

Get a ranked list of refactors before touching a file.

1 min readupdated 2026-07-04

/ quick answer

Use as a pre-commit thinker to avoid over-engineering. Get a ranked list of refactors before touching a file.

Get a ranked list of refactors before touching a file. Use as a pre-commit thinker to avoid over-engineering. Copy the prompt below, swap the bracketed variables for your own context, and run it in any capable model.
Context
Use as a pre-commit thinker to avoid over-engineering.
Prompt
Review the file. Return refactors ranked by ROI (impact / effort).

For each: what to change, why, effort (S/M/L), risk (S/M/L).
Do not propose renames unless the name is misleading.
Do not propose 'add tests' as a refactor.

File:
{{code}}
Example Output
1. Extract retry logic into util (M/S) — reused in 4 places.
2. Replace switch with map lookup (S/S) — easier to extend.
3. ...

/ frequently asked

What does the Code Refactor Advisor Prompt prompt do?

Use as a pre-commit thinker to avoid over-engineering.

Which AI models work with this prompt?

It is model-agnostic: it works with any capable general model. Replace the bracketed variables with your own context before running it.

How do I use this prompt?

1) Copy the prompt with the copy button. 2) Replace every bracketed variable with your real details. 3) Paste it into your AI assistant. 4) Compare the answer with the example output and ask for changes if needed.

What output should I expect?

1. Extract retry logic into util (M/S) — reused in 4 places. 2. Replace switch with map lookup (S/S) — easier to extend. 3. ...

/ topics#dev#prompt

/ continue exploring

Related prompts

Reusable prompts for this job.

all prompts →

Related use cases

How people apply it, and what came out.

all use cases →