Skip to content

Instantly share code, notes, and snippets.

@Kjdragan
Last active February 3, 2025 23:34
Show Gist options
  • Save Kjdragan/5ec4cb149648ea5c3c5ec70b5a93a69e to your computer and use it in GitHub Desktop.
Save Kjdragan/5ec4cb149648ea5c3c5ec70b5a93a69e to your computer and use it in GitHub Desktop.
Prompts:
CONTEXT:
We are going to create one of the best ChatGPT prompts ever written. The best prompts include comprehensive details to fully inform the Large Language Model of the prompt’s: goals, required areas of expertise, domain knowledge, preferred format, target audience, references, examples, and the best approach to accomplish the objective. Based on this and the following information, you will be able write this exceptional prompt.
ROLE:
You are an LLM prompt generation expert. You are known for creating extremely detailed prompts that result in LLM outputs far exceeding typical LLM responses. The prompts you write leave nothing to question because they are both highly thoughtful and extensive.
ACTION:
1) Before you begin writing this prompt, you will first look to receive the prompt topic or theme. If I don't provide the topic or theme for you, please request it.
2) Once you are clear about the topic or theme, please also review the Format and Example provided below.
3) If necessary, the prompt should include “fill in the blank” elements for the user to populate based on their needs.
4) Take a deep breath and take it one step at a time.
5) Once you've ingested all of the information, write the best prompt ever created.
FORMAT:
For organizational purposes, you will use an acronym called "C.R.A.F.T." where each letter of the acronym CRAFT represents a section of the prompt. Your format and section descriptions for this prompt development are as follows:
-Context: This section describes the current context that outlines the situation for which the prompt is needed. It helps the LLM understand what knowledge and expertise it should reference when creating the prompt.
-Role: This section defines the type of experience the LLM has, its skill set, and its level of expertise relative to the prompt requested. In all cases, the role described will need to be an industry-leading expert with more than two decades or relevant experience and thought leadership.
-Action: This is the action that the prompt will ask the LLM to take. It should be a numbered list of sequential steps that will make the most sense for an LLM to follow in order to maximize success.
-Format: This refers to the structural arrangement or presentation style of the LLM’s generated content. It determines how information is organized, displayed, or encoded to meet specific user preferences or requirements. Format types include: An essay, a table, a coding language, plain text, markdown, a summary, a list, etc.
-Target Audience: This will be the ultimate consumer of the output that your prompt creates. It can include demographic information, geographic information, language spoken, reading level, preferences, etc.
TARGET AUDIENCE:
The target audience for this prompt creation is ChatGPT 4o or ChatGPT o1.
Please reference the example I have just provided for your output. Again, take a deep breath and take it one step at a time.
___________
<purpose>
Given the quarterly report, extract the information requested in information-to-extract.
</purpose>
<instructions>
<instruction>Generate only the information requested by the user.</instruction>
<instruction>Respond in JSON format with the exact keys requested by the user. </instruction>
<instruction>Use the key and the value to understand what the user is asking for. They will embed the outcome in the value.</instruction>
<instruction>Replace the value with the answer requested by the user.</instruction>
<instruction>Do not include any other text. Respond only with the JSON object.</instruction>
</instructions>
<quarterly-report>
{{quarterly_report}}
</quarterly-report>
<information-to-extract>
{{information_to_extract}}
</information-to-extract>

The Anatomy of an Effective Prompt: A Comprehensive Guide

Introduction

Creating effective prompts for AI models is crucial for getting accurate, useful responses. This guide breaks down the key components of a well-structured prompt, using the example of a hiking recommendation request to illustrate best practices.

Core Components

1. Goal Statement

The goal statement should be clear, specific, and concise. It sets the primary objective for the model to achieve.

Good example:

I want a list of the best medium-length hikes within two hours of San Francisco.

This goal statement works well because it:

  • Specifies what's being requested (a list of hikes)
  • Includes clear constraints (medium-length, within two hours)
  • Defines the geographic context (San Francisco)
  • Uses simple, direct language

2. Return Format Specification

After stating your goal, specify exactly how you want the information structured. This ensures the model provides data in a format that's most useful to you.

Example format specification:

For each hike, return:
- Name of the hike (as found on AllTrails)
- Starting address
- Ending address
- Distance
- Drive time
- Hike duration
- What makes it unique and cool

This specification works because it:

  • Lists each required piece of information
  • Specifies the source for consistency (AllTrails)
  • Includes both factual data and subjective information
  • Creates a clear structure for the response

3. Scope and Limitations

Define the boundaries of what you're looking for. This helps prevent information overload and ensures the most relevant results.

Example:

Return the top 3.

This is effective because it:

  • Sets a clear numerical limit
  • Implies you want the best options
  • Keeps the response focused and manageable

4. Quality Control Parameters

Include specific warnings or quality checks you want the model to consider.

Example:

Be careful to make sure that:
- The name of trail is correct
- It actually exists
- The time is correct

These parameters:

  • Prevent common errors
  • Ensure data accuracy
  • Focus on critical validation points

5. Context Dump

Provide relevant background information that helps the model understand your specific situation and preferences.

Good context includes:

  • Personal experience ("we've done pretty much all of the local SF hikes")
  • Specific preferences ("ocean views would still be nice")
  • Time-sensitive information ("we won't be seeing eachother for a few weeks")
  • Previous experiences ("the old missile silos and stuff near Discovery point is cool but I've just done that")

Best Practices

  1. Structure Matters: Organize your prompt in a logical flow from goal to specifications to context.

  2. Be Specific: Use precise language and avoid ambiguity.

  3. Include Constraints: Clear boundaries help the model provide more relevant responses.

  4. Provide Context: Personal information and preferences help tailor the response to your needs.

  5. Quality Guidelines: Include specific accuracy checks you want the model to perform.

Common Pitfalls to Avoid

  1. Vague Requirements: Avoid general terms without specific definitions.

    • Bad: "good hikes"
    • Better: "medium-length hikes within two hours of San Francisco"
  2. Missing Format Specifications: Don't assume the model knows how you want information structured.

  3. Insufficient Context: Leaving out relevant background information can lead to generic responses.

  4. No Quality Parameters: Failing to specify accuracy requirements can result in unreliable information.

Conclusion

A well-crafted prompt follows a clear structure:

  1. Clear goal statement
  2. Specific return format
  3. Defined scope
  4. Quality parameters
  5. Relevant context

By following these guidelines, you can create prompts that consistently generate useful, accurate, and relevant responses from AI models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment