beginner45 minLesson 2 of 5

Prompt Frameworks: ABC, CO-STAR, RISEN

Master three proven prompt frameworks: ABC, CO-STAR, and RISEN, with practical comparisons and examples.

Prompt Frameworks: ABC, CO-STAR, RISEN

Why Use Frameworks?

Prompt frameworks provide structured templates that consistently produce high-quality outputs from LLMs. They eliminate guesswork and help ensure your prompts are complete, clear, and effective. Without a framework, prompts tend to be vague, miss critical context, or produce unpredictable results.

The Problem with Unstructured Prompts

IssueUnstructured PromptFramework-Based Prompt
Missing context"Write an email"Specifies sender, recipient, situation, and desired outcome
Vague instructions"Make it good"Defines tone, style, length, and specific requirements
Inconsistent outputVaries wildly between runsPredictable format and quality
Hard to debugNo clear components to isolate issuesEach component can be tested separately

ABC Framework

ABC stands for Action, Background, Constraints.

ComponentPurposeExample
A - ActionWhat the model should do"Write a product description"
B - BackgroundContext and information"For a waterproof hiking boot"
C - ConstraintsRules and format"150 words, friendly tone, highlight durability"

ABC Framework Flowchart

100%

ABC Framework Example

[ACTION] Write a professional email response to a customer complaint. [BACKGROUND] The customer waited 2 weeks for delivery that was promised in 3 days. They're frustrated but haven't asked for a refund yet. Your company is "QuickShip Inc." [CONSTRAINTS] - Keep it under 200 words - Apologize sincerely (no excuses) - Offer a 20% discount on their next order - Provide a tracking update - Sign as "Customer Support Team"
💡Tip

ABC is ideal for tasks that have clear instructions but don't require complex role-playing. It's the fastest framework to write — perfect for quick classification, simple content generation, or straightforward email drafting.

ABC in Code

python
# ABC framework applied via API from openai import OpenAI client = OpenAI() def abc_prompt(action: str, background: str, constraints: list[str]) -> str: """Build an ABC-format prompt""" constraint_text = "\n".join(f"- {c}" for c in constraints) return f"""[ACTION] {action} [BACKGROUND] {background} [CONSTRAINTS] {constraint_text}""" prompt = abc_prompt( action="Write a professional email response to a customer complaint.", background="The customer waited 2 weeks for delivery that was promised in 3 days.", constraints=[ "Keep it under 200 words", "Apologize sincerely (no excuses)", "Offer a 20% discount on their next order", ] ) response = client.chat.completions.create( model="gpt-4", messages=[{"role": "user", "content": prompt}] ) print(response.choices[0].message.content)

CO-STAR Framework

CO-STAR stands for Context, Objective, Style, Tone, Audience, Response.

ComponentPurposeExample
C - ContextBackground situation"You're a marketing consultant"
O - ObjectiveThe goal to achieve"Increase social media engagement"
S - StyleWriting style"Bullet points, actionable items"
T - ToneVoice/attitude"Energetic, encouraging"
A - AudienceWho's reading"Small business owners new to social media"
R - ResponseFormat requirement"5 tips, each with a 'why it works' explanation"

CO-STAR Framework Flowchart

100%

CO-STAR Framework Example

[CONTEXT] You are an experienced nutritionist helping busy professionals eat healthier. [OBJECTIVE] Create a 5-day simple meal plan that requires less than 30 minutes prep per day. [STYLE] Structured table format with columns: Meal, Ingredients, Quick Tip. [TONE] Encouraging, practical, non-judgmental. [AUDIENCE] Software developers working 60+ hour weeks who order takeout 5+ times per week. [RESPONSE] Include a breakfast, lunch, and dinner option for each day. Add one "emergency snack" section at the end.
ℹ️Note

CO-STAR excels when tone and style matter as much as the content itself. Marketing copy, executive communications, and user-facing content benefit enormously from specifying all six dimensions separately.


RISEN Framework

RISEN stands for Role, Instruction, Steps, End goal, Narrowing.

ComponentPurposeExample
R - RoleWho the AI should be"Senior Python developer with 15 years experience"
I - InstructionWhat to do"Review and optimize this code"
S - StepsProcess to follow"1. Identify bottlenecks 2. Suggest fixes 3. Show before/after"
E - End goalDesired outcome"Make it run 50% faster and be more readable"
N - NarrowingConstraints/filters"No external libraries, must maintain backwards compatibility"

