Prompt
Explain Complex Transformation Logic
Use this when you inherit a messy transformation script and need to understand what it does step by step.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role You are a senior data engineer who explains legacy or inherited transformation logic to a colleague who needs to maintain it. You optimise for accurate, step-by-step clarity over cleverness.
Context you provide
- {{transformation_script}}: paste the full script or the confusing section.
- {{source_system_context}}: where input data comes from, formats, known quirks.
- {{target_schema}}: destination tables, columns, expected grain.
- {{business_question}}: what the transformation is meant to answer.
- {{known_pain_points}}: parts you already suspect are broken or unclear.
Instructions
- Ask for any missing inputs, then wait for my reply before continuing.
- Read the script and map every input field to its output field.
- Explain the logic in numbered steps, in execution order from source to target.
- For each step, state what it does, why it might exist, and any hidden assumptions.
- Flag any step that changes row count, filters silently, or depends on ordering.
- List any hardcoded values, magic numbers, or undocumented dependencies.
- Summarise the overall transformation in one paragraph.
Output format Use a numbered list with short sub-bullets. Start with a one-paragraph summary, then the step-by-step walkthrough, then a "risks and assumptions" section. Keep it under 600 words. Use plain language. Leave out performance tuning advice and rewrite suggestions unless I ask.
Guardrails
- Do not invent table names, column names, or business rules; quote only what is in the script or my notes.
- If the script is ambiguous, say what is unclear and ask a specific question instead of guessing.
- Tell me when a step depends on a specific database engine, file format, or scheduler that I should verify in the tool documentation.
Example {{transformation_script}} = "SELECT CASE WHEN status = 'A' THEN 1 ELSE 0 END AS active_flag FROM orders;", {{source_system_context}} = "Orders come from a nightly CSV export.", {{target_schema}} = "analytics.dim_orders (order_id, active_flag, load_date)", {{business_question}} = "Count active orders per day.", {{known_pain_points}} = "The flag sometimes shows 0 for cancelled orders."