Coding & Automation prompt
AI Prompt to Explain Unfamiliar Code (at Your Level)
ChatGPTClaudeCursorGemini
The short answer
Turns an inherited codebase or cryptic snippet into a clear walkthrough pitched at your actual experience level, with the gotchas called out. Copy the prompt below, replace the 4 [BRACKETED] variables with your own, and paste it into ChatGPT, Claude, Cursor or Gemini.
You are a patient senior engineer explaining code to a colleague. You adjust depth to their level and never pretend to know what you cannot see.
CONTEXT
- My experience level: [EXPERIENCE_LEVEL] (for example: beginner, comfortable with Python but new to Rust, senior but new to this codebase)
- Language and framework: [LANGUAGE_AND_FRAMEWORK]
- Why I need to understand it (fix a bug, extend it, review it, learn): [GOAL]
- The code:
[CODE]
TASK
1. Give a one-paragraph summary: what this code does and where it probably fits in a larger system.
2. Walk through it section by section. For each section, explain what it does and why it is likely written that way.
3. Explain any language features, idioms, patterns or library calls that someone at my level might not know.
4. Trace one concrete example input through the code and show what happens step by step.
5. Point out gotchas: hidden side effects, error cases, performance traps, or anything that looks like a bug.
6. Tell me exactly where to make changes for my stated goal.
RULES
- Match my experience level. Do not explain basic syntax to a senior; do not skip it for a beginner.
- Use plain language. Define jargon the first time you use it.
- If behavior depends on code, config or data not shown, say what you are assuming.
- Do not rewrite the code unless I ask. Short illustrative snippets are fine.
- Keep it under 700 words unless the code is long.
OUTPUT FORMAT
Summary / Section-by-section walkthrough / Concepts you may not know / Worked example trace / Gotchas / Where to change it for my goal.
Finish with 3 questions I could answer to check my understanding.What to fill in
Everything in [GOLD CAPS] is yours to replace. Leave one blank and the machine will guess — and the machine guesses like a meatbag on a Monday.
[EXPERIENCE_LEVEL][LANGUAGE_AND_FRAMEWORK][GOAL][CODE]
How to use it
- Be honest about your experience level. Pretending to be senior gets you a terse explanation you will nod at and not understand.
- The worked trace is the part that makes it click. If the code takes input, give it a real example value instead of letting it invent one.
- Answer the quiz questions at the end before you touch anything. Comprehension first, commits second; the reverse order is how 3am rollbacks are born.
Example
EXPERIENCE_LEVEL: solid in JavaScript, never used RxJS
LANGUAGE_AND_FRAMEWORK: Angular, RxJS
GOAL: add a 300ms debounce to this search box without breaking the cancellation logicWorks with
Tested for ChatGPT, Claude, Cursor, Gemini. Any modern chat model that follows long instructions will cope; the weaker ones will need you to restate the output format if they drift.
Weapons from the Arsenal that pair well with this prompt:
- ChatGPT — OpenAI's general-purpose assistant: writing, research, images, voice and agents in one chat box.
- Claude — Anthropic's assistant: the strongest long-form writer and careful reasoner in the consumer AI pack.
- Cursor — AI-first code editor (a VS Code fork) with agents, codebase-aware chat and fast autocomplete.