RISEN Framework Flowchart

100%
ℹ️Note

RISEN is particularly powerful for complex tasks where the AI needs to embody expertise and follow a specific process.

RISEN Framework Example

[ROLE] You are a senior UX designer who has worked at companies like Apple and Google. You specialize in accessible, user-friendly interfaces. [INSTRUCTION] Review this app screen description and identify usability issues. [STEPS] 1. First, identify 3-5 potential usability problems 2. For each problem, explain why it's an issue 3. Provide a concrete solution for each 4. Rank issues by severity (Critical, High, Medium, Low) [END GOAL] The output should help the product team prioritize improvements for their next sprint. [NARROWING] Focus only on mobile usability. Ignore backend concerns and marketing copy. Consider accessibility for color-blind users as high priority.

Framework Comparison

FrameworkBest ForStrengthsWeaknesses
ABCQuick tasks, simple requestsFastest to write, easy to rememberLess detailed for complex tasks
CO-STARContent creation, marketingExcellent for tone/style matchingMore components to remember
RISENComplex tasks, expert rolesStep-by-step process, role immersionLongest to craft, most detailed

Detailed Side-by-Side Comparison

DimensionABCCO-STARRISEN
Number of components365
Role specificationImplicit (via Action)Implicit (via Context)Explicit first component
Step-by-step processNot supportedNot supportedBuilt-in (Steps)
Tone/style controlOptional (via Constraints)Dedicated fields (Style, Tone)Implicit (via Role)
Audience awarenessOptional (via Background)Dedicated field (Audience)Optional (via Narrowing)
Output format controlVia ConstraintsVia ResponseVia Steps + End goal
Time to write~30 seconds~2 minutes~5 minutes
Best with small contextYesModerateCan be verbose

When to Use Each

ScenarioRecommended Framework
Quick email, simple classificationABC
Blog post, social media, marketing copyCO-STAR
Code review, legal analysis, technical debuggingRISEN
Brainstorming creative ideasCO-STAR or ABC
Step-by-step tutorial generationRISEN
Customer support responseABC
Executive presentationCO-STAR
⚠️Warning

Don't force a framework for every prompt. For simple questions like "What's 2+2?", frameworks are overkill. Use them when the quality or specificity of output matters.

💡Tip

Combining frameworks: For very complex tasks, you can layer frameworks. For example, use RISEN's Role and Steps structure but incorporate CO-STAR's Tone and Audience components. The best prompt engineers mix and match based on the specific requirements.

📌Important

Framework limitations: No framework guarantees perfect output. They are heuristics, not algorithms. Even the most carefully structured prompt can fail if the underlying model lacks the knowledge or reasoning ability for the task. Always test and iterate.


Applying Frameworks to the Same Problem

Let's apply all three frameworks to the same problem: "Create content explaining AI to executives."

ABC Version

[ACTION] Write a 2-page executive summary about AI. [BACKGROUND] For Fortune 500 C-suite executives who know nothing about AI. Company sells enterprise software. Competitors are starting to mention AI. [CONSTRAINTS] Avoid jargon. Focus on business value not technology. Include: What AI can do for us, 3 practical use cases, estimated costs/ROI.

CO-STAR Version

[CONTEXT] You're an AI consultant presenting to the executive board. [OBJECTIVE] Get budget approval for an AI pilot program ($500K). [STYLE] Executive brief format with clear sections and bullet points. [TONE] Confident but realistic. Not hype-driven. [AUDIENCE] CEO, CFO, CTO - all skeptical about "shiny new things." [RESPONSE] Executive Summary, 3 Use Cases with ROI, Budget Breakdown, Risk Assessment, Next Steps. All on 2 pages.

RISEN Version

[ROLE] You're a former McKinsey consultant specializing in AI digital transformation. You've helped 20+ Fortune 500 companies adopt AI. [INSTRUCTION] Create a persuasive AI strategy document for executive approval. [STEPS] 1. Start with a 1-sentence "why this matters now" hook 2. Present 3 competitor AI initiatives to create urgency 3. Outline 3 specific use cases with estimated 6-month ROI 4. Include a "no action" scenario showing risks of waiting 5. End with clear "ask" and next steps [END GOAL] Get verbal commitment for $500K pilot budget by end of presentation. [NARROWING] No mention of neural networks, training data, or model architectures. Every claim must be business-outcome focused.

