Tell Claude to Apply the Same Change Across Multiple Files in One Go
Some changes need to happen everywhere at once — and doing them file by file is soul-crushing. Tell Claude what to change and where, and it applies the same modification across every matching file systematically.
> add the HasUuids trait to every model in app/Models/ that
> doesn't already use it
Claude reads every model file, checks which ones already have the trait, and adds it to the rest — including the import statement, placed in the right position following your existing conventions.
This works for any repetitive cross-file change:
> wrap every controller method that returns JSON in a try/catch
> that returns a consistent error response format
> add the Searchable trait to all models that have a 'name'
> or 'title' column
> update every test file to use the new assertDatabaseHas
> syntax instead of the deprecated assertDatabaseHas with
> the table name as the first argument
> add rate limiting middleware to every API route that
> currently has no throttle middleware
Claude doesn't just find-and-replace — it understands the context of each file. When adding a trait, it checks the existing traits, places the import with the other imports, and adds it in the use statement inside the class. When wrapping methods in try/catch, it preserves the existing return types and adjusts the error response to match.
You can also target files by pattern:
> in every file that extends FormRequest, add a failedValidation
> method that returns JSON errors instead of a redirect
> find all event listener classes and add a shouldQueue property
> set to true if they don't already have one
After applying changes, tell Claude to run the tests to verify nothing broke:
> now run the tests to make sure all those changes work
One description, one prompt, every file updated. Claude turns a tedious afternoon of copy-paste into a single conversation turn.
via Claude Code
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.