Prompting tips for coding with GPT-5

PDF Rewritten by o4-mini in bullet-point form. (913KB -> 3KB)

(looks like it also hit the prompt examples with some refinements)

Guide to Prompting GPT-5

While powerful, prompting with GPT-5 can differ from other models. Use these tips to get the most out of it via the API or in your coding tools.


1. Be Precise and Avoid Conflicting Information

  • GPT-5 models excel at instruction following[SIC] but can struggle with vague or conflicting directives.
  • Double-check your .cursor/rules or AGENTS.md files to ensure consistency.

2. Use the Right Reasoning Effort

  • GPT-5 always performs some level of reasoning.
  • For complex tasks, request a high reasoning effort.
  • If the model “overthinks” simple problems, either:
    • Be more specific in your prompt, or
    • Choose a lower reasoning level (e.g., medium or low).

3. Use XML-Like Syntax to Structure Instructions

GPT-5 works well when given structured context. For example, you might define coding guidelines like this:

<code_editing_rules>
  <guiding_principles>
    - Every component should be modular and reusable
    - Prefer declarative patterns over imperative
    - Keep functions under 50 lines
  </guiding_principles>

  <frontend_stack_defaults>
    - Styling: TailwindCSS
    - Languages: TypeScript, React
  </frontend_stack_defaults>
</code_editing_rules>

4. Avoid Overly Firm Language

With other models you might say:

Be THOROUGH when gathering information.
Make sure you have the FULL picture before replying.

But with GPT-5, overly firm language can backfire. The model may overdo context gathering or tool calls.

5. Give Room for Planning and Self-Reflection

When building “zero-to-one” applications, ask GPT-5 to plan and self-reflect internally before acting:

<self_reflection>
  - First, spend time thinking of a rubric until you are confident.
  - Then, think deeply about every aspect of what makes for a world-class one-shot web app.
    Use that knowledge to create a rubric with 5–7 categories.
    (This is for internal use only; do not show it to the user.)
  - Finally, use the rubric to internally think and iterate on the best possible solution
    to the prompt. If your response isn't hitting top marks across all categories,
    start again.
</self_reflection>

6. Control the Eagerness of Your Coding Agent

By default, GPT-5 is thorough in context gathering. You can prescribe how eager it should be:

<persistence>
  - Do not ask the human to confirm or clarify assumptions; decide on the most reasonable assumptions, proceed, and document them for the user's reference after you finish acting.
  - Use a tool budget to limit parallel discovery/tool calls.
  - Specify when to check in with the user versus when to move forward autonomously.
</persistence>

For more details, check out our full prompting guide. Use our prompt optimizer to improve your GPT-5 prompts.



(I used “markdown” for the monospace, which does some odd forum coloring, but there is no other code fence hint here that will word-wrap that I’ve found)

What’s the deal with using HTML-like tags in prompts. Is the model trained on it? Is that why one receives markdown tables full of HTML tag damage?