Prompt Engineering Fundamentals
Master the building blocks of effective prompts: anatomy, clarity, role assignment, output constraints, and the CRISP framework.
The Anatomy of a Prompt
Every effective prompt consists of four key components. You do not always need all four, but understanding each one helps you construct better prompts:
1. INSTRUCTION - What you want the AI to do "Summarize the following article..." 2. CONTEXT - Background information the AI needs "You are reviewing a technical paper for a non-technical audience..." 3. INPUT - The data or content to process "Article: [paste article text here]" 4. OUTPUT FORMAT - How you want the response structured "Provide a 3-paragraph summary with bullet points for key takeaways."
Clarity and Specificity
The most common mistake in prompt writing is being too vague. AI models respond to exactly what you ask, not what you mean. Here is how to be specific:
| Vague Prompt | Specific Prompt | Why It's Better |
|---|---|---|
| "Write about dogs" | "Write a 500-word blog post about the top 5 dog breeds for apartment living, including size, temperament, and exercise needs" | Defines topic, length, structure, and content |
| "Fix this code" | "This Python function should return a sorted list but returns None. Find the bug, explain why it happens, and provide the corrected code" | States expected behavior, asks for explanation |
| "Help with email" | "Write a professional email to a client explaining a 2-week project delay. Tone should be apologetic but confident. Include a revised timeline" | Specifies audience, tone, and required content |
Role Assignment
Assigning a role to the AI model is one of the most powerful prompt engineering techniques. When you tell the AI to act as a specific expert, it draws on knowledge patterns associated with that role.
// Technical reviewer "You are a senior software engineer with 15 years of experience in Python. Review this code for performance issues, security vulnerabilities, and best practices." // Creative writing coach "You are a creative writing professor at a top MFA program. Provide constructive feedback on this short story, focusing on character development, pacing, and dialogue authenticity." // Data analyst "You are a data analyst at a Fortune 500 retail company. Analyze this sales data and provide insights about seasonal trends, top-performing products, and recommendations for inventory planning."
Tone and Style Control
You can control the tone and writing style of AI responses by being explicit about your expectations:
- Formal: "Use professional, academic language suitable for a journal publication."
- Casual: "Write in a friendly, conversational tone as if explaining to a friend."
- Technical: "Use precise technical terminology. Assume the reader has a CS degree."
- Simple: "Explain this as if teaching a 10-year-old. Avoid jargon entirely."
- Persuasive: "Write in a compelling, persuasive style suitable for a sales page."
Output Constraints
Constraining the output format ensures you get responses that are immediately useful. Here are the key constraints you can set:
Length
"Keep your response under 200 words" or "Write exactly 5 bullet points" or "Provide a one-paragraph summary"
Format
"Respond in JSON format" or "Use a markdown table" or "Format as a numbered list" or "Use XML tags"
Language
"Respond in Spanish" or "Use British English spelling" or "Write at an 8th-grade reading level"
Structure
"Include an introduction, three body sections, and a conclusion" or "Start each section with a question"
Good vs Bad Prompt Comparison
Let us compare prompts side by side to see the principles in action:
// BAD: Vague, no context, no constraints "Make a login form" // GOOD: Specific technology, features, and requirements "Create a React login form component with: - Email and password fields with validation - Show/hide password toggle - 'Remember me' checkbox - Error message display for invalid credentials - Loading state on submit button - Use TypeScript and Tailwind CSS - Include aria-labels for accessibility"
// BAD: No audience, no purpose, no structure "Write about climate change" // GOOD: Audience, purpose, structure, tone defined "Write a 1000-word article for a high school science magazine about how climate change affects ocean ecosystems. Include: - An engaging hook in the first paragraph - 3 specific examples with data - A section on what students can do - Tone: educational but not preachy - Reading level: 10th grade"
The CRISP Framework
CRISP is a mnemonic framework for constructing well-structured prompts. Use it as a checklist when writing important prompts:
| Letter | Component | Description | Example |
|---|---|---|---|
| C | Context | Background information and situation | "I'm a startup founder preparing for a Series A pitch" |
| R | Role | Who the AI should act as | "Act as an experienced venture capital advisor" |
| I | Instructions | The specific task to perform | "Review my pitch deck outline and provide feedback" |
| S | Specifics | Details, constraints, requirements | "Focus on narrative flow, market size claims, and financial projections" |
| P | Parameters | Output format, length, style | "Provide feedback as a numbered list with severity ratings (critical/important/nice-to-have)" |
Context: I'm a startup founder building a B2B SaaS product for HR teams. We have 50 paying customers and $200K ARR. Preparing for Series A fundraising. Role: Act as an experienced VC partner who has evaluated hundreds of Series A pitches in the enterprise SaaS space. Instructions: Review the pitch deck outline below and provide actionable feedback to strengthen it. Specifics: Focus on: (1) whether the narrative arc is compelling, (2) if our market sizing is credible, (3) gaps that VCs will question, (4) slides that should be added or removed. Parameters: Format your feedback as a table with columns: Slide, Issue, Severity, Recommendation. Then add a summary paragraph with your overall assessment.
Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX