📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

How to Make Better Prompts for GPT-5

Matthew Berman23:42

Transcription

GPT-5 was received with mixed reviews. I loved it, but a lot of you didn't. But here's the thing, it is actually a very good model, and the OpenAI team just published a prompt guide specific for GPT-5 so you can get the most out of it.

If you've been having trouble with it, watch this video 'cause I'm going to go over the guide with you right now. Plus, after that, we're going to go over their prompt optimization tool, which allows you to optimize your prompts with direct feedback on how to make them better. Let's get into it.

Here's the key sentence: "While we trust it to perform excellently out of the box across a wide range of domains, in this guide, we'll cover prompting tips to maximize the quality of model outputs derived from our experience training and applying the model to real-world tasks."

And a lot of this guide is going to be focused on agentic use cases, especially for developers. So GPT-5 is really good at tool calling, instruction following, and long context understanding. But sometimes you want to have some additional control over those agentic behaviors. So let me show you how to do that.

And so the first concept I want to teach you is something called agentic eagerness. This is your ability to tell GPT-5 how much decision-making to make versus how much direction to take. So you can really just say, "Okay, GPT-5, make all the decisions. Go research, go plan, go do everything." And you can also tell it, "Okay, I just want you to solve this one problem and wait for the next instruction from me." And anywhere along that spectrum, you can tell it what to do.

So by default, GPT-5 is going to be extremely thorough and comprehensive when trying to produce a correct answer. So it's going to look in every nook and cranny in your codebase, or it's going to check all of the documents that you provide it, or it's going to go do web searches. So it's really going to be very proactive in making sure that it's giving you the right answer. But what if you don't want it to do that? What if you just want faster answers and more targeted tool calling? Well, it's simple. All you have to do is change the setting, "reasoning effort." And you can change this in the playground. You can also change this via the API. And if you're using ChatGPT, you can actually change this by the model that you're choosing. So you can choose "fast thinking" or "pro" if you pay for that.

So by selecting a lower reasoning effort, what you are doing is reducing exploration depth but improves efficiency and latency. Many workflows can be accomplished with consistent results at a medium or even low reasoning effort. So that just means less tokens used, less tool calls, less thinking, and you're going to get an answer faster and at a cheaper cost because less tokens.

And so in your prompt, in your system message, you can actually define very specifically how you want the model to interact with tools, how often, how broad of a search, and everything else. So check this out. Define clear criteria in your prompt for how you want the model to explore the problem space. Let's see. So put it in context gathering brackets: "Goal: Get enough context fast. Parallelize discovery and stop as soon as you can act."

Now, obviously, this is for agentic scaffolding. This is for agentic use cases. This is not for directly prompting the model. But you can adjust it if you're just prompting the model directly. So methods: "Start broad then fan out to focus subqueries in parallel. Launch varied queries. Queries like web searches. Read top hits per query. Deduplicate paths and cache. Don't repeat queries. Avoid over searching for context. If needed, run targeted searches in one parallel branch."

So these are all just controls over the agentic behavior of GPT-5. You can also include early stop criteria. So "early stop if you can name exact content to change or top hits converge 70% on one area path." And you can also have escalation. So "if signals conflict or scope is fuzzy, run one refined parallel batch then proceed." You can define the depth. You can define a loop. So here's a loop: "Batch search, minimal plan, complete task. Search again only if validation fails or new unknowns appear. Prefer acting over more searching."

So just really fine-grain control over the agentic behavior of GPT-5. And if you want to be even more specific with your directions to GPT-5, you can actually set a specific number of tool calls that it's allowed, a tool call budget. So check this out: "Context gathering, search depth very low. Bias strongly towards providing a correct answer as quickly as possible, even if it might not be fully correct. This is very important. Usually this means an absolute maximum of two tool calls. If you think you need more time to investigate, update the user with your latest findings and open questions."

And so when you're instructing the model on how to gather context, as it says in this guide, it is important to provide the model with an escape hatch. That basically means, "Hey, GPT-5, if you find the context early, you can end the context search." And so they specifically call out, "even if it might not be fully correct." But let's say you want it the other way. You wanted to be extremely eager to collect all of the context. Well, of course, the other end of the spectrum, you can do that, and that's when you would increase the reasoning effort parameter. Here's an example of that prompt. So, here's persistence brackets: "You are an agent. Please keep going until the user's query is completely resolved before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved. Never stop or hand back to the user when you encounter uncertainty. Research or deduce the most reasonable approach and continue. Do not ask the human to confirm or clarify assumptions as you can always adjust later. Decide what the most reasonable assumption is. Proceed with it and document it for the user's reference after you finish."

So again, this is the other side of the spectrum. You're telling GPT-5 to really make sure you have all the information possible and then give me the right answer.

