Back to Learn

    Coding Prompts for ChatGPT, Claude and Copilot: Ten That Ship, and the Rules Behind Them

    Most lists of ChatGPT prompts for coding are templates with brackets and no evidence they were run. This page starts from what OpenAI, Anthropic and GitHub say in their own prompting documentation, reduces it to five things every coding prompt needs, gives you ten prompts that carry all five, and shows what a library of 121 prompts built to that spec looks like when you count it.

    Updated

    Coding prompts hero: the guide title beside a debug-prompt card listing context, symptom, expected behaviour, what was already tried, constraints, output order, and a line asking the model to ask before assuming

    What do the vendors say a coding prompt needs?

    Five things, and the three guides agree more than their fans do. Anthropic's prompting best practices: “Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results.” OpenAI's prompt engineering guide on structure: “Markdown headers and lists can be helpful to mark distinct sections of a prompt, and to communicate hierarchy”, and on examples: “Include a handful of input/output examples in the prompt.” GitHub's prompt engineering for Copilot Chat lists eight rules, starting with “Start general, then get specific” and “Avoid ambiguity”. Read on 26 September 2026, they reduce to this:

    The five parts of a coding prompt and where each vendor's guide asks for it, read 26 September 2026
     OpenAIAnthropicGitHub Copilot
    Context: stack, files, dataA Context section in the developer message; “constrain the model's response to a specific set of resources”“Add context to improve performance”“Indicate relevant code”: open the files it should read
    An explicit deliverableIdentity then Instructions, in that order“Be clear and direct”; ask for action, not suggestions“Start general, then get specific”
    Boundaries: what not to touchInstructions sectionOvereagerness and file-creation sections for agentic coding“Break complex tasks into simpler tasks”
    Cases and examples“Provide a diverse range of possible inputs with the desired outputs”“Use examples effectively”“Give examples”
    VerificationTest changes with unit tests and validate patches“Ask Claude to self-check”; never remove or edit tests to pass“Experiment and iterate”

    The one line worth memorising is Anthropic's, because it names the failure everyone has seen: “It is unacceptable to remove or edit tests because this could lead to missing or buggy functionality.” Two of the ten prompts below carry it.

    What does a library built to that spec look like?

    Ours has 121 base prompts, every one with the same section skeleton, and the site counts them at build time rather than quoting a number written once. The most common sections across the library, by how many prompts carry each:

    Sections that appear in the 121 base prompts, top seven
    Core Features121Build Order121Safe-Guard Instructions121Before Building121Screens & States36Verification20Repository Rules18
    Sections that appear in the 121 base prompts, top seven
    Categoryprompts
    Core Features121
    Build Order121
    Safe-Guard Instructions121
    Before Building121
    Screens & States36
    Verification20
    Repository Rules18

    Counted from the H2 headings of every base prompt in the library at build time on 26 September 2026.

    Length follows structure: the median base prompt is 288 words, the shortest 244 and the longest 369. The last section every prompt ends with is the fifth part of the table above, turned into a habit: a line that asks the model to ask before building. When we ran three of them, that line produced two and four clarifying questions before any code, which is the cheapest verification there is. The prompting guide walks the skeleton section by section, and the prompt library has all 121 with their channel.

    Ten coding prompts that carry all five parts

    Written for a chat with ChatGPT or Claude, or for Copilot Chat with the relevant files open. Replace the brackets; do not delete the lines you think are obvious, they are the ones the model skips.

    1. Build a feature New code in an existing codebase
    Context: [stack, e.g. Next.js 15 app router, Supabase auth, Tailwind]. The relevant files are [paths].
    Build: [one feature in one sentence].
    Must: [2 to 4 behaviours, numbered].
    Must not: touch [files or behaviours to leave alone].
    States: empty, loading, error and success for every new screen.
    Output: the diff per file, then one paragraph on what you assumed.
    Before writing code, ask me anything you need to know about [the user or the data].
    2. Debug from a symptom Root cause, not a patch
    Context: [stack]. Symptom: [exact error or behaviour, copied]. Expected: [what should happen].
    Already tried: [list, so you do not repeat them].
    Constraints: do not change [policies, schemas, public APIs].
    Do this in order: name the most likely cause and the evidence for it; propose the smallest change that tests that cause; only then write the fix.
    If you need a file I have not shown, name it instead of guessing its contents.
    3. Refactor without changing behaviour Structure moves, tests stay green
    Refactor [file or module] to [goal: smaller functions, remove duplication, extract a hook].
    Behaviour must be identical: same inputs, same outputs, same side effects.
    Keep the public interface and every existing test unchanged; if a test must change, stop and tell me why.
    Output: the new code, then a list of every behavioural difference you could not avoid (expected: none).
    4. Review a diff A second reviewer that does not get tired
    Review this diff as a senior engineer on this codebase: [paste diff].
    Report only findings that would change a decision, ordered by severity: correctness, security (secrets, auth, injection), data loss, performance, then style.
    For each: file and line, what breaks, a concrete input that triggers it, the fix.
    Do not restate what the code does. If you find nothing above style, say so in one line.
    5. Write the tests first Tests that define done
    Before implementing [feature], write the tests for it in [framework] covering: the happy path, each validation failure, the empty case, and one concurrency or ordering case if any state is shared.
    Use the existing test conventions in [path]. Do not mock what you can run.
    Then implement until the tests pass. Never edit or delete a test to make it pass; if a test is wrong, tell me and stop.
    6. Explain unfamiliar code Onboarding to a file you did not write
    Explain [file] to an engineer who knows [language] but not this codebase.
    In order: what it is for in one sentence; the data it reads and writes; the entry points and who calls them; the two places most likely to break when changed.
    Under 300 words. Quote line numbers, not paraphrases, for anything non-obvious.
    7. Database change with row-level security A migration that is safe by construction
    Write a migration for [change] against this schema: [paste or path].
    Every new table enables row-level security in the same migration and gets policies that compare auth.uid() with an owner or membership column. Never "using (true)" on user data.
    Then write two verification queries: one as the owner (expects rows) and one as a different user (expects zero).
    Output: the migration file, the two queries, and one paragraph on what could go wrong on existing rows.
    8. Integrate a third-party API Keys server-side, failure handled first
    Integrate [API] for [purpose]. The key lives in an environment variable on the server and never reaches a client bundle.
    Handle, in this order, before any happy-path UI: missing key, network timeout, 4xx from the provider, 5xx from the provider, rate limit with retry-after.
    Log the provider's request id on every failure. Output: the server handler, the client call, and the error states the UI shows for each case.
    9. Migrate between versions or frameworks A plan before a rewrite
    We are moving [from X to Y]. Do not write code yet.
    List every file that must change, grouped by risk: mechanical (find and replace), behavioural (semantics differ), and unknown (needs a test to find out).
    Propose the order that keeps the app deployable after every step. Name the step where a rollback stops being cheap.
    Then wait for my go before the first step.
    10. Write the prompt for the next task Turn a vague ask into one of the nine above
    I am about to ask you to [vague task]. Before you do it, rewrite my request as a prompt with: the context you would need, the exact deliverable, what must not change, the states or cases to cover, and the questions you would ask me first.
    Show me that prompt. I will answer the questions, then you run it.

    Which of these have been run, and what happened?

    Prompts 1, 5 and 7 are the pattern behind three library prompts we ran in a personal Lovable workspace, reading the credits page before and after. Lovable's own rule for the loop that follows is worth quoting: “The single most important habit: one change per prompt, verify in the preview, then move on”, from its guide to building a product.

    Three library prompts built on the same skeleton, run and measured
     DateQuestions asked firstCreditsResult
    Landing page + email opt-in2026-07-3101.8One round, all five priority features, inline success state, Cloud enabled
    Empty states and skeletons2026-09-2629.5Asked 2 questions, built a /states gallery and a task list, verified slow load, failure and retry
    SaaS MVP with user auth2026-09-26410.4Asked 4 questions, enabled Cloud, self-tested sign-up and invites, roles checked in the database

    The prompt examples page shows the screenshots; the idea-to-app guide puts the runs in the whole path from brief to first users. What we have not done is run the ten prompts above through ChatGPT, Claude and Copilot side by side on the same repository. That is a benchmark, it needs a fixed codebase and paid seats on all three, and until it exists this page claims structure, not scores.

    Where should a good prompt live after you write it?

    Not in a chat window. Each tool has a place for instructions it reads without you pasting them, and the prompts above sort into them by how often they run:

    Where each kind of prompt belongs so it runs without pasting
     Put it inBecause
    Conventions that hold in every chat (parts of prompts 1, 7, 8)Cursor rulesA .mdc file attached by glob or always; three copyable files in the guide.
    A repeatable procedure (prompts 3, 4, 5, 9)a Claude Code skillInvoked by name, runs inside the conversation.
    A job whose output you do not want to read twice (prompts 4, 6)a Claude Code subagentOwn context window; only the report returns. One measured run in the guide.
    A builder's standing brief (prompts 1, 10)Lovable project knowledgeRead on every message; the answers to prompt 10 are what goes there.

    The prompt text is the same in all four places. What changes is how it gets in front of the model, and how much of your attention it costs each time.

    Sources

    All checked on 26 September 2026. Library statistics are computed from src/data/prompts.ts at build time; run data is in src/data/runs.ts.

    Frequently asked

    What are the best ChatGPT prompts for coding?↓
    The ones that carry context, an explicit deliverable, the boundaries of the change, the cases to cover, and a verification step, in that order. The ten on this page each do all five, which is why they are seven to nine lines rather than one. OpenAI's, Anthropic's and GitHub's own prompting guides converge on the same list, and every one of the 121 prompts in our library follows it, at a median of a few hundred words.
    Do these prompts work in Claude and Copilot as well as ChatGPT?↓
    Yes, with one adjustment each. Anthropic's guide favours XML tags to separate instructions, context and input on long prompts; OpenAI's favours markdown headers and lists; Copilot Chat's asks you to open the relevant files so it can read them instead of pasting code. The content of the prompt does not change. On a builder such as Lovable the same skeleton applies, plus the platform's one-change-per-prompt rule.
    How long should a coding prompt be?↓
    As long as the decisions it carries. A debug prompt that names the symptom, what was tried and what must not change is longer than 'fix this' and cheaper, because it removes the round trips. Our library's base prompts cluster tightly around their median because the structure is fixed and only the specifics vary; the shortest and the longest are on this page.
    Why do most prompt lists not show output?↓
    Because the prompts were not run. The three pages ranking for this query on 26 September 2026 list 25, 36 and 3 coding prompts respectively, all with bracketed variables and none with an output. Three of ours were run in Lovable on this site's own prompts, with credits read from the workspace and screenshots on the prompt examples page. We did not run the ten here through ChatGPT, Claude and Copilot side by side, and say so below.
    Should the prompt tell the model not to change tests?↓
    Yes, explicitly. Anthropic's prompting guide recommends reminding the model that removing or editing tests is unacceptable because it could lead to missing or buggy functionality, and has a section titled avoid focusing on passing tests and hardcoding. Prompt 5 carries that line; prompt 3 forbids test changes during a refactor for the same reason.
    Where should a good prompt live after you have written it?↓
    Somewhere the tool reads it without you pasting: a Cursor rule for conventions that hold in every chat, a Claude Code skill for a repeatable procedure, a subagent for a job whose output you do not want in your conversation, or Lovable's project knowledge for a builder. Our guides on Cursor rules, Claude Code commands and Claude Code subagents show each format with files you can copy.

    Related reading

    Written by

    Marco Kohns

    Marco Kohns

    Founder of ProtoBites - Venture Growth Studio

    Growth PM at a Silicon Valley scale-up (a16z and General Catalyst backed), ex-Techstars where he consulted 13 early-stage startups, Reforge-trained. Every prompt on this site comes out of shipping ProtoBites' own portfolio products.