The 3 Prompt Types Every SW Engineer Uses Daily: How to Make Them Better
From the publisher’s feed, collected in the ZeroLabs newsroom.
If you write software for a living, you do the following every day:You learn something new.You debug something broken or investigate the root cause of an issue.You build or refine some code to ship.Now for the uncomfortable part: if you use Generative AI and get inconsistent, shallow, hit-or-miss results, it’s because your prompts are unstructured.AI models are optimized for the average user. You are not the average user.You learn differently, reason differently, and write code differently. Unless your instructions reflect that, the AI assistant is left to figure out how to approach the problem on its own.User-instructions solve this. They let the AI assistant understand how you want it to think, not just what you want it to answer. Most coding assistants already support this (see the appendix).TL;DR: If you’re short on time (or patience), just feed your AI coding assistant the instructions in the appendix, pretend you read the whole thing and call it a day. We’ve all been there 😊.Think of user‑instructions as a lens in front of your prompt. Every time you ask a question, the AI assistant looks through that lens to understand what kind of help you’re looking for and how to approach it before generating an answer.Instead of tweaking the output over and over, you align the reasoning upfront.Let’s give that reasoning a shape.Below is a simple flowchart showing the three-prompt-patterns that engineers use daily. Treat it as a mirror, not a prescription. If it reflects how you think, keep it. If it doesn’t, sketch your own. What matters is not the shape of the flow, but that the flow reflecting your reasoning exists.The 3-Prompts Structure1st Prompt: When You’re Learning Something NewI bet you use prompts like these daily, often several times.“Explain Kubernetes networking”“Compare Redis vs Memcached”“What is WebAssembly?”Sometimes you get a great answer. Sometimes you get a wall of text. Other times you get something that sounds right but doesn’t stick.What you actually want is a consistent learning flow:# when the user asks for an explain or compare type of question, automatically:1. provide an executive summary.2. use analogies to explain complex concepts in simpler terms: think of a as b3. follow up with a first-principles based explanation.4. use a visual aid (ASCII diagram, table, etc.) if it would help with the explanation.5. Suggest a follow up action.Big picture first! (My ADHD brain is absolutely not signing up for three pages of confusion. Clear the fog before we dive in.)Hit me with a simple analogy. Something that makes me think, “Ohhh… yeah, I totally get this now.” Even if I don’t. Yet.Then go first principles mode: start from the fundamentals and stack the idea up layer by layer. No teleporting to the conclusion. Take me on a reasoning road trip till we arrive there.Show me something visual along the way. Boxes, arrows, diagrams, badly drawn napkin sketches, whatever it takes to make the mental model stick.And finally, don’t just stop. Tell me what to do next. Give me a breadcrumb trail so I know how to keep exploring instead of staring at the screen like, “Cool… now what?”Now every explanation behaves like: What it is → why it works → what you should do with itBelow is a simple example in ChatGPT explaining WebAssembly.Explain Prompt2nd Prompt: When You’re DebuggingYou ask, “Why is this failing?” and the assistant either guesses or hands you a fix before you even know what the problem was. This is simply because you didn’t enforce a debugging discipline.A proper debugging session isn’t guesswork (even if it occasionally feels that way). It follows a sequence:# when the user asks for help debugging, identifying, or fixing an error (including agent-mode), automatically:1. Ask for the error message if not provided. Provide help in how to generate or find the error message if the user is not sure.2. Provide a step by step explanation to root cause the problem.3. Suggest a fix for the problem. After the fix, identify any eng/dev principles violated.4. Recommend guardrails to prevent similar issues in the future.1. Start with the error (or find it)If the error message is missing, the model should stop and help you get it.You might be wondering, why wouldn’t I know the error message? Some failures are silent. For example: your web application loads, but no data shows up. In that case, a helpful AI assistant should realize the error message is missing from the prompt and guide you through something like: Browser → Developer Tools → Console/Network → look for errors and failing requests.2. Trace the chain of causality Instruct the AI assistant to walk through where the failure starts and how it propagates through the system. Identify the root cause (not symptoms), remember, most bugs have layers:Symptom → what you seeCause → what brokeRoot cause → why it brokeYou care about the last one, this is your Aha! moment, don’t let a quick fix rob you of this joy.3. Call out violated engineering principlesThe bug fix is just the first step; you need to understand what went wrong at the design level.Common examples:Poor input validation (nulls, malformed data, injection vectors)Missing error handlingTight coupling between components, queues that overflow and block,…4. Recommend guardrailsA good debugging session ends with prevention. Examples:Add input validationIntroduce structured loggingAdd retries or circuit breakersStrengthen type contractsAnd here’s where it gets even better, in your next prompt, you can ask:“Are these guardrails enforced everywhere in my codebase?”. Now you’re scaling the fix beyond a single bug. It’s improving your system by making it a system that gain from disorder. I.e., Antifragile!Let’s take a concrete example. You have a legacy application that writes logs to stdio, and you want to forward those logs to a telemetry service over TCP. You don’t want to touch the legacy app, so you redirect stdio into a Linux pipe and ask your AI assistant to generate a small pipe-reader that reads the pipe content and forwards the data.Pipe-reader overviewThe code compiles and works. But once it’s running, something’s clearly wrong. The pipe-reader is burning an entire CPU core. Yes this is a true story!At this point, the bug isn’t “high CPU”, it is just the symptom.Generated Code Silently Consuming an Entire CPU CoreSo we ask the AI assistant to help debug the issue, fix it, and explain how to avoid this class of problem going forward. The root cause is simple: the pipe-reader is polling the pipe in a tight loop. No blocking I/O. No backoff. Just busy spinning.Debug PromptBut the fix isn’t the main outcome. The lesson is.We now have concrete rules we can reuse, such as:Default to blocking I/O for pipes and streams.Treat polling as an exception, not a baseline.Review generated I/O code through a resource‑usage lens, not just correctness.That’s what good debugging produces. Not just working code, but a clearer mental model and guardrails you carry into the next problem.3rd Prompt: When You’re Building or CodingThis is where a ton of engineers accidentally leave AI’s superpowers on the table. They sprint straight to: “Write me a script that does X.” 🏃♂️And hey, AI happily spits out some code. Everyone claps. 🎉But lurking just offstage is everything that actually makes that code production‑worthy and it never got an invite:# when the user asks for help designing and creating a non-trivial solution (script, new project, etc.) automatically:1. summarize the requirements back to the user.2. ask interactively with Scrollable option picker if this is for production code or a learning exercise.3. if it is a learning exercise, implement the solution in a way that maximizes learning, even if it is not the most efficient or scalable solution. do not follow the next steps, simply use your judgment.4. ask interactively up to 5 follow up questions to clarify the requirements.5. if the answers to the follow up questions are not provided, or if I answer "use your best judgment", make reasonable assumptions, print out what you decided and why and only then proceed with the design.6. if the user provides vague answers to the follow up questions, follow up with 2 more clarifying questions (but no more).7. ask the user if more clarification is needed after the follow up questions, and if I answer "yes", then ask the follow up questions again, but this time with more specific options to choose from (using the Scrollable option picker).8. print the plan.md (if applicable) for the design of the solution, including the architecture, components, and interactions between them.9. proceed with implementing the solution, making reasonable assumptions where necessary. and follow these principles: a. follow best practices and design patterns where applicable: 1. Single Responsibility Principle (SRP) -- each module/class should have exactly one reason to change. 2. Open-Closed Principle (OCP) -- design modules to be open for extension but closed for modification. 3. Liskov Substitution Principle (LSP) -- derived types must behave substitutably for their base types. 4. Interface Segregation Principle (ISP) -- prefer many small, specific interfaces over large, general ones. 5. Dependency Inversion Principle (DIP) -- depend on abstractions, not concrete implementations. 6. KISS -- Keep It Simple; avoid unnecessary complexity. 7. DRY -- Don't Repeat Yourself; eliminate duplication of logic. 8. YAGNI -- You Aren't Gonna Need It; avoid adding functionality until required. 9. Separation of Concerns (SoC) -- isolate distinct responsibilities into distinct modules. 10. Low Coupling / High Cohesion -- maximize internal module focus while minimizing external dependencies. When principles conflict, prefer KISS and YAGNI over extensibility (OCP/DIP). b. write clean, maintainable, and well-documented code. c. ensure the solution is efficient and scalable.10. for every recommendation or design/implementation choice, append the "Decision Log" (create if missing) with: a. Decision b. Options Considered c. Pros d. Cons e. Why This Option11. important step (do not skip), analyze the resource consumption of the solution in terms of time, space, and any other relevant resources (networking, disk, GPU, etc.).12. important step (do not skip), analyze the security implications of the solution, identify at least 3 potential vulnerabilities and data privacy concerns.13. after the implementation, inform the user with the design decisions made, and any assumptions that were made.14. after the implementation, inform the user of the best practices and principles that were followed, and any that were violated.15. recommend guardrails to prevent potential issues in the future.16. after the implementation, analyze the generated code, and recommend at least 3 ways in which it can be improved, and prompt the user if they want to implement the improvements.As described above, the underlying goal is for the AI assistant to follow the same approach a good engineer would, starting with understanding the requirements.The easiest way to see why this matters is with an example. Let’s ask our AI to implement a feature using delightfully vague instructions (this time, we’re using GitHub Copilot CLI, because… why not?):“Implement a log-rotator feature that trims large log files.”That’s… impressively vague. We’ve essentially told the AI assistant, “It’s a log thing. It rotates. You’ll figure it out”.When the prompt is that vague, the AI assistant has to fill in a lot of blanks. That’s how you end up with code that technically works, but bakes in assumptions you never agreed to: size thresholds, retention policy, failure behavior, concurrency, performance, and even what “trim” means.Let’s see if our structured prompt can resolve the vagueness problem, we will go over the main steps of the instructions:1. Restate the problem Instruct the AI assistant to rephrase your request. This ensures alignment and surfaces misunderstandings early.GitHub Copilot CLI: Restating RequirementsNow that you see that your intent is understood at a high level (see the requirements summary in the Figure above), you’re ready now to proceed into the details.2. Decide: learning vs. production This single decision changes everything:Learning → optimize for clarity and understandingProduction → optimize for correctness, scalability, and safetyIf you don’t make this explicit, the AI assistant will guess, and you may not like the tradeoffs it makes.3. Ask targeted clarifying questions This is where the production-quality of the solution is determined.These interactive requirement‑clarification steps pull far more weight than they get credit for:First, they prevent hidden assumptions that love to quietly sneak into your code and show up later as “surprising behavior.”Second, they prove the model actually understands the problem. You can tell by the quality of the questions. Once it moves past “What language?” and starts asking things like “sync vs async?” or “what’s the deployment mode?”, you know you’re getting somewhere.And finally, they surface edge cases you probably hadn’t thought about yet. When you catch yourself thinking: “Huh… that’s a good question, let me think about my options for a second”, that’s usually a great sign. It means the conversation is working, and something better is about to emerge.The Figure below shows the list of questions the AI assistant asked about the log-rotator. At this point, the model isn’t guessing anymore; it’s reasoning. And that should give you a lot more confidence that it actually understands what you were trying to build.Detailed Questions Clarifying the Solution to Be Implemented4. Apply engineering principles Don’t assume the AI assistant will always do this well (some AI coding models are trained with those principles, but do you really want to make that assumption?). Explicitly require:SOLID (that would make “Uncle Bob” happy)KISS (Keep It Simple), DRY (Don’t Repeat Yourself), YAGNI (You Aren’t Gonna Need It)Being explicit here is what separates code that survives its first refactor from code that quietly accumulates debt.The Figure below illustrates the AI model’s output, clearly indicating the engineering principles applied during the creation of the log-rotator, and those that were omitted.Best Practices Analysis5. Track decisions and tradeoffs You own the code. Which means Future‑You will eventually have to explain why it behaves the way it does.If the decisions aren’t visible, reasoning about them later becomes a bit of an archaeological expedition.So don’t just ask the AI assistant for code, ask it to leave breadcrumbs. Instruct it to log:What it chose (the path it went down)What other options existed (the roads not taken)Why it made that choice (the reasoning behind the decision)Think of it as writing notes to your future self or the teammate who will inevitably ask, “Why on earth did we do it this way?”Decisions Made and Security Consideration6. Analyze performance and resource usageA real example we touched on earlier: an AI‑generated pipe-reader that passed tests but silently saturated a CPU core due to a tight polling loop.Now contrast that with the resource analysis for our generated log‑rotator shown in the Figure below. No red flags. No surprise CPU bonfires.Always ask your AI assistant to do a resource check, unless you enjoy discovering performance issues at 3 a.m.Resource Analysis Result7. Analyze security risks Generated code often misses subtle vulnerabilities, if it is not required to check for them. For example:Accepting/reading symbolic links when opening filesMissing input validationImproper auth checksThe goal isn’t to fix every risk immediately, but to make risks visible. You want the AI assistant to actively surface problems so you can decide whether to address them now or backlog them later.8. Reflect and improveAsk for a second pass. Make the AI assistant step back, review its work, and call out what must change before this is production‑ready.A great takeaway from our log-rotator example is the AI model suggesting a lock to prevent multiple log‑rotators from racing to rotate the same file. That’s a solid idea, but more importantly, it triggers better questions:How will this log‑rotator actually be deployed?Could multiple instances realistically run at the same time?Is a lock necessary, or would it just add complexity for no real gain?You might not change a single line of code. But just by stopping to ask those questions, you’re already designing a better system. That’s the real win.You might be surprised by what a second pass reveals. That’s normal. The first version is rarely perfect, and it doesn’t need to be. Code generation is iterative. This step just makes that iteration explicit and reinforces the right mental model: refinement is part of the workflow, not a sign you did something wrong.Final Thoughts:In the era of agentic AI, a code repository is already crowded with Markdown artifacts: agents, skills, workflows, prompts, instructions, constitutions, plans, and more. This article is not a replacement for them. It’s a gentle introduction to steering AI outputs so they line up with how you reason and what you expect.We used user-instructions since it was the simplest way to drive the point. Think of the user-instructions as helpful nudges, not a rigid checklist the AI assistant must blindly follow. Most of these ideas are flexible by design, and many of the principles can be applied in more than one way. For example:If you use a harness like GitHub Copilot or Claude Code, consider implementing three specialized (on-demand) prompts as .github/prompts/*.prompt.md instead of one combined set of (always-on) user-instructions. This can reduce context-token usage (slightly).For code review after you generate your code, use a separate AI model/agent that is optimized for review rather than reusing the same one that generated the code.The coding examples in this article are purposefully simple enough for interactive prompting. For a more formal development workflow, use tools like Spec-kit or OpenSpec to adopt a spec-driven-development process in which you capture assumptions and decisions.Remember, there is no single “right” way to use AI. Do what works best for you and your team.Acknowledgements Thanks to the reviewers who provided thoughtful and constructive feedback on early drafts.Appendix (the complete instructions for the 3 prompts)In the ChatGPT Client, you can specify the user-instructions under:settings → Personalization → Custom instructions.There’s a ~1,500 character limit in ChatGPT (at the time of the writing), so asking ChatGPT to summarize the instructions in this article is totally fair game. But hey, you’re a software engineer. You’re probably using a terminal and an Integrated Development Environment (IDE), right?In VS Code GitHub Copilot, you can place copilot-instructions.md under the .github directory in your workspace. In Claude Code… same idea...GitHub Copilot InstructionsThe complete content of the copilot-instructions.md file is shown below:# when the user asks for an explain or compare type of question, automatically:1. provide an executive summary.2. use analogies to explain complex concepts in simpler terms: think of a as b3. follow up with a first-principles based explanation.4. use a visual aid (ASCII diagram, table, etc.) if it would help with the explanation.5. Suggest a follow up action.# when the user asks for help debugging, identifying, or fixing an error (including agent-mode), automatically:1. Ask for the error message if not provided. Provide help in how to generate or find the error message if the user is not sure.2. Provide a step by step explanation to root cause the problem.3. Suggest a fix for the problem. After the fix, identify any eng/dev principles violated.4. Recommend guardrails to prevent similar issues in the future.# when the user asks for help designing and creating a non-trivial solution (script, new project, etc.) automatically:1. summarize the requirements back to the user.2. ask interactively with Scrollable option picker if this is for production code or a learning exercise.3. if it is a learning exercise, implement the solution in a way that maximizes learning, even if it is not the most efficient or scalable solution. do not follow the next steps, simply use your judgment.4. ask interactively up to 5 follow up questions to clarify the requirements.5. if the answers to the follow up questions are not provided, or if I answer "use your best judgment", make reasonable assumptions, print out what you decided and why and only then proceed with the design.6. if the user provides vague answers to the follow up questions, follow up with 2 more clarifying questions (but no more).7. ask the user if more clarification is needed after the follow up questions, and if I answer "yes", then ask the follow up questions again, but this time with more specific options to choose from (using the Scrollable option picker).8. print the plan.md (if applicable) for the design of the solution, including the architecture, components, and interactions between them.9. proceed with implementing the solution, making reasonable assumptions where necessary. and follow these principles: a. follow best practices and design patterns where applicable: 1. Single Responsibility Principle (SRP) -- each module/class should have exactly one reason to change. 2. Open-Closed Principle (OCP) -- design modules to be open for extension but closed for modification. 3. Liskov Substitution Principle (LSP) -- derived types must behave substitutably for their base types. 4. Interface Segregation Principle (ISP) -- prefer many small, specific interfaces over large, general ones. 5. Dependency Inversion Principle (DIP) -- depend on abstractions, not concrete implementations. 6. KISS -- Keep It Simple; avoid unnecessary complexity. 7. DRY -- Don't Repeat Yourself; eliminate duplication of logic. 8. YAGNI -- You Aren't Gonna Need It; avoid adding functionality until required. 9. Separation of Concerns (SoC) -- isolate distinct responsibilities into distinct modules. 10. Low Coupling / High Cohesion -- maximize internal module focus while minimizing external dependencies. When principles conflict, prefer KISS and YAGNI over extensibility (OCP/DIP). b. write clean, maintainable, and well-documented code. c. ensure the solution is efficient and scalable.10. for every recommendation or design/implementation choice, append the "Decision Log" (create if missing) with: a. Decision b. Options Considered c. Pros d. Cons e. Why This Option11. important step (do not skip), analyze the resource consumption of the solution in terms of time, space, and any other relevant resources (networking, disk, GPU, etc.).12. important step (do not skip), analyze the security implications of the solution, identify at least 3 potential vulnerabilities and data privacy concerns.13. after the implementation, inform the user with the design decisions made, and any assumptions that were made.14. after the implementation, inform the user of the best practices and principles that were followed, and any that were violated.15. recommend guardrails to prevent potential issues in the future.16. after the implementation, analyze the generated code, and recommend at least 3 ways in which it can be improved, and prompt the user if they want to implement the improvements.The 3 Prompt Types Every SW Engineer Uses Daily: How to Make Them Better was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.