In the pack: ChatGPT, Claude & Gemini Prompts for Coding and Developers
Dig Out the Hidden Business Rules in Legacy Code
Prompt
Language: {{LANGUAGE}}
Legacy code: {{LEGACY_CODE}}
What the business thinks this code does: {{STATED_PURPOSE}}
Do this:
1. List every rule the code enforces, one per row: the rule in plain English, the line(s) that enforce it, and the input that triggers it. Include magic numbers, date or timezone handling, rounding, special-cased customer IDs or codes, and default values.
2. Mark each rule: Matches stated purpose / Not mentioned in stated purpose / Contradicts stated purpose.
3. For each "Not mentioned" or "Contradicts" row, write the question I should ask the business owner.
4. Suggest one characterization test per rule (input and the output the code currently produces), so a rewrite can prove it kept or deliberately changed each one.
5. Flag code that looks dead, but say what would prove it dead (logs, metrics, a search for callers) rather than assuming.
Report what the code does, not what it should do. Don't fix anything yet.
Customize this prompt
Fill in the variables below to personalize this prompt:
Model Settings
Recommended Models
Temperature
Max Tokens
Additional Notes
About this prompt
“Dig Out the Hidden Business Rules in Legacy Code” is a free prompt for ChatGPT in the Coding & Software category, 185 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:
{{LANGUAGE}}, {{LEGACY_CODE}}, {{STATED_PURPOSE}}.
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 7 times.
Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.