How to Write Better AI Prompts with the CO-STAR Framework
Learn how to write clearer AI prompts using CO-STAR: Context, Objective, Style, Tone, Audience, and Response. This practical guide develops a vocabulary-learning prompt step by step, provides a reusable template, and explains how to test and refine prompts systematically.
1. Weak Prompts Often Leave Out Essential Information
Many prompts contain little more than a request: “Write a few sentences to help me memorize vocabulary.” A model can usually respond, but the results may be generic. The sentences might not match the learner’s level or provide a memorable context.
The problem is often the input rather than the model’s capabilities. A large language model does not know your learning level, intended use, or output preferences unless you explain them. It must infer those details from your prompt. The closer that prompt comes to an executable task specification, the more consistent the output is likely to be.
The core skill is making your expectations explicit instead of leaving them in your head.
2. A Practical Example: From Sentence Generation to Useful Learning Material
Suppose you want to help a learner remember the adjective contemporary, meaning “modern” or “existing at the same time.” Consider three versions of the prompt.
Version 1: State Only the Task
Write sentences using contemporary.
The model will typically produce one or two ordinary sentences. That satisfies the request, but it does not establish whether the sentences suit the learner’s level or demonstrate typical word combinations.
Version 2: Specify Quantity and Presentation
Write five English example sentences using contemporary. Include a Chinese translation for each sentence.
The quantity and presentation are now clear, making the output easier to use. However, the difficulty remains unspecified, and the examples may not reflect common usage contexts.
Version 3: Add Background, Requirements, and Format
You are an English vocabulary teaching assistant. The learner is a high school student at approximately CEFR B1 level who is preparing for a reading comprehension exam. Create five example sentences for the word contemporary. Requirements: Each sentence should illustrate a typical usage, such as modifying a noun, describing an artistic or cultural style, or appearing in an academic context. Keep each sentence between 12 and 18 words. Use a relaxed tone and make the sentences easy to remember. Return a JSON array in which each element contains three fields: sentence for the English sentence, translation for its Chinese translation, and usage for a usage explanation.
The difference is the information provided. Version 3 specifies the assistant’s role, the learner’s level, the learning scenario, the content requirements, and the output format. Those details help the model make more relevant choices.
The CO-STAR framework organizes this information into six elements.
3. The Six Elements of CO-STAR
CO-STAR identifies six categories of information that help define a prompt: Context, Objective, Style, Tone, Audience, and Response.
C: Context
Context explains the background of the task: who you are, the situation you are working in, and the conditions already established. It helps the model understand the setting and reduces irrelevant responses.
- Weak: “Write a product description.”
- Stronger: “I own a small stationery shop that mainly sells handmade notebooks. I need a new-product introduction to post on a community noticeboard.”
Specific context reduces the need for the model to fill gaps with potentially incorrect assumptions.
O: Objective
The objective defines what the model should accomplish. It answers the question: “What problem should this output solve?”
Use an action that can be checked rather than a vague request such as “Make it better.”
- Weak: “Improve this paragraph.”
- Stronger: “Shorten this paragraph to no more than 100 words while preserving the price and opening hours.”
A concrete objective makes it easier to determine whether the result meets your requirements.
S: Style
Style describes how the text should be written: formal, conversational, academic, concise, or instructional.
You can also specify particular writing preferences, such as “Use mostly short sentences, with no more than three sentences per paragraph.”
Style guidance can reduce formulaic language. Without it, a model may rely on stock phrases and repetitive sentence patterns that make the text feel machine-generated.
T: Tone
Tone describes the attitude conveyed by the response, such as patient, encouraging, objective, or restrained.
Style and tone are related but distinct: style controls the form of the writing, while tone controls its attitude.
- For a beginner tutorial: “Be patient and avoid overwhelming the reader with technical terminology.”
- For a technical review report: “Be objective, prioritize data, and avoid exaggerated judgments.”
Keep tone and style compatible. Asking for an extremely rigorous academic style and a casual, humorous tone may pull the output in competing directions.
A: Audience
Audience identifies who will read the output. The same concept requires a different explanation for elementary school students than for engineers.
Defining the audience helps the model decide how much terminology to use, which examples to choose, and which basics need explanation.
- Weak: “Explain caching.”
- Stronger: “Explain the purpose of caching to product managers with no programming background. Use an analogy involving picking up items at a supermarket.”
R: Response
Response specifies the output’s format and structure. This can include length, paragraph organization, lists, tables, or machine-readable JSON.
Format requirements are especially important when another program will process the output.
Common structures include:
- Pyramid structure: Start with the conclusion, follow with supporting reasons, and finish with details.
- List structure: Present one point per item and specify the number of items.
- Structured data: Define field names and types so the output can be parsed.
For JSON output, specify the field names and array structure rather than leaving the model to choose a different format each time.
4. Assemble a Complete Prompt
You can combine the six elements in a consistent order to make prompts easier to reuse.
[Context] I am ..., the current situation is ..., and the known conditions are ...[Objective] Complete ...; the final deliverable should be ...[Style] Use ... writing, with sentence lengths of ...[Tone] Maintain a ... attitude.[Audience] Write for ..., whose background knowledge is ...[Response] Use the following output structure: ...If the output must be machine-readable, specify field names and an example format.
Applied to the vocabulary example, the template becomes:
[Context] I am tutoring a high school student with an intermediate vocabulary who is preparing for a reading comprehension exam.[Objective] Create five example sentences for contemporary, each illustrating a typical usage.[Style] Use natural sentences suited to everyday situations or academic reading contexts. Keep each sentence between 12 and 18 words.[Tone] Be patient and encouraging. Avoid rigid grammar lectures.[Audience] A high school student at approximately CEFR B1 level.[Response] Return a JSON array. Each element must contain the fields sentence, translation, and usage. Use sentence for the English example, translation for its Chinese translation, and usage for a usage explanation.
A reusable template offers two benefits. First, you do not have to start from scratch each time; you can replace the task-specific details. Second, team members can share a common structure, making prompts easier to compare and improve.
5. Common Prompt-Writing Mistakes
Mistake 1: Providing an Objective Without Context
This is one of the most common problems. A model may complete the task without knowing which difficulty level or setting is appropriate.
Adding context often makes the output more relevant.
Mistake 2: Adding Conflicting Requirements
Including all six elements does not help if they contradict one another. For example, asking for both conversational and academic writing without clarifying how to balance them can create ambiguity.
Review the requirements and remove anything irrelevant to the objective or inconsistent with other instructions.
Mistake 3: Leaving the Format Undefined
If a program needs to read the output, a request such as “Organize this information” is too vague. The model may return a different structure each time.
Explicit fields and a clear structure are essential for reusable output.
Mistake 4: Combining Too Many Tasks
A single prompt that requests translation, editing, summarization, and quiz generation can make it difficult for the model to satisfy every requirement.
A more manageable approach is to split the work into steps, with each step focused on one task.
6. Iterate and Validate Your Prompts
Prompts rarely work exactly as intended on the first attempt. The key is to establish a repeatable validation process.
- Prepare a fixed test set. Choose five to ten representative inputs, such as ten vocabulary words at different difficulty levels. Use the same inputs after each prompt revision.
- Define evaluation criteria. Check whether the difficulty matches the audience, the required content is present, the format meets the specification, and the output contains factual errors.
- Change one element at a time. If you revise several parts at once, it becomes difficult to identify which change affected the results.
- Record versions and outcomes. Keep a table of prompt versions, test results, and remaining problems so you can review earlier decisions.
An example tracking table:
| Version | Change | Appropriate Difficulty? | Format Compliant? | Main Issue |
|---|---|---|---|---|
| v1 | Task description only | No | No | Sentences are too simple |
| v2 | Added audience and difficulty level | Mostly | No | Inconsistent output format |
| v3 | Added response format | Yes | Yes | None identified |
This process turns prompt improvement from subjective trial and error into an engineering activity that can be checked and repeated.
7. Conclusion
Weak prompts often suffer from incomplete information rather than a lack of clever wording. CO-STAR helps you define the context, objective, style, tone, audience, and response format so the task is clear.
Combine that structure with a fixed test set and explicit evaluation criteria to refine prompts systematically and improve output quality over time.
