Check what breaks before you delete code

Before you remove a function, file or setting, have Claude Code list its callers and downstream effects, and say whether removal is safe.

Task: Check what breaks before you delete code · Other tasks

Fill in the details

A function, class, file, endpoint, config key or feature flag. Include the file path if the name is common.

Optional. Helps Claude judge whether a caller still needs what it provides.

Optional. Claude cannot see these, but it will flag what it cannot check.

Copy your prompt

This site doesn't run Claude or show model output. Results depend on your input and the model you use.

1 required field is empty.

What you type is kept in this tab's session storage so a reload doesn't lose it. Use "Clear this task" to remove it. Browsers can restore session data when they reopen tabs, so closing a tab isn't a guaranteed way to erase it.

When to use this template

  • A function, file, endpoint, config key or feature flag looks unused, and before removing it you want to see who depends on it and how much other work its removal would cause.
  • The name is used in ways a plain text search can miss, such as dynamic lookups, config files or generated code.
  • You are cleaning up dead code in an area you do not know well and want evidence before you delete anything.

When not to use it

  • You have already decided to remove it and want the work done. Ask for a plan or the change itself, and keep the tests as the check.
  • Most of its consumers live in systems Claude Code cannot see, such as other teams' repositories or a public API with outside users. Use your usage logs or ask the owners; Claude can only report what is in reach.
  • You are in a plain chat without access to the project. Without the code, a list of callers would be invented.

Why this structure

  • The question opens with the exact thing to delete, so the whole answer is about one target and its dependents.
  • The read-only rule includes not deleting code to see what fails. That keeps your working tree clean, and the command Claude names instead lets you run the same check yourself.
  • The four kinds of use to look for go beyond direct calls. Indirect uses through strings, config and generated code are the ones a quick search tends to miss.
  • The verdict comes with three fixed choices, followed by the evidence for it, so you get a decision you can act on rather than a long list of matches.
  • The optional field for outside consumers, together with point 4, makes Claude say what it could not check. A clean result inside the repository does not mean nothing else depends on the target.

Example input (fictional)

What you want to delete
the retryWithBackoff helper in src/net/retry.ts
Why you want to delete it
The HTTP client now retries failed requests on its own.
Places outside this repository that might use it
the nightly import scripts on the batch server

Follow-ups to send Claude

  • Go ahead with the removal steps you listed. Run the tests after each step and stop if something fails that you did not predict.
  • Mark it as deprecated first: add a warning where it is called, and list the callers I need to migrate.
  • Write a short note for the teams that may depend on it, saying what is being removed, when, and what to use instead.

Common mistakes

  • Giving a name that is not unique. If several things share it, add the file path so Claude checks the right one.
  • Trusting a clean result for code that is exported or exposed as an API. Other projects can use it without appearing anywhere in this repository.
  • Letting Claude delete the code to see what fails. Keep the check read-only, and do the removal as a separate step once the verdict is clear.
  • Find where something happens in the code: Describe a behavior and let Claude Code find the code that does it, with file paths, the path that leads there and any duplicate implementations.
  • Plan a code change before editing: Have Claude Code read the relevant code and propose a file-by-file plan for a multi-file change, without editing anything until you approve it.
  • Migrate a pattern across a codebase: Move every use of an old API, library or pattern to its replacement: Claude Code lists each place first, then changes them in checked batches.

See all templates

Sources