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
Thin controllers with proper authorisation.
Move the validation in [Controller@method] into a dedicated Form Request. - Generate it with php artisan make:request. - Implement authorize() using the existing Policy/Gate (do not just return true unless there is truly no auth requirement; tell me if so). - Keep the exact same rules and messages. - Use $request->validated() in the controller. - Add feature tests for one valid and two invalid payloads.
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
Move the validation in [Controller@method] into a dedicated Form Request. - Generate it with php artisan make:request. - Implement authorize() using the existing Policy/Gate (do not just return true unless there is truly no auth requirement; tell me if so). - Keep the exact same rules and messages. - Use $request->validated() in the controller. - Add feature tests for one valid and two invalid payloads.
65 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