$ recombobulate _
home / tips / ask-claude-to-rename-a-variable-function-or-class-across-the-entire-codebase
104

Ask Claude to Rename a Variable, Function, or Class Across the Entire Codebase

recombobulate @recombobulate · Mar 29, 2026 · Workflows
ask-claude-to-rename-a-variable-function-or-class-across-the-entire-codebase

IDE rename tools miss things. They catch direct references but skip string mentions, config keys, route names, documentation, and dynamic calls. Claude finds all of them.

"Rename the UserManager class to UserService everywhere in the codebase"

Claude searches for every occurrence — class definitions, imports, type hints, container bindings, config references, test mocks, comments that mention it, and documentation that references it — then renames them all consistently.

This goes beyond find-and-replace:

# Rename a function and update all callers
"Rename getUserData to fetchUserProfile everywhere — update the function, 
all call sites, any tests that mock it, and the API documentation"

# Rename with convention changes
"Rename the 'active' scope to 'published' on the Post model — update the scope, 
every query that uses it, tests, and any comments that reference it"

# Rename a database column and everything that references it
"Rename the 'fname' column to 'first_name' — write the migration, update the model, 
update every query, form, validation rule, and API response that uses it"

# Rename a route and update all links
"Rename the 'user.settings' route to 'user.preferences' — update the route 
definition, every route() call, any redirects, and navigation links"

Claude handles the nuances that simple search-and-replace can't:

  • Case variations — renames user_manager, UserManager, userManager, and USER_MANAGER appropriately
  • Partial matches — knows that renaming User shouldn't rename UserService or getCurrentUser
  • Dynamic references — finds string-based lookups like app('user.manager') or config('services.user_manager')
  • Test assertions — updates assertion messages and mock expectations, not just the code under test
  • Related names — asks if you also want to rename related things (e.g., the database table, the migration, the factory)

After the rename, run your tests to verify nothing was missed:

"Now run the tests to make sure the rename didn't break anything"

A bad name is a bug that compounds over time — let Claude do the rename properly so you stop working around it.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

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.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

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.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

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.

recombobulate @recombobulate · 1 day ago