Daily Prompt Pack: Code Assistants – Turn Stale Legacy Code Into a Working Spec in One Pass

Legacy code is a story written by five people who never talked to each other. These three prompts help you stop guessing what it does and turn it into a working spec in one pass.

[Claude]

You are a senior staff engineer. Given this legacy file path and the feature it must keep working, produce a behavior spec: list every input-output pair observed, every side effect, every hidden dependency and config flag. Then write a test harness that pins those behaviors as they exist today. Output as a numbered spec markdown file plus the harness. Do not refactor. Only observe and pin.

[ChatGPT]

Act as a reverse-engineering reviewer. Read this git history between commits X and Y for file F. Summarize, in one table with columns change, reason, and risk, what each diff actually did and what it broke. Flag any commit that overwrote an earlier fix. Output the table plus a ranked list of the three riskiest spots to test first. Keep it under 40 lines.

[Cursor]

In this repo, open the function at line L and trace every caller chain that reaches it. For each chain, state the data shape coming in and the expected return. Then generate a decision table of edge cases (empty input, null, overflow, duplicate keys) showing what the code does today versus what the docs claim. Output the edge case table as a markdown file in /spec.

Full archive at aitoolalliance.com/tag/prompt-pack. Built for devs who hate mystery code.

Scroll to Top