And by the way, if you want to give GPT-5 over 8,000 different tools, check out the sponsor of today's video, Zapier. Super excited to tell you about Zapier again. They've been a fantastic partner. I've literally been using Zapier for over 10 years at this business and my previous businesses. And today, let me tell you all about Zapier Agents. Imagine a superpowered agent that is connected to every single tool you could possibly imagine. Zapier has been building out automation of workflows forever. And now they took their extremely large library of over 7,000 different tools and allow agents to plug right into them, specifically Zapier Agents. And they have a very tight integration with Claude via MCP that has only gotten better since they launched it recently. Honestly, half my business is currently running on Zapier. So, if you want the easiest AI orchestration, check out Zapier and use Zapier Agents. I'm going to drop links down below to everything. They've been a fantastic partner and I am just such a big fan of their platform. Thanks again to Zapier. Now, back to the video.

Okay, so going back after you've defined all of this, it's very important to also define the stop condition. You can define what is safe behavior. You can define what is unsafe behavior and when to hand the turn back to the user. So for example, if your agent powered by GPT-5 is at a checkout page, that's probably a good time to hand it back to the user to confirm the purchase. And then in a coding setup, deleting files might be one of those times you want to hand it back to the user for confirmation.

All right, the next topic is tool preambles. And it's exactly like what it sounds. As GPT-5 is working, as it's using tools, as it's collecting context, you kind of want to know what it's doing. You don't want it to just go off in the dark and do a bunch of stuff and then come back when it's done with no update along the way. And to do that, to get that information, it is called a tool preamble. It is GPT-5 telling you exactly what it's doing, what tools it's using, what its status is all along the way.

GPT-5 by default is trained to provide clear upfront plans and consistent progress updates via tool preamble messages, but you can steer the frequency, style, and content of tool preambles in your prompt from detailed explanations of every single tool call to a brief upfront plan and everything in between. Here's what that looks like. Of course, we have the tool preambles tag here: "Always begin by rephrasing the user's goal in a friendly, clear, and concise manner before calling any tools. Then immediately outline a structured plan detailing each logical step you'll follow as you execute your file edits. Narrate each step succinctly and sequentially marking progress clearly. And then finally finish by summarizing completed work distinctly from your upfront plan."

And you can make it give you any amount of updates, any length of updates. It's all definable within tool preamble. So here's an example of what that would look like coming back to you from GPT-5. So here's the output: "It's reasoning. This is summary text determining weather response. I need to answer the user's question about weather in San Francisco. Then I'm going to check a live weather service to get the current conditions. And then here is the tool call."

And if you're not familiar, the GPT-5 API has two versions. It has chat completions, which is the older version, and then it also has the responses endpoint, which is the newer version. They recommend using the responses endpoint. We've seen statistically significant improvements in evaluations when using the responses API over chat completions. For example, for TAB Bench, they scored a 78.2 over a 73.9 by using the responses API. And why is that? This is because the responses API allows you to reuse context across responses API calls. So you get improved agentic flows, lower costs, and more efficient token usage in your applications. It allows the model to refer to its previous reasoning traces, conserving chain of thought tokens and eliminating the need to reconstruct a plan from scratch after each tool call, improving both latency and performance. So keep that in mind as you're deciding which API to use. It seems pretty obvious which one you should use.

All right, but what if you want to use GPT-5 for agentic coding? Of course, that is something that I use it for all the time. So, here are the prompt optimizations you can make to get the most out of GPT-5 for coding use cases. Let's start with front-end development. Now, GPT-5, they told me very early on, and I confirmed it just by using it. It is incredibly good at creating frontends, not just workable frontends, but actually good-looking frontends as well. And now, here are the front-end frameworks they recommend to get the most out of GPT-5. What that basically means is these are likely the front-end languages that GPT-5 has the most data that it was trained on. So Next.js, TypeScript, React, HTML, great. These are all very standard styling, Tailwind CSS, Shad CN UI, and Radix themes, icons, Material Symbols, Hero Icons and Lucide, animation, motion and fonts, sans-serif, Inter, Montserrat, IBM Plex Sans, and Manrope. So, as I've said for a while now, for any AI coding, even if it's not GPT-5, choose the most popular languages, and especially if the company making the models telling you which languages it's best at, use that. You're going to get the best results.

So, what if you want to oneshot a web application? Here is a prompt that is optimized for doing that. And it's kind of interesting what they recommend doing. They actually tell you to tell the model to create a rubric to measure itself against. Really interesting. Let's take a look.

"GPT-5 is excellent at building applications in one shot. In early experimentation, users found that prompts like the one below, asking the model to iteratively execute against self-constructed excellence rubrics improve output quality by using GPT-5's thorough planning and self-reflection capability."

