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. ...
↳ connected nodes
Prompt↳ linked
SQL Explainer Prompt
Explain a SQL query in plain English with data implications.
Prompt↳ linked
Error Diagnoser Prompt
Turn a stack trace + code into a ranked diagnosis with next steps.
Prompt↳ linked
Test Case Generator Prompt
Generate meaningful test cases from a function signature.
Prompt↳ linked
AI Code Review Rubric Prompt
A reviewer prompt that finds real defects instead of style opinions.
Prompt↳ linked
Prompt Improver Prompt
Iterate a weak prompt into a strong one using best practices.
Use Case↳ linked
10-Person Dev Team Adds AI Code Reviewer, Cuts Cycle Time 30%
Engineering team wires an LLM into PR review as a first-pass gate.