456
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. This prompt node is part of the Onexial knowledge graph and links to related concepts, workflows and tools below.
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.

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