tellaprompt

AI prompts for software developers

Last updated

The gap between "AI writes my code" and "AI makes my code better" is the prompt. Developers get the most out of assistants on the tasks around the code: adversarial review, structured debugging, refactor planning, PR narration and documentation — places where the model's breadth beats its tendency to guess.

Two habits carry every template below: paste real code and real errors (never describe them from memory), and force the AI to state assumptions instead of coding on top of them.

How to prompt as a developer

  • Paste, don't paraphrase: the actual function, the actual stack trace, the actual failing test. Paraphrased bugs get paraphrased fixes.
  • Scope explicitly: "change only this function; don't touch the API surface" prevents the drive-by rewrites models love.
  • Give the runtime facts: language version, framework, constraints ("no new dependencies", "must stay O(n)").
  • Ask for the diff, not the file — smaller outputs, easier review, fewer sneaky changes.

The five templates

Adversarial code review

Before you open the PR, you want the bugs found by something with no stake in your ego.

Review the code below as a skeptical senior engineer. Report every issue you find, including ones you're uncertain about — mark confidence (high/medium/low) and severity (bug/risk/nit) per finding instead of self-filtering.

Focus order: 1) correctness bugs and edge cases, 2) concurrency/state issues, 3) error handling that swallows failures, 4) security (injection, authz, secrets), 5) naming and clarity — last.

Constraints: [LANGUAGE + VERSION, FRAMEWORK]. Intent of this change: [ONE SENTENCE]. Do not propose rewrites outside the diff.

Code:
[PASTE DIFF OR FUNCTION]

Why this works: "Report everything with confidence labels" beats "find important bugs" — models filter too aggressively when told to be conservative, so the filtering is moved to you.

Role definitionOutput formatBrutal critic

Debugging protocol (hypotheses before fixes)

A bug you've stared at for an hour. You want structured hypotheses, not a confident wrong patch.

Debug with me. Do NOT propose a fix yet.

Step 1 — read everything below and list the 4 most likely root-cause hypotheses, ranked, each with: what evidence supports it, what evidence would falsify it, and the single cheapest check to test it.
Step 2 — ask me for the one missing piece of information that would most narrow it down.
Only after my answers: propose the minimal fix for the confirmed hypothesis, as a diff.

Symptom: [WHAT HAPPENS, WHAT SHOULD HAPPEN]
Stack trace / logs:
[PASTE]
Relevant code:
[PASTE]
Already ruled out: [LIST]

Why this works: Forcing ranked, falsifiable hypotheses before any patch stops the model's fix-first reflex — and the "already ruled out" line saves the three suggestions you've tried.

Ask-first loopFact densityOutput format

Refactor plan under constraints

Legacy module, real deadline. You need a staged plan you can ship incrementally — not a heroic rewrite.

You are my [staff engineer]. Below is a module that needs refactoring toward [GOAL, E.G. TESTABILITY / SPLITTING THE GOD CLASS].

Hard constraints: behavior-preserving steps only, each shippable alone, public API unchanged until step [N], no new dependencies, [TEST COVERAGE SITUATION].

Deliver: a numbered sequence of refactor steps, each with: what moves, why it's safe, how to verify (test or check), and estimated blast radius (files touched). Flag the step where risk concentrates. Do not write the refactored code yet.

Code:
[PASTE MODULE OR REPRESENTATIVE EXCERPTS]
PR description that reviewers thank you for

The change is done; the description is the last 10 minutes you'd rather not spend.

Write the pull-request description for the diff below.

Format: 1) one-sentence summary of WHAT changed, 2) WHY (the problem, with the concrete symptom or ticket [LINK/ID]), 3) HOW — the 2–3 non-obvious decisions and their trade-offs, 4) test evidence (what ran, what it showed), 5) reviewer notes: where to look hardest, what's deliberately out of scope.

Max 200 words. No "this PR", no restating the diff line by line — explain what the diff can't say itself.

Diff:
[PASTE DIFF]
Context: [TICKET GOAL, ANYTHING REVIEWERS NEED]

Why this works: The format encodes what reviewers actually need (why + non-obvious decisions + where to look), and the "explain what the diff can't say" rule kills line-by-line noise.

Output formatFact density

Documentation from code (honest about gaps)

The module works, the docs don't exist, and future-you deserves better.

Generate documentation for the code below.

Audience: [NEW TEAM MEMBER / API CONSUMER]. Format: 1) purpose in two sentences, 2) how to use it — the 2 most common flows with runnable examples, 3) configuration/parameters table, 4) failure modes and what they look like, 5) a section titled "Unclear from the code" listing every place you had to guess — as questions, not invented answers.

Use only what the code shows. If a behavior depends on something not visible here, put it in section 5.

Code:
[PASTE MODULE]

Why this works: The "Unclear from the code" section is the honesty valve — it converts hallucination pressure into a question list you can answer in five minutes.

Output formatAsk-first loopContext first

Frequently asked questions

Should I paste proprietary code into AI tools?

Follow your company's policy first. Practical hygiene: strip secrets and credentials (they don't belong in code anyway), prefer enterprise instances with no-training guarantees, and paste the minimal excerpt that reproduces the question — the templates work on excerpts by design.

Why do the templates keep saying "don't fix yet"?

Because models patch prematurely: the first plausible fix, confidently formatted. Separating diagnosis (hypotheses, evidence, cheapest check) from treatment measurably reduces wrong fixes — same reason senior engineers ask questions before touching the keyboard.

Which coding tasks is AI weakest at?

Whole-system design trade-offs, performance work without profiling data, concurrency reasoning, and anything where the truth lives outside the pasted context (infra state, team conventions, historical decisions). For those, use it as a critic and question-generator, not an author.

Do these prompts work inside coding agents (Copilot, Claude Code, Cursor)?

Yes — the mechanics transfer directly. In agent settings, the scope constraints matter even more ("change only", "as a diff", "no new dependencies"), because the agent can act on the whole repo instead of just answering.