{"slug": "prompt-engineering-how-to-actually-get-what-you-want-from-ai", "title": "Prompt Engineering: How to Actually Get What You Want from AI", "summary": "Prompt engineering is a method of writing structured instructions to improve AI output quality, using frameworks like Google's TCREI (Task, Context, References, Evaluate, Iterate) to provide clear tasks, context, and personas. The approach helps users get more relevant and useful responses from generative AI models.", "body_md": "You ask an AI to help you prepare for an interview. You get back twenty generic questions you could have found on any blog.\n\nYou ask again. This time you mention that you are an entry-level developer, that you know the MERN stack, and that you want the answers in a table. Suddenly it is useful.\n\nSame model. Same knowledge. Different prompt.\n\nThat gap, between the generic answer and the useful one, is what prompt engineering is about.\n\nAI has been with us far longer than most people realise. Ever wondered how your mobile keyboard suggests the next word while you are typing? That is AI too, just a very narrow use case of it.\n\nCompare that with today's AI, which can answer our day-to-day questions, help with our tasks, generate articles, taglines and summaries, and even produce images and video, all from a simple text instruction.\n\nThat instruction is known as a **prompt**.\n\nNow take a child as an example. When they are young, they speak gibberish which is hard to understand. But as they grow up, they communicate better, and it becomes easier to understand what they want.\n\nA similar idea applies to Generative AI. If our instructions are unclear, the AI may misunderstand our requirement and produce a result that is off-target, irrelevant, or incomplete.\n\nSo how do we communicate with AI more effectively?\n\nThat is where **prompt engineering** comes in.\n\nPrompt engineering is a method of writing prompts in a structured manner so that we provide the AI with the required information, relevant context, examples, and clear instructions.\n\nThis helps the AI generate a result that is closer to our expectations.\n\nWe can also use **prompt chaining**, where we break a big task into steps and feed the output of one prompt into the next.\n\nAlthough there isn't one specific rule for creating the perfect prompt, a structure taught in Google's prompting course that may be useful is **TCREI**:\n\n**T — Task**\n\n**C — Context**\n\n**R — References**\n\n**E — Evaluate**\n\n**I — Iterate**\n\nLet's understand each of them.\n\nThis is where we specify the task we want the AI to perform.\n\nIt can be:\n\nThe task is the main instruction, the one thing you want the AI to do.\n\nIt can also have two additional parts.\n\nHere we associate a role or personality with the AI, so that it approaches the task from that perspective.\n\nFor example:\n\nAssume you are a software developer with 15 years of experience.\n\nOr:\n\nAssume you are a store manager with 10 years of experience.\n\nA persona reliably changes *how* the answer is written: the vocabulary, the depth, and what the model assumes you already know. \"Explain this as a senior developer would\" and \"explain this as a teacher would\" produce genuinely different answers.\n\nWhat a persona does not do is make the model *know* more. \"You are an expert cardiologist\" does not add medical knowledge it did not already have. Use a persona to shape the framing, not to buy accuracy.\n\nIt is also a good idea to specify the format in which we want the result.\n\nGive me a table with five points.\n\nProvide the answer in three paragraphs.\n\nFormat the output as CSV with the columns: Question, Topic, Difficulty, Answer.\n\nThis helps us get an output that is more useful and closer to what we actually need.\n\nContext is important for AI because it helps create the background related to the task.\n\nIt is just like the background we provide before narrating a story to someone.\n\nImagine this prompt:\n\nAnalyze the given data and generate a profit and loss summary.\n\nGood. But it only tells the AI what to do. It doesn't tell it much about the situation.\n\nNow consider this:\n\nHere is a company's sales data for the last year, including revenue, purchases, salaries, and other operating expenses. Analyze it and give me a profit and loss summary as a table.\n\nHere we have also provided a background related to the task. This makes the requirement more specific and gives the AI additional information it can use.\n\nPrompt 2 gives the AI something to work with. Prompt 1 makes it guess.\n\n\"References\" actually covers two different things, and they are worth separating.\n\nOne is **examples**, where we show the pattern we want. The other is **source material**, where we paste in the actual document, spec, or data the answer should come from.\n\nThe second one is powerful. The model cannot make up an answer if you hand it the real one.\n\nLet's look at examples first, since that is where most of the technique lives.\n\nInstead of simply saying:\n\nExplain React.\n\nWe can provide an example of the expected format:\n\nDefine React → Answer\n\nHow React works → Answer\n\nWhat is ES6 → Answer\n\nNow the AI has a reference for how we want the output to look.\n\nThere are different variants of prompting based on how many examples we provide.\n\nIn this approach, we don't provide any example. The AI has to rely on its pre-trained knowledge and the instruction we gave it.\n\nExplain what React is in simple terms.\n\nThere is no example here.\n\nZero-shot works well for simple, direct questions and everyday tasks. When the output isn't coming back in the shape you want, that is the signal to start adding examples.\n\nIn this approach, we provide **one example** in the prompt. The example acts as a blueprint for the desired output.\n\nConvert the following sentence into a professional tone.\n\nExample:\n\n\"Hey, send me the report ASAP.\" → \"Please share the report at your earliest convenience.\"\n\nNow convert:\n\n\"Hey, fix this issue quickly.\"\n\nHere the AI can understand the expected transformation from the single example.\n\nIn this case we provide multiple examples so that the AI can identify the pattern and generate the expected output.\n\nReact → Frontend Library\n\nExpress → Backend Framework\n\nMongoDB → Database\n\nNode.js → ?\n\nThe AI picks up the pattern and answers \"JavaScript Runtime\".\n\nThough watch out for something here. My three examples were all library, framework and database, so a model following that pattern too literally might answer \"Backend Framework\", which is wrong. Node.js is a runtime.\n\nThat is the real risk with few-shot: examples don't just show the format, they **bias the answer**. Choose examples that cover the range of answers you actually expect.\n\nOne more thing on quantity. Providing irrelevant or contradictory information hurts, because the model has no way to know which parts to trust. But *good* examples generally don't. The old advice was \"two to five examples, no more\", and that was reasonable when context windows were small. With today's much larger context windows, more consistent examples usually help rather than hurt.\n\nSo the goal is not fewer examples, and not more examples. It is **consistent, relevant** examples.\n\nBy this point we have the output generated by the AI.\n\nNow our task is to evaluate whether it meets our requirements and follows the instructions in the prompt.\n\nThis is a crucial stage. We should check things like:\n\nDid the AI perform the correct task?\n\nDid it follow the requested format?\n\nIs the information relevant?\n\nIs anything missing?\n\nAnd the one that matters most:\n\nIs it actually correct?\n\nA well-formatted, on-topic, confident answer can still be wrong. If the output contains facts, figures, version numbers, or API details you are going to rely on, check them somewhere else.\n\nThis evaluation becomes especially important when we continue the conversation using the generated result as context. If we don't identify problems early, we end up building on an incorrect result.\n\nNow we have evaluated our result. If the result is what we wanted, we are done.\n\nBut if something went wrong, this is where we correct the AI. We tell it what went wrong and what we want instead.\n\nThe format is correct, but you included unnecessary technical details. Keep the explanation beginner-friendly and limit it to five points.\n\nThis also gives us an opportunity to improve our own prompt, because sometimes the problem is not with the AI. Sometimes we simply didn't provide enough information, context, or clear instructions in the first place.\n\nSo prompt engineering is also an **iterative process**.\n\nLet's put everything together.\n\nSuppose I am preparing for a frontend interview. I could give the AI a prompt like this:\n\nYou are a senior software developer with 10 years of experience.\n\nI want you to help me prepare for my upcoming frontend interview. I am an entry-level developer with MERN stack experience and basic AWS knowledge.\n\nList the questions I am most likely to be asked based on current frontend interview trends.\n\nFormat the output as CSV with the columns: Question, Topic, Difficulty, Answer.\n\nUse the following examples to understand the type of questions I am looking for:\n\nDefine React → Answer\n\nHow does React work? → Answer\n\nWhat is ES6? → Answer\n\nNow look at what we have included:\n\n**Persona:** Senior software developer with 10 years of experience.\n\n**Task:** Help with frontend interview preparation.\n\n**Context:** Entry-level, MERN expertise, basic AWS knowledge.\n\n**Format:** CSV with specific columns.\n\n**References:** Examples of the expected questions.\n\nNow notice one weak spot in my own prompt. I asked for \"current trends\". Unless the tool I am using has web search turned on, the model has no idea what is current. It will produce something plausible from its training data and present it confidently.\n\nThis is exactly the EVALUATE step doing real work. I should either turn on web search, paste in a few recent job descriptions as source material, or drop the word \"current\" and accept that I am getting general fundamentals.\n\nThat is the whole idea.\n\nThe TCREI structure covers the bulk of it, but a few smaller habits make a noticeable difference.\n\n**Separate your instructions from your data.** If you are pasting in a long document, wrap it so the model knows where your instruction ends and the content begins:\n\nSummarize the document below in five bullet points.\n\n--- DOCUMENT ---\n\n(paste here)\n\n--- END DOCUMENT ---\n\nWithout a separator, the model can read your pasted content as part of the instruction.\n\n**Say what you want, not what you don't.** \"Don't use jargon\" performs worse than \"use plain language a first-year student would understand.\" Positive framing consistently beats negative framing.\n\n**\"Think step by step\" is no longer a universal trick.** It used to be the single most-cited prompting tip. On today's reasoning models, which already work through problems internally, it is often redundant and can occasionally make things worse by forcing a rigid structure. Try the prompt without it first.\n\nPrompt engineering is not about writing extremely complicated prompts.\n\nIt is about **communicating clearly with AI**.\n\nThe more clearly we communicate our task, context, references, expectations, and desired format, the easier it becomes for the AI to produce a useful result.\n\nTCREI is one framework that can help us structure that communication:\n\n**Task → Context → References → Evaluate → Iterate**\n\nAnd whatever the prompt, always verify the parts you are going to rely on.\n\nThis is a small guide on prompt engineering. I hope you found it helpful.\n\nUntil next time.\n\n**Peace ✌️**", "url": "https://wpnews.pro/news/prompt-engineering-how-to-actually-get-what-you-want-from-ai", "canonical_source": "https://dev.to/blackwatch021/prompt-engineering-how-to-actually-get-what-you-want-from-ai-4e02", "published_at": "2026-09-08 15:31:56+00:00", "updated_at": "2026-09-08 15:55:48.787883+00:00", "lang": "en", "topics": ["artificial-intelligence", "generative-ai", "large-language-models", "developer-tools"], "entities": ["Google"], "alternates": {"html": "https://wpnews.pro/news/prompt-engineering-how-to-actually-get-what-you-want-from-ai", "markdown": "https://wpnews.pro/news/prompt-engineering-how-to-actually-get-what-you-want-from-ai.md", "text": "https://wpnews.pro/news/prompt-engineering-how-to-actually-get-what-you-want-from-ai.txt", "jsonld": "https://wpnews.pro/news/prompt-engineering-how-to-actually-get-what-you-want-from-ai.jsonld"}}