Prompt Engineering framework

COSTAR improves prompt quality by ensuring clarity, relevance, and usability. It’s especially useful in business, content creation, automation, and API integrations where consistency and structure matter.

The COSTAR Framework Explained:

  • Context (C): Providing background information for the LLM to understand the specific situation, domain, or environment.
  • Objective (O): Clearly defining the clear goal of the final result. (e.g., “summarize the research paper” or “find error in this code.”)
  • Style (S): Specifying the desired writing style. (e.g., academic, conversational, technical or “simple and concise”).
  • Tone (T): Setting the emotional or attitudinal tone ensures the response resonates with the required sentiment. (e.g., formal, friendly, urgent, humorous, or empathetic)
  • Audience (A): Identifying the intended audience who will read or use the output, such as experts, beginners, technical developers, business executives, or the general public..
  • Response (R): Providing the response format to ensures the LLM outputs the exact output format. (e.g., paragraph, bullet points, JSON, table or markdown)

Example 1:

Zero shot:

Create a marketing advertising content for headphone

COSTAR:

Context: we are a new startup company that design a new headphone
Objective: Create a marketing advertising content on social media
Style: Using Apple iphone marketing style
Tone: teenager tone
Audience: teenager who loves colorful product
Response: a slogan and a short paragraph

Example 2:

Zero shot:

Create an ad for 'The Amazing Burger'.

COSTAR:

Context: we are a fast food company that designing a new advertizing for our new 'amazing burger'
Objective: Create a marketing advertising content on youtube advertizing
Style: Using korean stars with strong music background and dance in video
Tone: family with kids
Audience: kids who loves korean stars like black pink
Response: a script for 30 seconds with slogan and story board

Example 3:

Zero shot:

Generate a product update email of AI-powered dashboard.

COSTAR:

Context: Our SaaS company has just launched a new AI-powered analytics dashboard. The development team completed the rollout last night.
Objective: Inform existing customers about the new feature and encourage them to try it.
Style: Clear, concise, and professional.
Tone: Excited and customer-focused.
Audience: Current enterprise clients who use our platform daily.
Response: Write a 150-word email with a subject line, greeting, body, and call-to-action. Use markdown format.

Example 4:

Zero shot:

Question a suspect in a money laundering case

COSTAR:

Context: question a suspect in a money laundering case
Objective: Create questions to challenge a suspect in a money laundering case but not asking question too direct
Style: from an inspector angle to ask for the real hidden facts
Tone: using an inspector tone
Audience: suspect in this money laundering case
Response: create 20 questions related to money laundering

Google prompt engineering framework

Google also created another prompt engineering framework: TCREI

Task

  • Persona
    • From: professional speechwriter, senior marketing executive
    • To: angry customer, manager,
  • Output Format
    • Bulleted list
    • Short sentences
    • Table
    • JSON
    • Markdown

Context

  • Give me some ideas for a birthday present under $30
  • Write a CV that apply for a Senior Technical Trainer job.

References

  • Your history present list as a reference.
  • Other person example as a reference.
  • It is same as few-shot prompting

Evaluate

  • Is your prompt already the best?
  • Can you improve your prompt?

Iterate

  • Modify your prompt
  • Rephrase your prompt
  • Add more context to your prompt

If you think it is hard to remember, you can remember in this way.

  • Thoughtfully
  • Create
  • Really
  • Excellent
  • Input

Example:

  1. Task: Generate 5 ideas for a new high-performance sneaker line.
  2. Format: List the concepts and materials for each sneaker in an outline.
  3. Context: The sneakers should be made for athletes doing cross-training activities.
  4. Reference: Keep the 5 ideas generated, but refine them using these 2 examples as references.
  5. Excellent and Input: Improve prompt again and again.

Other prompt engineering frameworks

There are several well-known prompt engineering frameworks, such as:

CRISPE
(Capacity and Role, Insight, Statement, Personality, Experiment)
CLEAR
(Clear, Logical, Explicit, Accurate, Relevant)
STAR (from interview techniques, sometimes adapted for prompts)
(Situation, Task, Action, Result)
APE
(Action, Purpose, Expectation)

No matter which framework, as long as you are giving more details to AI, you will get a better answer.

Leave a Reply