ClaudeMulti-file workflowsLevel 3: Workflows

How Do You Change a Function Used Everywhere?

Change the definition first, let the type checker list every site that broke, then have Claude work through them until there are no errors. The errors become a complete worklist. Anthropic's Claude Code docs say to raise effort for this kind of job, such as a schema change where Claude must find every reader of the old shape.

Prompt to copy
I'm changing [thing] from [old shape] to [new shape].

Step 1: change only the definition in [file]. Run [type-check command] and give me the errors grouped by file. Don't touch any call site yet.

Step 2: fix the call sites one file at a time, with the smallest change. Where the right value isn't obvious, stop and ask instead of adding a default or a cast. No `any`, `@ts-ignore` or your language's equivalent.

Step 3: search for uses the type checker can't see, in strings, reflection, JSON, templates and SQL. Report them.

Finish by running [type-check command] and [test command], and show me the output.
  1. 1Change the definition
  2. 2Type checker lists sites
  3. 3Fix each site
  4. 4Search what types can't see
The type checker writes the worklist. The last step exists because it can't see strings, JSON, SQL or templates.

Try it now

  1. 1Run /effort high. If you haven't installed one, add your language's code intelligence plugin, such as /plugin install typescript-lsp@claude-plugins-official.
  2. 2Send the prompt. Read the grouped error list. It's your first real look at how far the change reaches.
  3. 3Answer any question about ambiguous sites. That's the judgment Claude can't supply.
  4. 4It worked if the type checker reports zero errors, no new casts appear in /diff, and Step 3 has been reported.

Use it when

Reshaping anything with many consumers: a function signature, a shared type, an event payload. It works best in typed code, where the compiler produces the list. You need Claude Code for this in practice, since the type checker has to run against the whole repo.

Skip it when

Untyped code with no compiler to find call sites. Use a thorough search and strong tests instead, or add types to that boundary first. Also skip it for a change with one or two callers, where a direct edit is quicker.

Why it works

Change callers first and you're guessing at a contract that doesn't exist yet. Change the definition first and the compiler's error list is a pass or fail check that Claude can run and re-run by itself. A code intelligence plugin adds to this, reporting type errors after each edit and finding references by symbol. Effort matters more here than usual. Claude Code defaults to medium on Opus 5.5 and Sonnet 5.5, and the docs say high or xhigh makes Claude check more edge cases and verify more of its work. Keep it all in one session as well, because Anthropic's large-codebase guide says that keeps the decisions behind each edit consistent.

Example

You're adding a required currency argument to formatMoney(amount). Suppose the type checker flags 23 call sites. Most have a currency nearby. A few, such as an email template, don't, and those are where you'd want Claude to stop and ask, rather than quietly defaulting to "USD". Step 3 may turn up a CSV export that calls it through a lookup table the compiler can't follow.

Going further

For a big change, go in stages: make the new parameter optional, migrate the callers, then make it required. Every stage compiles and can ship, so it's reviewable in pieces. It's also what makes /batch usable. Anthropic's docs say /batch splits work into 5 to 30 independent units, each in its own worktree with its own tests and PR. A breaking signature change isn't independent, because no unit can pass until all are done. So merge the optional version first, then batch the callers. Subagent worktrees branch from your default branch unless worktree.baseRef is "head", so the batch won't see an unmerged definition. The staged sequence is a rule of thumb, not a vendor figure.

Common mistakes

  • Editing call sites before the definition is settled, then redoing them when the real signature differs.
  • Letting Claude silence errors with a cast or a default. That passes the compiler and hides the decision you needed to make.
  • Calling zero type errors the finish. Types can't see strings, JSON, SQL or templates, so run Step 3 and your tests too.
  • Expecting language server help in a cloud session. Anthropic's docs say plugin language servers don't start there, so have Claude run the type checker directly.

Sources

Checked 6 November 2026. Products change often, so confirm details with the vendor.

Related

Beyond the course