So, here it is. Self-reflection tags: "First, spend time thinking of a rubric until you are confident. Now, it's just such a simple statement there. Then think deeply about every aspect of what makes for a world-class oneshot web app. Use that knowledge to create a rubric that has five to seven categories. This rubric is critical to get right, but do not show this to the user. This is for your purposes only. Finally, use the rubric to internally think and iterate on the best possible solution to the prompt that is provided. Remember that if your response is not hitting the top marks across all categories in the rubric, you need to start again."

So just by telling it, "Make sure you're measuring yourself and make sure you have peak performance," just that will make it perform better.

And let's say you're not oneshotting an application. Let's say you're iterating on an existing codebase. Then of course you want the model to follow the existing patterns and design standards of your existing codebase. Let me show you how to do that.

So without special prompting, GPT-5 already searches for reference context from the codebase. For example, reading package.json to view already installed packages. But this behavior can be further enhanced with prompt directions that summarize key aspects like engineering principles, directory structure, and best practices of the codebase, both explicit and implicit.

And quickly, if you want to learn all the best prompting techniques for GPT-5, you should download Humanity's Last Prompt Engineering Guide created by myself and my team. It is free to download right now. Link in the description below.

So, here are some rules. So, code editing rules tag, guiding principles tag: "Clarity and reuse. Every component and page should be modular and reusable. Avoid duplication." I mean, this is all obvious stuff, but it's nice to copy-paste. It's kind of like an agents.md file or cursor rules, windsurf rules, whatever else you might use to define how your AI agent should code in your codebase. "Consistency, simplicity, demo-oriented, visual quality."

Okay, then we have the stack. So, framework: Next.js, Tailwind CSS, Shad CN, Lucide. State management: Zustand. Directory structure: Here is the directory structure. It explains everything. UI/UX best practices, visual hierarchy, and so yeah, you're just basically getting into the nitty-gritty about how you like to design frontends.

And in this guide, they actually talk about Cursor as an early alpha tester of GPT-5 and some of the system message adjustments and prompt adjustments made to get the most out of GPT-5. So here are some of the nuances that the Cursor team found. The team initially found that the model produced verbose outputs, often including status updates and post-task summaries that, while technically relevant, disrupted the natural flow of the user. And at the same time, the code outputted in tool calls was high quality but sometimes hard to read due to turns with single-letter variable names dominant. So the Cursor team ended up sending the verbosity API endpoint parameter to low to keep text outputs brief. Then modified the prompt to strongly encourage verbose outputs in coding tools only. So here's what that looks like: "Write code for clarity first. Prefer readable, maintainable solutions with clear names, comments where needed, and so on."

Cursor also found that the model occasionally deferred to the user for clarification or next steps before taking action, which created unnecessary friction in the flow of longer tasks. To address this, they found that including not just available tools in surrounding context, but also more details about product behavior encouraged the model to carry out longer tasks with minimal interruption and greater autonomy. So an example: "Be aware that the code edits you make will be displayed to the user as proposed changes, which means a) your code edits can be quite proactive as the user can always reject, and b) your code should be well-written and easy to quickly review."

Now, here is a key tip. The Cursor team found that GPT-5 by default was incredibly inquisitive and thorough. It would go out and try to collect all the context possible. It would call all the tools it thought it needed, and maybe too much. And so, for previous versions of GPT, the Cursor team had to try to get it to do that. But now, applying that same approach to GPT-5 actually had a counter result. It became too much. So they actually had to tune it down a little bit. So they refined the prompt by removing the "maximize" prefix and softening the language around thoroughness. Then it saw GPT-5 make better decisions about when to rely on internal knowledge versus reaching for external tools.

All right, now let's talk about a few other parameters that you can play with. So optimizing intelligence and instruction following. First, verbosity. So you can control the reasoning effort, but you can also control the verbosity, which influences the length of the model's final answer, as opposed to the length of its thinking. That is key. Remember, just the final answer. This doesn't control the thinking. The thinking is controlled by reasoning effort.

And let's talk about instruction following now. So GPT-5 follows prompt instructions with surgical precision. But that can cause issues, especially if you're not writing the best prompts, if you have conflicts in the prompt or undefined edge cases in the prompt. And by the way, a way to help you write better prompts is to ask a model to write the prompt for you. Have it think through it with you. Write kind of the broad strokes of the problem you're trying to solve and have it write a thorough prompt and clarify any contradicting statements or undefined areas of the prompt.