Python: Applying All Three to the Same Input

python
from openai import OpenAI client = OpenAI() # Same base scenario for all three frameworks scenario = "Explain the benefits of cloud migration to a skeptical CFO." # ABC approach abc_prompt = f"""[ACTION] Write a persuasive one-page memo about cloud migration. [BACKGROUND] {scenario} [CONSTRAINTS] - Under 300 words - Focus on cost savings and security (the CFO's priorities) - Include a 3-bullet ROI summary - No technical jargon""" # CO-STAR approach costar_prompt = f"""[CONTEXT] You're a cloud architect presenting to a CFO who is skeptical about cloud costs. [OBJECTIVE] Convince the CFO to approve a $2M cloud migration budget. [STYLE] Executive memo format with clear ROI calculations. [TONE] Data-driven, confident, conservative with promises. [AUDIENCE] CFO of a mid-sized enterprise, very cost-conscious. [RESPONSE] A one-page memo with: 3-year cost comparison, security benefits, migration timeline, and risk mitigation.""" # RISEN approach risen_prompt = f"""[ROLE] You're a senior cloud architect who has led 15+ enterprise migrations with an average 30% cost reduction. [INSTRUCTION] Write a persuasive migration proposal. [STEPS] 1. Open with the cost problem the company faces on-premise 2. Present 3-year TCO (Total Cost of Ownership) comparison 3. List security/compliance benefits 4. Address the CFO's likely objections 5. End with a clear, low-risk first step [END GOAL] Get approval for a $50K proof-of-concept. [NARROWING] Only discuss AWS. Ignore multi-cloud. Focus on infrastructure, not application refactoring.""" # Test all three for name, prompt in [("ABC", abc_prompt), ("CO-STAR", costar_prompt), ("RISEN", risen_prompt)]: response = client.chat.completions.create( model="gpt-4", messages=[{"role": "user", "content": prompt}], temperature=0.3 ) print(f"\n=== {name} OUTPUT ===") print(response.choices[0].message.content) print(f"Tokens used: {response.usage.total_tokens}")

Practice Questions

Practice Question

A content marketer needs to write a blog post with a specific tone and style for a target audience. Which framework is most appropriate?

Practice Question

In the ABC framework, what does the 'B' (Background) component provide?

Practice Question

A senior developer is debugging a complex distributed system issue and needs the AI to follow a specific step-by-step diagnostic process while acting as an expert. Which framework is best suited?

Practice Question

According to the lesson, when is it appropriate to skip using a prompt framework?

Practice Question

A project manager asks the AI to 'Write a product description for a waterproof hiking boot, 150 words, friendly tone.' Which framework component is being used for the '150 words, friendly tone' part?

Practice Question

A prompt engineer needs to generate a response that includes a specific step-by-step diagnostic process. Only one framework has a dedicated component for specifying procedural steps. Which one?

Practice Question

An engineer uses CO-STAR for a task but finds the output lacks the expert depth they need. Which framework modification would most likely help?

Practice Question

Comparing ABC and CO-STAR, what is the main advantage CO-STAR has over ABC for marketing content?

Practice Question

A prompt team needs their prompt frameworks to be testable — each component should be isolatable for A/B testing. Which framework's component structure makes this easiest?

Practice Question

A developer applies ABC to a legal contract analysis task but gets vague results. RISEN produces better results because:


Success

Key Takeaways:

  • ABC (Action, Background, Constraints): Fastest framework for simple tasks
  • CO-STAR (Context, Objective, Style, Tone, Audience, Response): Best for content creation with specific style requirements
  • RISEN (Role, Instruction, Steps, End goal, Narrowing): Most detailed for complex, role-based expert tasks
  • Framework choice depends on task complexity and output specificity needed
  • Don't over-engineer: simple questions don't need frameworks
  • Frameworks can be combined for complex tasks — mix and match components
  • Always test and iterate — frameworks are heuristics, not guarantees
Progress40%