# How to Write Agent Prompts Better Than 99% of People

https://www.youtube.com/watch?v=nPysRgM2E84

[00:00] If you look at my side panel, you can
[00:01] see how many different GPTs I was
[00:03] creating, trying to solve this problem.
[00:05] I was working on this for like two days
[00:08] straight. And now, whenever I need a
[00:09] great looking PDF, all I do is open that
[00:12] GPT, drop in my content, and press
[00:14] enter, and I allow it to create the PDF
[00:17] for me. No more headaches because I had
[00:20] a problem, I solved it, and then I
[00:22] standardize it. And I'm going to show
[00:24] you how to do that in this video. If you
[00:26] write a new prompt every time you use
[00:27] AI, then you're using it wrong. I'm
[00:29] Corey Mlan and I help professional
[00:31] creators, operators, and solarreneurs
[00:33] turn AI into reliable infrastructure.
[00:36] This video is a part of my series titled
[00:38] Systems Over Luck, a new series of deep
[00:40] dive videos into how we can use AI
[00:43] better so we actually use it less. And
[00:46] if you want to fasttrack this process, I
[00:48] just launched my 1hour content strategy
[00:50] kit. The link will be in the
[00:51] description. But today, I'm showing you
[00:52] the only two things that actually matter
[00:54] when it comes to building these systems,
[00:56] and that's the library and the logic.
[00:58] The reason I say you're using AI wrong
[01:00] if you're starting with a prompt every
[01:01] time you use it is because you don't
[01:03] realize how much time you're actually
[01:06] losing by doing that. Every time you
[01:08] have a conversation, you have to explain
[01:10] your business. Every time you have a
[01:11] conversation, you have to explain the
[01:13] different challenges and constraints in
[01:15] your life. Every time you start the
[01:17] conversation, you have to think, okay,
[01:19] what am I doing here? How do I do it?
[01:22] And it's this repetitive process that
[01:24] you don't realize is adding up over the
[01:27] weeks. the months and the years and is
[01:30] stealing time away from you. And I know
[01:32] that you feel it. You sit down at the
[01:33] laptop, you start working on a project,
[01:36] you're chatting back and forth with AI
[01:38] and before you know it, you've spent
[01:40] hours just to accomplish maybe a small
[01:43] amount of work. And so instead of you
[01:44] being more productive with it, you feel
[01:47] like it's a intern that you have to
[01:49] babysit that's always asking questions
[01:52] or getting things wrong and then you
[01:53] have to correct it. And it's like, how
[01:55] did you not catch this an hour ago? And
[01:58] so, what I want to do is introduce you
[01:59] to my system for working with AI, using
[02:02] AI to be more productive that will
[02:05] automatically save you so much time and
[02:07] keep you from falling into those time
[02:09] traps that just steal all your time
[02:11] away. You can probably save around 10
[02:13] hours a week just by doing this one
[02:15] thing. Whenever you solve a problem,
[02:17] whenever you've been in one of these
[02:19] conversations with AI, you've gone back
[02:21] and forward, you've looked at different
[02:23] solutions, and it finally came upon the
[02:25] right answer, and you're filled with
[02:27] anxiety and frustration because you're
[02:29] sitting there thinking, "Why didn't you
[02:30] come up with this 3 hours ago? We talked
[02:33] about it, but you didn't mention it. You
[02:35] didn't bring it up." Just pause. Let the
[02:38] frustration and anxiety go. And this is
[02:40] what you want to tell the AI in so many
[02:42] words. Let's turn this conversation into
[02:45] a standardized workflow. Map out the
[02:48] steps where we got things wrong. Map out
[02:50] the steps where we got things right. And
[02:52] that's the logic of the problem that you
[02:55] just solved. Because once you solve that
[02:57] problem once and you standardize it, you
[03:00] never have to deal with that problem
[03:02] again. I'll give you a perfect example.
[03:04] I was trying to find a new way to design
[03:06] some great-looking PDFs and I did find
[03:09] one. And in that process, I ran into a
[03:12] lot of problems. I learned a lot of new
[03:14] things about printing and browsers and
[03:17] different platforms where you can print
[03:18] things. And at the end of the
[03:19] conversation, I simply have the AI turn
[03:22] it into a standardized process. So that
[03:25] now whenever I get ready to create
[03:27] beautiful, professionallook PDFs that
[03:30] match my brand, it's as simple as
[03:32] copying and pasting a simple prompt. I
[03:35] could even set it up as a custom GPT
[03:37] where all I have to do is drop in my
[03:39] content and it automatically gives me a
[03:42] beautiful well-designed PDF. So, not
[03:45] only am I saving countless hours every
[03:48] week as I'm creating this content and
[03:50] these assets to share with my audience,
[03:52] but I'm also saving money because I
[03:54] don't have to go to Fiverr and pay
[03:55] someone to create it for me. So instead
[03:57] of saying chat GPT, write a blog post
[04:00] for me. The next time you sit down to
[04:02] actually write a blog post, think about
[04:05] your process. Where does your research
[04:07] start? What do you do after that? How do
[04:09] you decide what tone to write it in? How
[04:11] do you decide what length? What I like
[04:13] to do is use the voice memos app on my
[04:15] iPhone. And after I get through
[04:17] recording, there's three dots you can
[04:18] tap and you'll see a tab that says copy
[04:21] transcript. And the reason I do this is
[04:23] because you can do an 8 to 10 minute
[04:25] brain dump and just talk about your
[04:27] process. You can go backwards and
[04:29] forwards and lateral with your thinking
[04:31] and you can just think the whole thing
[04:33] out without trying to sit down. Make
[04:35] sure you get everything in the right
[04:36] order. Erase, move things around. You
[04:38] don't have to do all of that, right?
[04:40] Just do a brain dump on your phone, copy
[04:42] the transcript. You won't have to wait
[04:44] 90 seconds like you will if you do the
[04:47] dictation inside chat GPT Claude or
[04:49] Gemini. And then you just paste it. And
[04:52] then the AI is going to organize your
[04:55] process. You look at that process. You
[04:57] add notes, anything else. And it takes
[05:00] about 5 minutes tops. You're going to
[05:02] have your entire process laid out in
[05:05] front of you. And as soon as you do this
[05:07] with the first problem you solve, you
[05:08] will have taken the first step in moving
[05:11] away from being a chatter to becoming an
[05:14] architect. And this is one of the
[05:16] biggest problems I see with chat GPT
[05:18] right now. It has remained a vertical
[05:20] platform from its inception to the
[05:22] moment now. Whereas platforms like
[05:25] Gemini and claw are beginning to fan out
[05:28] laterally and create other features and
[05:31] platforms like co-work skills, notebook
[05:35] LM and more that allow you to experiment
[05:38] or be more productive and more creative
[05:40] with AI. Whereas chat GPT is still
[05:43] basically a back and forth conversation
[05:45] that is eating up a lot of your time.
[05:48] This step-by-step system that you've
[05:50] laid out is going to become your logic,
[05:52] but it's not everything that goes into
[05:54] logic because there's a lot of problems
[05:56] that you can run into with AI. And a lot
[05:58] of people think that they have to keep
[06:00] giving it these prompts because if I'm
[06:02] not constantly prompting AI, then who's
[06:05] driving the car? And if I just let this
[06:07] probabilistic large language model do
[06:09] what it wants to do, then how do I keep
[06:12] it from hallucinating? How do I keep it
[06:13] from drifting? How do I keep it from
[06:16] just going awall? And those are all
[06:18] valid questions, all valid concerns. And
[06:20] so I want to introduce you to the idea
[06:22] of a router prompt. I've talked about
[06:24] this several times on the channel, but I
[06:25] really want to focus on it now. Because
[06:27] a router prompt is one of the most
[06:30] important prompts that you will ever
[06:32] write. And actually, it's the last
[06:34] prompt you should ever write. And I'll
[06:36] explain why in a moment, but not right
[06:38] now. So the router prompt is the prompt
[06:40] that controls everything. It is the
[06:43] place where your step-by-step logic will
[06:46] live. if it can live there and I say if
[06:49] it can live there because of different
[06:51] platform constraints and platform
[06:52] preferences. If you prefer chat GPT as
[06:55] your platform then you have to
[06:57] understand that with your custom
[06:58] instructions in projects and in custom
[07:01] GPTs you are limited to 8,000
[07:04] characters. I don't know why we're still
[07:06] limited 8,000 characters there but
[07:08] that's the state of the affairs. If
[07:10] you're using Claude or Gemini, then you
[07:13] don't have any problems. Your
[07:14] instructions can be as long as you want
[07:16] them to be. I've had instructions that
[07:18] are 13 to 14,000 characters and they fit
[07:22] inside of the custom instructions just
[07:24] fine and the AI had no problem following
[07:26] it at all. So those platforms are good.
[07:29] But essentially the first component of
[07:32] your router prompt is going to be your
[07:34] governance layer. And so you might call
[07:36] this your constitution, your rule book,
[07:38] but it's a list of things that tells the
[07:42] AI what the boundaries are. It sets the
[07:44] stage for the game and controls the way
[07:47] it behaves. And so I like to write this
[07:50] with machine language and in a
[07:52] deterministic tone so the AI understands
[07:54] that these rules, these laws are
[07:57] immutable. There's one system I created
[08:00] where if there wasn't enough data, it
[08:02] should immediately stop and not go
[08:04] forward because the results would be
[08:06] subpar and you really couldn't put any
[08:08] trust in the results because you don't
[08:10] have enough data. And so I was using
[08:11] this system the other day and I was
[08:13] trying to get it to go past it, not
[08:16] realizing that I put a governor on it. I
[08:18] put a lock on it that if it's not enough
[08:20] data, it's not going to work. And so I
[08:21] had to just go inside of it, rewrite the
[08:24] system instructions or the constitution.
[08:27] And then it would actually let me go by
[08:29] the second component that I always place
[08:32] inside of my router prompt is a
[08:34] registry. The registry is either going
[08:36] to be a link to the file if it's hosted
[08:39] on a virtual private server because with
[08:41] chat GPT I've had to do that in the past
[08:44] or it's going to be a list of files that
[08:46] I have uploaded to the library. And this
[08:49] registry just gives the model context on
[08:53] what it's going to be working with so
[08:55] that when I reference these files later
[08:57] on, it has something to tie it back
[08:59] into. And the final component of every
[09:02] router prompt is conditional logic. So,
[09:04] we take that step-by-step scenario that
[09:07] we created earlier for say writing a
[09:09] blog post and then we convert that into
[09:11] conditional logic. So, I've been doing
[09:14] this for a while, so a lot of times I
[09:15] get it right the first time around. But
[09:17] what I like to do is I'll take that
[09:19] step-by-step procedure that the AI has
[09:21] lined out for me from my brain dump. and
[09:24] I'll open it up on my monitor screen and
[09:26] then I'll take my phone and I'll do a
[09:28] voice memo and I'll just look at the
[09:30] screen and review everything that's
[09:31] written line by line and I'll talk about
[09:34] how I make decisions at these different
[09:37] points and places where I have to stop
[09:40] or the system should stop and get
[09:41] feedback from the operator. I just
[09:43] include everything that I possibly can
[09:46] and I just leave all the notes for
[09:48] conditional logic so the system
[09:50] understands well at this point if it's
[09:52] this topic then it needs to be titled
[09:54] this way and if it's this then it needs
[09:56] to be this and so forth and then I drop
[09:59] that voice recording into the
[10:01] conversation on my iPhone. I refresh my
[10:04] browser so I can keep working on my
[10:06] monitor or on my desktop. And just like
[10:08] that, I have a new set of step-by-step
[10:10] instructions that have conditional logic
[10:13] embedded within it so that the AI is
[10:16] prepared to deal with any situation in
[10:19] the same way that I would deal with it.
[10:21] And so these steps can become quite
[10:24] lengthy, but the way that I number them,
[10:26] I use an alpha numerical system. And so
[10:28] we'll have step A might be title the
[10:31] blog post. And so within step A, it
[10:34] might be a.1, a.2. And so we get as
[10:37] granular as we need to to make sure that
[10:40] the full decision tree and condition of
[10:43] the logic is captured one time and one
[10:45] time only and the AI knows exactly what
[10:48] to do and it knows not to skip any
[10:51] steps. And this is how we make certain
[10:53] that we can just hand the keys over to
[10:55] the AI and we can trust that it's going
[10:58] to give us a high quality output or in
[11:01] most cases a quality output comparable
[11:04] to our own because if we're building the
[11:06] system it can only do what we give it.
[11:07] But now that we have the logic in place,
[11:10] the next thing that I want to talk to
[11:11] you about is the library. The AI knows
[11:13] the boundaries. It knows what it should
[11:15] and shouldn't do. It knows the
[11:17] step-by-step procedure. It has the
[11:19] conditional logic. But now what the AI
[11:22] needs to really excel and create that
[11:25] high quality content output or
[11:28] consistent activity is a library. And in
[11:31] the library, you might think about claw
[11:34] skills. It's going to be all of the
[11:36] different files, folders, PDFs, how-to
[11:40] knowledge, frameworks, data mining, just
[11:43] everything you could possibly think that
[11:45] the model will need to perform the task
[11:48] at hand. So let's just say that you have
[11:51] an accounting workflow that you're
[11:53] building and there's a lot of equations
[11:55] that the model needs to use very
[11:57] specific equations for amortization or
[12:00] different things like that from Excel or
[12:01] something then you might have a database
[12:04] with the 15 or 20 formulas that you use
[12:08] and these are the only ones it should
[12:09] ever use and you might have them labeled
[12:11] and you might tell the model when to use
[12:13] it within the conditional logic etc. And
[12:16] so you would upload that so that the
[12:18] model knew the exact equation that you
[12:20] wanted it to use and it wouldn't be
[12:21] trying to figure it out. The more you
[12:24] tell the model what to do, the more you
[12:27] give it the resources that it needs to
[12:29] do the things you told it to do, the
[12:30] less hallucination I personally see with
[12:33] all of these models across the board. So
[12:36] if you're someone who just sits back and
[12:38] you want to ask the AI to do it, you
[12:41] definitely need to check your work. But
[12:42] if you're someone who's building the
[12:45] system based on solving the problem one
[12:47] time and then giving the model
[12:49] everything it possibly needs to carry
[12:51] out this task in the future, then you
[12:54] still need to check the outputs, but you
[12:56] can have a lot more confidence that
[12:57] those outputs are going to be right
[12:59] every single time. There might be some
[13:01] edge cases where it hallucinates after a
[13:04] very lengthy conversation, but for the
[13:06] most part, you can have a lot of trust
[13:08] in the outputs that you receive. So when
[13:11] it comes to components of a library, one
[13:14] of the most important components is
[13:16] synthetic data. And synthetic data is
[13:18] basically it's data that's not real, but
[13:21] it's formatted like it's real and you
[13:23] use it to give the AI expertise
[13:26] knowledge. Another component of the
[13:28] library is artifact templates. So for
[13:31] instance, if you have proposals that you
[13:33] send out on a regular basis and you like
[13:35] your proposals to be formatted a certain
[13:37] way, then I would create a template of a
[13:39] proposal, upload it to the knowledge
[13:41] base, and inside the instructions, I
[13:44] would tell it to pull such and such file
[13:46] when you get ready to create the final
[13:48] proposal. And the third component of a
[13:50] healthy library is going to be prompts.
[13:52] Sometimes the custom instructions are
[13:55] going to be so detailed that you need
[13:57] other prompts to carry out the smallest
[13:59] task. So, for instance, and I know you
[14:02] guys would like to see examples outside
[14:03] of content creators, but I'll just use
[14:06] myself first, then I'll try to come up
[14:07] with one for outside of content
[14:09] creation. But let's go back to the blog
[14:11] post writing and titling. You might have
[14:13] a prompt that is specifically activated
[14:16] when you're at the title writing stage.
[14:18] And it has an entire way of writing
[14:21] titles and coming up with ideas for
[14:23] titles that is unique to your workflow,
[14:26] that is unique to the way that you
[14:27] think. And then after it writes the
[14:29] title, it immediately reverts back to
[14:32] the custom instructions inside your
[14:34] router prompt. And in this way, instead
[14:37] of you trying to cram all 15 or 20
[14:40] prompts into a single prompt, you can
[14:43] break them up into smaller prompts that
[14:44] focus on individual tasks. And each of
[14:47] those prompts can focus on being an
[14:50] expert at that particular thing. And if
[14:52] you like you can either create separate
[14:55] knowledge packs that you upload to
[14:57] assist those particular prompts or you
[14:59] can embed the knowledge within the
[15:01] prompts. And this way the router prompt
[15:04] can say okay let's run prompt number one
[15:06] then prompt number two then prompt
[15:08] number three. So instead of trying to
[15:10] place your conditional logic in the
[15:12] prompt that actually captures your
[15:14] workflow inside of the custom
[15:16] instructions, especially if you're using
[15:18] chat GPT, you can simply take that
[15:20] prompt, upload it to your library, and
[15:23] inside of your router prompt, you'll
[15:25] tell the AI to start with that prompt
[15:27] and use it as the overarching prompt for
[15:30] the entire workflow every time a
[15:32] conversation is started. And it works
[15:34] like magic. And that is exactly why your
[15:37] router prompt should be written last
[15:39] because after you've laid out the
[15:41] workflow, you have the conditional
[15:43] logic, you have an idea of the rules,
[15:46] you need to build your library. Because
[15:48] once you build your library and you know
[15:50] the outputs that you want, you know what
[15:53] you need to get those outputs, you've
[15:55] created your synthetic data if you need
[15:57] expert knowledge, you've created your
[15:59] artifact templates if you need to teach
[16:01] it how to do something or give it a
[16:03] document that allows it to do it in a
[16:05] standardized way, high quality every
[16:08] single time. Or you have several
[16:10] different prompts that it needs to
[16:11] complete and you've written all of those
[16:13] prompts and everything is ready. Then
[16:15] you write your router prompt because now
[16:18] you have the view of the full landscape
[16:20] and that's the only way you can write an
[16:22] effective router prompt if you know
[16:24] everything that needs to happen every
[16:26] file and how every file needs to be used
[16:28] and when it needs to be used and under
[16:30] what circumstances. But once you write
[16:32] that router prompt, you have a system
[16:36] that will take hours away from you just
[16:39] sitting in front of your laptop staring
[16:41] and wondering how to get this done
[16:43] because you chose to solve the problem
[16:45] once and then document it by turning it
[16:48] into a standard workflow. And this is
[16:51] especially helpful when it's something
[16:52] that you know you're going to be doing
[16:54] on a consistent basis. And so if you
[16:57] want to, you can absolutely keep giving
[16:59] the AI prompts, keep giving it messages,
[17:01] and keep trying to get the best response
[17:03] from it. But in my opinion, it's best if
[17:06] you begin to build your own
[17:08] architecture, build your own systems so
[17:11] that you can have a smoother ride and
[17:13] experience with AI and get high quality
[17:16] content every single time, high quality
[17:18] outputs every single time. And so the
[17:21] next time you have a problem or a
[17:22] difficult conversation with AI, don't be
[17:25] discouraged. Think about it as an
[17:27] opportunity. Ask yourself, is this
[17:29] something that I'm probably going to be
[17:31] doing again tomorrow or next week, or is
[17:33] it something that I know I do
[17:35] consistently on a regular basis or that
[17:37] I use AI for on a regular basis? And if
[17:39] the answer is yes, then come back to
[17:41] this video, watch it again if you need
[17:43] to, or drop the transcript in the chat
[17:45] GPT and ask for instructions on how to
[17:48] do this here and then create an asset, a
[17:50] tool that you can use on a repeatable
[17:53] basis. If you got value out of this
[17:54] video, make sure you hit the like
[17:55] button, hype the video, subscribe to the
[17:58] channel, and as always, take care, have
[18:01] a great day, and be on the lookout for
[18:02] the next video in the series that'll be
[18:04] right Here.