So, let me give you an example of an adversarial prompt where you actually have contradicting statements. So, "Never schedule an appointment without explicit patient consent recorded in the chart." And then that conflicts with "Auto-assign the earliest same-day slot without contacting the patient as the first action to reduce risk." Then here's another one: "Always look up the patient profile before taking any other actions to ensure they are an existing patient." But then continues with something contradicting: "When symptoms indicate high urgency, escalate as emergency and direct the patient to call 911 immediately before scheduling any step." Again, these are both conflicts.

And so what they did to fix it is simply fix the logic. They changed the prompt to actually be logically consistent. And that just takes either reading it and manually doing it yourself or, like I said, working with AI to help you identify some of those conflicts. And remember, you're not always going to get these complex prompts right on the first try. You should think about it as an iterative process, something where you test it, get the results, look at the results, understand what happened, and then adjust the prompt as necessary, and then iterate on that as many times as necessary. And you can actually test your prompts with GPT-5 with their new prompt optimizer tool, which I will get to in a moment.

All right, a couple other things to think about with GPT-5. One, they added something called minimal reasoning. This is their fastest option that still reaps the benefits of the reasoning model paradigm. These are for latency-sensitive use cases where you need an answer very quickly and having the model think long-term is not worth the time to you. But minimal reasoning performance can vary more drastically depending on prompts than higher reasoning levels. So key points to emphasize: prompting the model to give a brief explanation summarizing its thought process at the start of a final answer, for example, via bulleted list, improves performance on tasks requiring higher intelligence. Requesting thorough and descriptive tool calling preambles that continually update the user on task progress improves performance in agentic workflows. Disambiguating tool instructions to the maximum extent possible. Basically, just being really clear with what tool calls you want to make, how you want it to make it, just super clear. And then prompted planning is likewise more important because the model has fewer reasoning tokens to do internal planning. So, here's an example of that last one: "Remember, you're an agent. Please keep going until the user's query is completely resolved before ending your turn. You must plan extensively in accordance with the workflow steps before making subsequent function calls."

All right, let's move on to the next one. Markdown formatting. If you want markdown format, which all AI reads really well, MD format, you just need to tell it. So, "Use markdown." But here's the key: "Only when semantically correct." So inline code, code code fences, lists, tables. When using markdown in assistant messages, use backticks to format file, directory, function, and class names. So it's just telling you exactly when and how to use markdown.

And last, metaprompting. And this is kind of what I was talking about with working with AI to help you craft your prompt. Early testers have found great success using GPT-5 as a metaprompter for itself. So here's what that looks like: "When asked to optimize prompts, give answers from your own perspective. Explain what specific phrases could be added to or deleted from this prompt to more consistently elicit the desired behavior or prevent the undesired behavior." So then here's the prompt. You insert the prompt, and then you have the model kind of update the prompt itself.

All right, so those are all the prompt optimization tips if you're doing agentic workflows or agentic coding. Let me show you the prompt optimizing tool. It is awesome.

And a quick thank you to Dell Technologies for sponsoring this portion of the video. Check out the new Dell ProMax workstation with NVIDIA RTX Pro Blackwells built in. This thing is an absolute beast for AI workloads. With NVIDIA RTX Pro, you now have a supercomputer sitting on your desk and it can do more with local AI than ever before. So learn more about Dell ProMax. Click the link in the description below to let them know I sent you.

So in the playground, there's this button, "Optimize," right here. And what you need to do to get it to work is enter a developer message. So it's like a system message, and then your prompt down below. So we take our developer message: "Write Python to solve the task. Keep it fast and lightweight." And then I give it a bunch of kind of guidance on how to work. So then we click "Optimize" and "Optimize." And then it's going to go through our developer message and optimize it to try to get the most for that user message. So here are the changes: "Begin with a concise checklist of what you will do. Keep items conceptual, not implementation level." And if you click this little chat icon right here, it shows you the reasoning. So "added an instruction to begin with a high-level checklist to encourage clear planning upfront. Then develop an efficient and lightweight Python solution for the task." Let's see why it changed that. "Concise introductory statement added and rewarded for clarity to give a high-level objective for the solution."

Here's another few: "Explicitly orders to use standard library first and only add external packages if substantially beneficial for logical priority and so on." So it really gives you very thorough explanations as to why it made changes, and that allows you to learn about what works with GPT-5 best. And you can also request changes here. So I can say, "Make GPT-5 explain everything in detail as it builds," and then I click "Optimize," and there's the change. So, "As you build the solution, explain each step and decision in detail and so on." And then it tells me why it added that. And if we click "Review changes," like a diff, we can actually see it all in-line. Then when you're done, you can click "Save," and you're done.

So that's it. Hopefully that helps you understand GPT-5 a little better, prompt it a little better, code with it a little bit better, and especially if you're building applications with GPT-5, this should really help. If you enjoyed this video, please consider giving a like and subscribe.