- Prompt Engineering
Prompt Engineering Basics: Getting Better Outputs from Any LLM
The way you phrase a request to an LLM has an outsized impact on the quality of what comes back. These techniques will help you get consistent, useful results.
You can take the same LLM and get dramatically different results depending on how you phrase your request. That’s the core insight behind prompt engineering — and it’s why teams that invest even a little time in understanding how to write effective prompts tend to get meaningfully better outcomes from their AI workflows.
This isn’t about tricks or hacks. It’s about understanding how LLMs process input so you can give them what they need to give you what you want.
Start With the Role
One of the most reliable ways to improve outputs is to give the model a clear identity before you ask it to do anything. This is often called a system prompt or a role definition.
Instead of jumping straight to your request, start with something like: “You are a senior financial analyst reviewing quarterly earnings reports. Your job is to extract key metrics, flag anomalies, and summarize findings in a structured format.”
This shapes how the model interprets everything that follows. It calibrates tone, vocabulary, level of detail, and the implicit assumptions the model makes about what a good response looks like.
Be Specific About What You Want
Vague prompts produce vague outputs. The more precisely you describe the output you need, the better your chances of getting it.
Compare:
- “Summarize this document.”
- “Summarize this supplier contract in three bullet points: the payment terms, the delivery schedule, and any penalty clauses. Use plain language.”
The second version gives the model a clear scope, a specific format, and a style instruction. There’s far less ambiguity about what success looks like.
When writing prompts for automated workflows — where a human isn’t reviewing each output — specificity isn’t optional. It’s what keeps your pipeline from producing results that look plausible but miss the point.
Provide Context
LLMs don’t know things you haven’t told them. If your task depends on context — a company’s industry, a document’s purpose, a user’s role — include it in the prompt.
This is especially important when you’re building workflows that will run on content the model hasn’t seen. Don’t assume the model will infer what it needs to know from the document alone. Tell it what it’s looking at, why it matters, and what you need from it.
Use Examples
Few things improve output quality as reliably as showing the model what a good output looks like. This technique — called few-shot prompting — provides one or more examples of the input/output pair you’re looking for before presenting the actual task.
Extract the due date from the following invoice and return it in YYYY-MM-DD format.
Invoice: "Please remit payment by March 15th, 2026."
Due date: 2026-03-15
Invoice: "Payment is due within 30 days of invoice date (issued February 1, 2026)."
Due date: 2026-03-02
Invoice: [your actual invoice text here]
Due date:
The model has now seen the pattern. It knows the format, the level of inference required, and what the output should look like. This is far more reliable than describing the format in prose alone.
Break Complex Tasks Into Steps
LLMs perform better on complex tasks when they reason through steps rather than jumping to a conclusion. There are two ways to get this.
The first is chain-of-thought prompting — explicitly asking the model to think step by step before answering. Add a phrase like “Let’s think through this carefully, step by step” and you’ll often see better accuracy on tasks that require multi-step reasoning.
The second is to break the task into separate prompts. Instead of asking the model to extract data, analyze it, and write a report in one shot, run three separate calls: one to extract, one to analyze, one to synthesize. Each step gets the model’s full attention rather than competing with the others.
This is how robust AI pipelines are usually built — not as a single massive prompt, but as a chain of focused steps.
Control the Format
If you need a specific output format — JSON, a table, numbered list, a specific schema — say so explicitly and show an example.
Return your findings as a JSON object with the following structure:
{
"vendor": "",
"contract_value": "",
"start_date": "",
"end_date": "",
"auto_renews": true/false
}
When you need the output to feed into another system, format control isn’t just nice to have — it’s essential. A model that returns well-formatted JSON 95% of the time and free-text prose 5% of the time will break your downstream pipeline.
Set Guardrails on Tone and Length
Left to its own devices, an LLM will often produce more text than you need. If you want brevity, ask for it explicitly: “Respond in no more than three sentences.” If you want a specific tone — formal, conversational, technical — say that too.
These instructions don’t need to be elaborate. Simple, direct constraints are more effective than long style guides embedded in a prompt.
Iterate and Evaluate
Prompt engineering is iterative. Your first version will rarely be your best version. The process looks like this:
- Write a prompt.
- Run it against a representative sample of inputs.
- Look at where it fails.
- Add specificity, examples, or constraints to address the failure mode.
- Repeat.
The teams that get the most reliable results from LLMs are the ones that treat prompt development as a proper engineering process — not a one-time setup but an ongoing discipline with testing and versioning.
Prompts Are Code
One final mindset shift that helps: treat your prompts like code. Version them. Review changes before you deploy. Test them against a consistent benchmark set. Document what each change was intended to fix.
Prompt drift — where prompts evolve informally without tracking — is a common source of unexplained quality regressions in AI workflows. Treating prompts as first-class artifacts in your development process prevents that.
At Komposer, we build prompt management into our agent platform because we’ve seen firsthand how much it matters. The best agent in the world is only as good as the instructions it’s given. Getting those instructions right is a skill — and like any skill, it gets better with practice and the right structure around it.
Get Started and Streamline Your Workflow Today
No credit card required. Cancel anytime
Enjoy a 14-day free trial, experience every feature risk-free.