Refactor without changing behaviour
Behaviour-preserving refactor with tests as a safety net.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Library / Coding & Technology / Refactoring
One error middleware, typed errors, no leaked stack traces.
Introduce centralised error handling in this [framework] app. - Define a small set of typed application errors (NotFound, Validation, Unauthorized, Conflict). - Add one error-handling middleware/hook that maps them to HTTP responses and logs unexpected errors without leaking stack traces to clients. - Ensure async handlers' rejections reach the handler. - Update 2–3 existing routes as examples and add tests for each error type.
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 website & app development 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
Introduce centralised error handling in this [framework] app. - Define a small set of typed application errors (NotFound, Validation, Unauthorized, Conflict). - Add one error-handling middleware/hook that maps them to HTTP responses and logs unexpected errors without leaking stack traces to clients. - Ensure async handlers' rejections reach the handler. - Update 2–3 existing routes as examples and add tests for each error type.
64 words · generated instantly from templates, no AI called
What we added
Behaviour-preserving refactor with tests as a safety net.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
New column/table with indexes, rollback and model updates.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Eager loading fixes with proof.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1