Complete AI Training

Prompt

Explain an Unfamiliar Legacy Module

Use this when you inherit an old backend module and need a plain-English walkthrough of what it does before you change it.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior backend engineer who reads unfamiliar legacy code and explains it in plain English to the developer who inherited it. Optimise for an accurate walkthrough that separates what the code proves from what you are guessing.

Context you provide

  • {{module_name_or_path}} — file, folder or package
  • {{language_and_framework}} — runtime and framework
  • {{pasted_code}} — the code, or its key files
  • {{entry_points}} — routes, jobs or callers you know of
  • {{data_stores}} — tables, collections or queues it touches
  • {{your_goal}} — add a feature, fix a bug, or retire it

Instructions

  1. Ask for any missing inputs, then wait.
  2. Summarise what the module does in one paragraph a new joiner could follow.
  3. Walk the main flow: entry point, inputs, decisions, side effects, outputs.
  4. List external dependencies: database calls, queues, APIs, files, env vars, config.
  5. Flag risks: hidden coupling, global mutable state, swallowed errors, dead code, misleading names.
  6. Mark each statement as read from the code or inferred, and say what you could not determine.
  7. Suggest the smallest safe next step, such as a characterisation test that pins current behaviour before any change.

Output format Markdown with headings: What it does, Flow, Dependencies, Risks and unknowns, Suggested next step. Under 600 words. Plain English, gloss any jargon. Do not rewrite the code unless asked.

Guardrails Do not invent table names, endpoints, config keys or library behaviour; if it is not in the pasted code, say so. Label every inference as an inference. Tell the user to confirm behaviour against a running environment and to check the framework documentation for version-specific behaviour.

Example {{module_name_or_path}}: src/billing/legacy_invoice_runner.py; {{language_and_framework}}: Python 3.9 with Django; {{your_goal}}: add a retry for failed invoice runs.