Understand legacy code before changing it
Usage description
Explain an inherited code module and map its flow before touching it.
Prompt text
Read the module {{extra}} in {{project}} and do not change anything.
Write:
1. The overall purpose in one paragraph.
2. The main execution flow and a Mermaid sequence diagram.
3. Entry points, external dependencies and side effects (files, network, database).
4. Risky or unclear areas, and questions that need an answer from the team.
5. Suggested characterization tests that pin down the current behaviour.Required inputs
The module path.
Expected outputs
An explanation, a diagram, a list of risks and characterization tests.
Suitable tools
Practical example
extra = “billing/legacy_invoice.php”.
We do not claim this prompt was tested on a particular model; results vary with the model and context, so always review the output.
