openai · OpenAI Platform Docs
Prompt engineering | OpenAI API
Teaches strategies and best practices for constructing effective prompts, including techniques like providing reference text, splitting complex tasks, and giving the model time to think.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Prompt engineering | OpenAI API
Teaches strategies and best practices for constructing effective prompts, including techniques like providing reference text, splitting complex tasks, and giving the model time to think.
When To Use
Use when you need to optimize model outputs by implementing specific structural patterns like few-shot prompting, chain-of-thought reasoning, or task decomposition.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/prompt-engineering-openai-api-workflow-guide.md | A guide detailing strategies for prompt engineering with the OpenAI API, including model selection, message roles, and instruction following. | Questions about a guide detailing strategies for prompt engineering with the OpenAI API, including model selection, message roles, an... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-strategies-n.text | A Node.js code example demonstrating basic prompt engineering implementation using the OpenAI client to generate a bedtime story. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating basic prompt engineering implementation using the OpenAI client to generate a be... |
examples/prompt-engineering-openai-api-openai-api-python-prompt-engineering.text | A Python script demonstrating how to use the OpenAI client to generate a response using a simple prompt. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the OpenAI client to generate a response using a simple prompt. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-cli-command.text | A CLI command example demonstrating how to send a prompt to an OpenAI model using specific flags and output transformations. | Exact payloads, commands, or snippets shown in A CLI command example demonstrating how to send a prompt to an OpenAI model using specific flags and output transform... |
examples/prompt-engineering-openai-api-openai-api-csharp-prompt-engineering.text | A C# code example demonstrating how to implement prompt engineering techniques using the OpenAI client library. | Exact payloads, commands, or snippets shown in A C# code example demonstrating how to implement prompt engineering techniques using the OpenAI client library. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-java-client.text | A Java code example demonstrating how to use the OpenAI client to send a prompt to a model. | Exact payloads, commands, or snippets shown in A Java code example demonstrating how to use the OpenAI client to send a prompt to a model. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-go.text | A Go implementation demonstrating prompt engineering techniques using the OpenAI Go SDK. | Exact payloads, commands, or snippets shown in A Go implementation demonstrating prompt engineering techniques using the OpenAI Go SDK. |
examples/prompt-engineering-openai-api-openai-api-ruby-prompt-engineering.text | A Ruby script demonstrating how to use the OpenAI client to generate a bedtime story using a simple prompt. | Exact payloads, commands, or snippets shown in A Ruby script demonstrating how to use the OpenAI client to generate a bedtime story using a simple prompt. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-curl-request.text | A curl command demonstrating a basic text generation request to the OpenAI API using a prompt. | Exact payloads, commands, or snippets shown in A curl command demonstrating a basic text generation request to the OpenAI API using a prompt. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-text-example.text | A collection of text-based prompt engineering examples demonstrating different strategies for interacting with the OpenAI API. | Exact payloads, commands, or snippets shown in A collection of text-based prompt engineering examples demonstrating different strategies for interacting with the Op... |
examples/prompt-engineering-openai-api-openai-api-chat-completions-nodejs-prompt-.text | A Node.js code snippet demonstrating how to use the OpenAI Chat Completions API to send a prompt for generating a bedtime story. | Exact payloads, commands, or snippets shown in A Node.js code snippet demonstrating how to use the OpenAI Chat Completions API to send a prompt for generating a bed... |
examples/prompt-engineering-openai-api-openai-api-python-chat-completion-prompt-e.text | A Python script demonstrating a basic chat completion request using the OpenAI client to implement prompt engineering techniques. | Exact payloads, commands, or snippets shown in A Python script demonstrating a basic chat completion request using the OpenAI client to implement prompt engineering... |
examples/prompt-engineering-openai-api-openai-api-chat-completions-curl-prompt-en.text | A curl command demonstrating a chat completions API request for prompt engineering testing. | Exact payloads, commands, or snippets shown in A curl command demonstrating a chat completions API request for prompt engineering testing. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-assistant-re.text | A text example demonstrating an assistant role response containing content, refusal, and logprobs fields within an OpenAI API prompt engineering context. | Exact payloads, commands, or snippets shown in A text example demonstrating an assistant role response containing content, refusal, and logprobs fields within an Op... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-nodejs-clien.text | A Node.js code example demonstrating how to use the OpenAI client to send instructions and input for prompt engineering. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to send instructions and input for prompt engineering. |
examples/prompt-engineering-openai-api-openai-api-python-reasoning-effort.text | A Python code snippet demonstrating how to use the OpenAI API with reasoning effort parameters to control model output. | Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the OpenAI API with reasoning effort parameters to control model output. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-curl-request-2.text | A curl command demonstrating a structured API request to the OpenAI responses endpoint using instructions and input parameters. | Exact payloads, commands, or snippets shown in A curl command demonstrating a structured API request to the OpenAI responses endpoint using instructions and input p... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-nodejs.text | A Node.js code example demonstrating how to structure developer and user roles within a client request to the OpenAI API. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to structure developer and user roles within a client request to the OpenAI... |
examples/prompt-engineering-openai-api-openai-api-python-prompt-engineering-2.text | A Python script demonstrating how to structure developer and user roles within a chat completion request to implement prompt engineering techniques. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to structure developer and user roles within a chat completion request to implement... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-curl-request-3.text | A curl command demonstrating a structured API request for prompt engineering using a developer role and user input. | Exact payloads, commands, or snippets shown in A curl command demonstrating a structured API request for prompt engineering using a developer role and user input. |
examples/prompt-engineering-openai-api-openai-api-chat-completions-developer-role.text | A Node.js code example demonstrating how to use the developer role within a chat completions request to set system-level instructions. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the developer role within a chat completions request to set system-le... |
examples/prompt-engineering-openai-api-openai-api-python-chat-completions-reasoni.text | A Python script demonstrating how to use the reasoning effort parameter within a chat completions request using the OpenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the reasoning effort parameter within a chat completions request using the O... |
examples/prompt-engineering-openai-api-openai-api-chat-completions-curl-prompt-en-2.text | A curl command demonstrating a chat completions request with developer and user roles to apply prompt engineering techniques. | Exact payloads, commands, or snippets shown in A curl command demonstrating a chat completions request with developer and user roles to apply prompt engineering tec... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering.text | A text-based example demonstrating the structure of a prompt request using the OpenAI client library. | Exact payloads, commands, or snippets shown in A text-based example demonstrating the structure of a prompt request using the OpenAI client library. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-python.text | A Python code snippet demonstrating how to use the OpenAI client to send a structured prompt with variables to a model. | Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the OpenAI client to send a structured prompt with variables to a model. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-curl-request-4.text | A curl command demonstrating a structured API request using variables for prompt engineering. | Exact payloads, commands, or snippets shown in A curl command demonstrating a structured API request using variables for prompt engineering. |
examples/prompt-engineering-openai-api-openai-api-nodejs-upload-prompt-variable.text | A Node.js code snippet demonstrating how to upload a PDF file and reference it within a prompt using the OpenAI client. | Exact payloads, commands, or snippets shown in A Node.js code snippet demonstrating how to upload a PDF file and reference it within a prompt using the OpenAI client. |
examples/prompt-engineering-openai-api-openai-api-python-pdf-upload-variable-refe.text | A Python script demonstrating how to upload a PDF file and reference it using variables within an OpenAI API request. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a PDF file and reference it using variables within an OpenAI API request. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-curl-request-5.text | A curl command demonstrating how to send a prompt request to the OpenAI API using a specific file ID and variables. | Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a prompt request to the OpenAI API using a specific file ID and variables. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-identity-ins.text | A text example demonstrating the use of identity and instructions techniques for prompt engineering. | Exact payloads, commands, or snippets shown in A text example demonstrating the use of identity and instructions techniques for prompt engineering. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-nodejs-clien-2.text | A Node.js code example demonstrating how to use the OpenAI client to send a prompt and receive a response. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to send a prompt and receive a response. |
examples/prompt-engineering-openai-api-openai-api-python-prompt-engineering-instr.text | A Python script demonstrating how to load instructions from a text file and use the OpenAI client to generate a response using a specific model. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to load instructions from a text file and use the OpenAI client to generate a respo... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-curl-request-6.text | A curl command demonstrating how to send a prompt to the OpenAI API using the instructions and input parameters. | Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a prompt to the OpenAI API using the instructions and input parameters. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-identity-sen.text | A text-based prompt example demonstrating how to assign an identity and specific output constraints for sentiment classification tasks. | Exact payloads, commands, or snippets shown in A text-based prompt example demonstrating how to assign an identity and specific output constraints for sentiment cla... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-web-develope.text | A text-based example of a complex system prompt designed to instruct an AI to act as a world-class web developer. | Exact payloads, commands, or snippets shown in A text-based example of a complex system prompt designed to instruct an AI to act as a world-class web developer. |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-agentic-work.text | A text-based example demonstrating an agentic prompt strategy that instructs the model to decompose queries and complete all sub-requests before yielding. | Exact payloads, commands, or snippets shown in A text-based example demonstrating an agentic prompt strategy that instructs the model to decompose queries and compl... |
examples/prompt-engineering-openai-api-openai-api-prompt-engineering-tool-use-exp.text | A text example demonstrating how to instruct a model to explain its reasoning before calling a tool. | Exact payloads, commands, or snippets shown in A text example demonstrating how to instruct a model to explain its reasoning before calling a tool. |
What This Skill Covers
- With the OpenAI API, you can use a large language model to generate text from a prompt, as you might using ChatGPT. Models can generate almost any kind of te...
- Main sections:
Choosing a model,Prompt engineering,Message roles and instruction following,Reusable prompts,Message formatting with Markdown and XML.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.openai.com/api/docs/guides/prompt-engineering
