Remove Dead Code and Stale Feature Flags Safely

8 Views
0 Uses

Prompt

ChatGPT
Claude
Grok
OpenRouter
Act as a senior engineer cleaning up a codebase. I want to delete code that's no longer used, without deleting anything that's quietly still needed.

Language / framework: {{FRAMEWORK}}
The code, flags or endpoints I suspect are dead: {{SUSPECTS}}
Evidence I have (search results for callers, logs, metrics, flag rollout state, git history): {{EVIDENCE}}

Do this:
1. For each suspect, list every way it could still be reached that a plain text search would miss: reflection or dynamic dispatch, string-built names, config files, templates, scheduled jobs, external callers of public APIs, database-stored references, tests.
2. Rate each suspect: Safe to delete / Probably dead, verify first / Still live, with the evidence.
3. For "verify first" items, the cheapest check (a log line or metric for two weeks, a search in other repos, asking a named team role).
4. For feature flags that are fully rolled out, the clean-up: which branch of each conditional to keep, and the flag configuration to remove afterwards.
5. A deletion order with small separate PRs, and what to monitor after each one ships.

Never recommend deleting something because it "looks unused". Tie each verdict to evidence from what I pasted.

Customize this prompt

Fill in the variables below to personalize this prompt:

ChatGPT
Claude
Grok
OpenRouter

Model Settings

Recommended Models

ChatGPT Claude Gemini

Temperature

0.7

Max Tokens

2000

Additional Notes

Best for: Shrinking a codebase without breaking an unknown caller

About this prompt

“Remove Dead Code and Stale Feature Flags Safely” is a free prompt for ChatGPT in the Coding & Software category, 196 words long, added to The Prompt Index on October 28, 2026 by The Prompt Index. Copy it with the button above, paste it into ChatGPT or any other AI chat assistant, and send it.

It has 3 placeholders to fill in first: {{FRAMEWORK}}, {{SUSPECTS}}, {{EVIDENCE}}. Use the “Customize this prompt” fields to personalise it before you copy.

Recommended models: ChatGPT, Claude, Gemini.

0 upvotes, sent to an AI tool 0 times, viewed 8 times.

Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.