Skip to main content

Prompt Elements

ElementDescriptionImpactGeneral ExamplesTech/IT Examples
Clear & Specific Task/Instruction

The core action you want the AI to perform. This should be an unambiguous and direct command or question. Use action verbs and avoid vagueness

This is the fundamental directive for the AI. Without a clear task, the model has no direction and is likely to produce irrelevant or generic output

  • Summarize this article
  • Generate five headlines for a blog post about sustainable living

  • Translate the following paragraph into French
  • Write a Python function to sort a list of dictionaries by a specific key

  • Explain how blockchain technology works to a non-technical audience

  • Debug the following Python code snippet
Context

The background information, setting, or circumstances relevant to the task. This helps the AI understand the "why" behind your request

Context narrows the AI's focus, allowing it to generate a more relevant and tailored response that aligns with your specific situation or need

  • I am writing a follow-up email to a client I met at a conference. They expressed interest in our new software

  • I need help planning a road trip through national parks in the Southwest United States for next summer

  • I'm developing a new microservice using FastAPI and I need to implement secure API authentication

  • We are experiencing slow database query performance in our PostgreSQL cluster during peak hours

Expectations

Clearly defining what a "good" response looks like including completeness, level of detail, or aspects to emphasize or avoid

Helps the AI align more closely with success criteria, reducing trial-and-error by anticipating how the output will be evaluated or used

  • Make sure the summary covers the main arguments and key takeaways

  • Provide at least 3 different approaches
  • Do not include any personal opinions
  • Ensure the code is well-commented and follows best practices for readability and maintainability

  • Explain the advantages and disadvantages of each encryption method

  • The solution should not introduce any new security vulnerabilities

Role/Persona

Assigning a specific role or persona for the AI to adopt (e.g., "Act as a seasoned financial analyst," "You are a creative copywriter")

This significantly influences the tone, style, vocabulary, and even the reasoning process of the AI, leading to more authentic and useful outputs

  • Act as a seasoned financial analyst and evaluate the potential ROI of investing in renewable energy stocks

  • You are a motivational coach; write a short pep talk for someone starting a new fitness journey

  • Act as a senior DevOps engineer advising on cloud infrastructure migration strategies

  • You are a cybersecurity expert; outline the potential attack vectors for a new mobile application

Audience

Specifying the intended audience for the AI's response (e.g., "Explain this to a 5-year-old," "Write for a technical audience")

This dictates the level of complexity, language, and detail in the response, ensuring it is understandable and impactful for the target reader

  • Explain quantum physics to a 5-year-old
  • Write a technical report on the latest advancements in AI for an audience of machine learning engineers

  • Explain the concept of containerization to a project manager with no technical background

  • Write documentation for API endpoints for an audience of third-party developers

Format

Defining the desired structure of the output (e.g., "in a bulleted list," "as a JSON object," "in a table with columns for...")

A specified format ensures the information is organized in a usable and easily digestible manner, saving time on post-processing

  • Provide the information in a bulleted list
  • Output the data as a JSON object with keys for 'name' and 'age'

  • Create a table with columns for 'Product Name', 'Price', and 'Availability'

  • Generate the YAML configuration for a Kubernetes deployment
  • Provide the error logs in a structured JSON format
  • Present a comparison of SQL and NoSQL databases in a table with columns for 'Feature', 'SQL', and 'NoSQL'

Source

Providing authoritative references or datasets the AI should base its response on, or citing where information should come from.

Anchors the AI's response in credibility or required material, especially critical for factual accuracy, traceability, or domain compliance

  • Using the provided research paper, summarize the methodology section

  • Referencing the attached sales data, identify the top 3 performing regions

  • Based on the OpenAPI specification provided, generate client-side code in Java

  • Analyze the attached network traffic logs and identify any anomalous activity

Examples (Few-Shot Prompting)

Providing one or more examples of the desired input-output pattern

This is a powerful way to guide the AI's response, especially for complex or novel tasks, by demonstrating the expected style and structure

  • Input: 'Happy' -> Output: 'Joyful, Elated'
  • Input: 'Sad' -> Output: 'Mournful, Downcast'
  • Now, Input: 'Angry' -> Output:...
  • Example Input: def add(a, b): return a + b -> Example Output: Function: add, Parameters: a, b, Description: Adds two numbers.

  • Example Input: class User: -> Example Output: Class: User, Description: Represents a user.

  • Now, Input: import os -> Output:...
Constraints & Negative Constraints

Setting boundaries or limitations on the response (e.g., "in under 200 words," "do not include technical jargon," "avoid using passive voice")

Constraints help to refine the output, making it more focused and aligned with specific requirements. Negative constraints are particularly useful for avoiding undesirable content

  • Summarize the article in under 200 words
  • Do not include any technical jargon in your explanation
  • Ensure the response avoids using passive voice
  • Generate a SQL query that runs in under 100ms on a database with 1 million records

  • Do not use any deprecated libraries in the code example
  • Avoid suggesting solutions that require significant infrastructure changes

Tone & Style

Describing the desired emotional or stylistic quality of the response (e.g., "formal," "humorous," "empathetic," "optimistic")

Tone and style add a layer of personality and nuance to the output, making it more engaging and appropriate for the context

  • Write a formal business email
  • Craft a humorous short story about a talking cat
  • Provide an empathetic response to a customer complaint
  • Write a concise and professional bug report
  • Craft an engaging blog post about the future of AI
  • Explain a complex technical concept in a casual and approachable manner

Chain of Thought/Step-by-Step Reasoning

Instructing the AI to "think step-by-step" or outline its reasoning process before providing the final answer

This technique can improve the accuracy of the final output, especially for complex reasoning tasks, and provides transparency into the AI's process

  • Think step-by-step to solve this math problem and show your work

  • Before providing the final answer, explain your reasoning process for choosing the best solution

  • Walk me through the steps of deploying a Docker container to AWS ECS

  • Before suggesting a solution, analyze the provided code for potential performance bottlenecks and explain your findings

Questioning & Iteration

Asking clarifying questions within the prompt or planning for iterative refinement of the AI's responses

This fosters a more collaborative interaction, allowing you to guide the AI towards a better answer through a series of prompts

  • If you need more information about the target audience, what specific details would be most helpful?

  • Based on this initial draft, what areas do you think need further refinement?

  • What specific operating system or cloud provider are you targeting for this deployment?

  • Could you provide the exact error message you're receiving, or any relevant stack traces?

Request for Multiple Versions

Asking for several different versions or perspectives on the same topic

This can be useful for brainstorming, exploring different creative angles, or A/B testing different approaches

  • Provide 3 different taglines for a new coffee shop, each with a different tone

  • Generate two distinct summaries of the article: one concise and one detailed

  • Generate 3 different architectural diagrams for a scalable web application, highlighting different technology stacks

  • Provide two alternative approaches to implementing user authentication, one using OAuth and another using JWT

Inclusion of Keywords

Strategically placing important keywords within the prompt that you want to see in the output

This can help to ensure that the AI's response focuses on the most critical aspects of your request

  • Write a press release about our new product launch, ensuring to include

  • 'innovation', 'sustainability', and 'customer-centric' in the text

  • When describing the microservices architecture, ensure to use terms

  • like 'loose coupling', 'API gateway', and 'container orchestration'

  • The security audit report should emphasize 'vulnerability assessment', 'penetration testing', and 'compliance standards'

Improve Prompting​

Act as a prompt engineer review the following prompt for me optimize it to make it better and ask me any questions you have before proceeding