Fix a bug with root-cause analysis
Makes the agent find the cause before patching symptoms.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Library / Coding & Technology / Refactoring
Behaviour-preserving refactor with tests as a safety net.
Refactor [file/class/function] to [goal: e.g. extract the pricing logic into a service]. Rules: - Behaviour must not change. If tests for this code are missing, write characterisation tests first and run them. - Keep public method signatures unless I approve changes. - Work in small steps; run tests after each step. - Touch only the files needed. List them before you start. Finish with: files changed, why the new structure is better, and the test command output.
Copies your prompt and opens the official site in a new tab. You may need to paste it yourself (Ctrl/⌘ + V). Nothing is sent to the AI by us.
Replace [bracketed] parts with your own details before sending. Want it tailored? Build a custom coding assistant prompt.
A typical one-line request compared with this prompt. We only show sample responses where we've written an illustration.
Prompt
refactoring
1 words · no role, context, format or constraints
Prompt
Refactor [file/class/function] to [goal: e.g. extract the pricing logic into a service]. Rules: - Behaviour must not change. If tests for this code are missing, write characterisation tests first and run them. - Keep public method signatures unless I approve changes. - Work in small steps; run tests after each step. - Touch only the files needed. List them before you start. Finish with: files changed, why the new structure is better, and the test command output.
77 words · generated instantly from templates, no AI called
What we added
Makes the agent find the cause before patching symptoms.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Covers happy path, edge cases and failures without testing implementation details.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Prioritised review: bugs, security, tests, then style.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1