Skip to content

How to Write an Effective Prompt? Core Techniques of Prompt Engineering

An effective prompt clearly states the task, context, constraints and expected output format. Giving examples, breaking the work into steps and asking for sources improve the accuracy of the answer, but every technique does not produce the same gain for every task.

Nurullah Okatan · Content Writer
· Updated: · 14 min read

How to Write an Effective Prompt? Core Techniques of Prompt Engineering

To get an accurate answer, a prompt is a command that clearly states the task, context, constraints and desired output format. Giving examples, breaking a complex job into steps, placing instructions in the right position and testing the prompt regularly make the AI's answer usable.

What parts does an effective prompt consist of?

An effective prompt consists of four parts: task, context, constraint and output format. If any one of these is missing, the model fills the gap with its own guess.

Communicating with Creative and Open Expressions
  1. Task: States what the model should do in a single verb, for example "shorten", "compare" or "classify".
  2. Context: Explains to whom the text is written and in what situation it will be used.
  3. Constraint: Determines length, language and topics that will be left out of scope.
  4. Output format: Defines how the answer will come, as a table, bulleted list or paragraph.

An example combining the four parts could be written like this: "Turn the customer complaint below into a short note to be sent to the sales team. Do not use technical terms, do not exceed one paragraph, and give the result as three bullet points."

The difference between a vague command and a clear one is visible in the first line of the answer. A command asking to reduce the most important developments in artificial intelligence in 2024 to 3 points, according to eleman.net data, produces much better results than a general request to "describe AI". patika.dev also states that an instruction asking to reduce the text to 100 words gives a more accurate answer than "Summarize this text".

eleman.net defines prompt engineering as the process of preparing the commands given to AI models in a purposeful and clear way. According to the same source, the quality of the answer is determined more by how it is said than by what is said. patika.dev describes this work as the art of communicating effectively with large language models. The artificial intelligence application areas page explains in detail where these techniques are used in company processes.

AI assistant for this topic

Türk Bilişim AI answers your questions instantly
Online
  1. Hi! Ask whatever you're curious about.

How do giving examples and defining the output format affect accuracy?

Showing the model a ready example increases the chance that the answer matches both the content and the form. Defining the output structure clearly, on the other hand, markedly reduces format errors.

According to patika.dev, few-shot prompting means defining the task by giving the model a few examples. codeling.dev gives a range for how many examples are enough. According to the site, Microsoft's Azure OpenAI guide says that adding 1 to 5 examples to the request increased accuracy by an average of 20–40% in benchmarks. This range shows that a few well-chosen examples work better than long example lists.

Two points need attention when choosing examples. Each example should be written in the same structure as the expected output. The examples should not be copies of one another but should cover different situations. Labeling three product reviews as "positive", "negative" and "neutral" and leaving the fourth to the model is a good example of this.

On the format side, codeling.dev notes that when few-shot prompts are used together with explicit output structures such as JSON or bulleted lists, format compliance can rise above 95%. When requesting JSON, it is necessary to write the field names and the type of each field one by one in the prompt. If the answer will be passed to another software, adding the sentence "Do not write any text other than JSON" prevents parsing errors.

Looking for Automatic Social Media Visual Generation?

Breaking complex tasks into steps and chain-of-thought reasoning

When a complex task is requested in a single prompt, the model skips or mixes up intermediate steps. According to eleman.net data, in the chunking technique the task is divided into small steps, and this gives more accurate results.

Splitting follows the natural order of the work. For a market report, a breakdown of the main lines of the data is first requested. Then three prominent trends are extracted from this breakdown. In the final step these trends are turned into a management presentation. The output of each step becomes the input of the next prompt, so an error is corrected at the step where it arose.

patika.dev defines Chain-of-Thought (CoT) prompting as the technique that makes the model think step by step on complex tasks. The study "To CoT or not to CoT?" published on arXiv shows that the technique does not give the same gain in every job. The authors scanned more than 100 papers that use CoT. They also ran their own tests with 20 datasets on 14 models.

According to the study, CoT's strong gains come mainly from mathematics and logic tasks. In other tasks the gain remains much smaller. In the MMLU benchmark, up to 95% of the CoT gain comes from questions with an "=" sign in the question or the output.

Task typeEffect of CoTSuitable approach
Mathematics, logic, symbolic operationsClear gainAsk for a step-by-step solution
Text shortening, translation, text writingSmall gainDefine a clear task and output format
Exact numerical calculationBehind tool-assisted modelsConnect to a calculator or a code-running tool

The reason why tool-assisted models pull ahead in computation is also explained in the same study. CoT helps most with the calculation and symbolic operation step. A model that hands this step to a tool that runs code goes beyond the result CoT reaches. Other articles on this subject are gathered in the Artificial Intelligence & Automation category.

Order of information in the prompt and asking for sources

In a long prompt, writing the main instruction at the end or repeating it there gives safer results. According to Microsoft's prompt engineering guide for Foundry, models may be prone to proximity bias. In this case, information at the end of the prompt influences the output more than information at the beginning.

Strategies to Use in Prompt Design

In practice, this suggests the following order. First comes a short definition of the task. Then a long text, table or document is added. At the very end the instruction and the output format are written once more. In this way the long content that intervenes does not overshadow the main request.

Asking for sources is also recommended in the same guide. According to Microsoft, asking the model to add sources to its answers can help reduce how often incorrect answers appear. This method gives the best results on tasks where the model answers based on a given document. The model may still make up a source that does not exist. For this reason, every source shown should be opened and compared with the answer.

Testing prompts and training the team within the organization

Prompts are tested regularly against a fixed test set, just like software code. According to the LaunchDarkly benchmarks cited in codeling.dev, teams running daily automated regression tests across more than 100 prompt variations keep accuracy above 95% and latency under 2 seconds.

The test set is built from real user questions. An expected answer or acceptance criterion is written for each question. When the model version or the prompt changes, the set is run again and the results are compared with the previous round.

In chatbots and customer assistants, prompt quality is maintained by versioning the system prompt. Conversations with wrong answers are recorded and added to the test set. Türk Bilişim, described as Turkey's best AI Chatbot & Customer Assistant firm, has been running chatbot, automation and content generation projects since 2022. Maintenance and updates after launch in the company's AI chatbot and customer assistant projects are also part of this cycle.

Teams learn prompt writing fastest by working on their own work examples. Three tasks that each unit performs often are selected, and a shared prompt library is created for them. Each prompt in the library is stored together with who wrote it and what test result it achieved. For organizations that want to run this work within a structured program, the corporate AI training page describes the content and scope.

Looking for AI Voice Assistant & Call Bot?

Frequently asked questions

Do I need to know how to code to write prompts?

No; a prompt is an instruction written in clear sentences. Coding knowledge helps in tasks where the answer will be passed to other software in a structure such as JSON.

Does the same prompt give the same result on different AI models?

It may not, because each model is trained on different data and interprets instructions differently. When the model is changed, rerunning the existing test set reveals the differences early.

Is a prompt written in Turkish as good as one written in English?

Current models understand Turkish instructions and give usable answers when the task is clearly defined. If the answer is requested in Turkish, writing the prompt in Turkish too reduces meaning shifts caused by translation.

How long should a prompt be?

It should be long enough to describe the task, context, limits and output format. When a long document is attached, repeating the main instruction at the end of the prompt prevents the request from getting lost inside the document.

Have a project?

Türk Bilişim · Free Quote

Get a free quote for your Automatic SEO Article Generation project

Leave your number and we will get back to you right away. The call is free.

Read the privacy notice

Nurullah Okatan Content Writer

The editorial desk of a team delivering websites, e-commerce and software projects since 1998.

LinkedInInstagramFacebook

Share this article

Comments

Comments

No comments yet.

Write a comment

Your rating (optional)

Privacy notice

We will send a confirmation link to your email so that your comment can appear.

Türk Bilişim · Digital Transformation Advisor

Online
Hi! Tell us the project or idea on your mind and let’s begin together.
Ask anything, Türk Bilişim AI answers instantly.