Study FAQ
How should I structure a reliable prompt for a Claude API application?
Also asked as 2
- What belongs in the Claude system prompt, user message, and reference context?
- How do I turn a Claude application task into a prompt with clear rules and output expectations?
Answer
Define the task, permitted inputs, expected evidence, output format, and missing-data behavior before drafting the prompt. In Claude's Messages API, put stable guidance in the top-level system field and the current request and approved inputs in user messages. Label reference material, examples, and untrusted content so their intended use is clear. Keep sensitive access and downstream decisions under application control. Create a Message Claude prompting best practices
Write concrete instructions. For an incident classifier, list the approved categories, ask for a category and supporting evidence from the incident, and specify review when the evidence is missing or contradictory. Tags or labeled sections can distinguish the incident text from instructions and examples. Test placement and wording on the complete rendered prompt. Claude prompting best practices Prompt engineering overview
Text in an uploaded document or tool result can contain apparent instructions. Preserve its origin, encode it for the destination format, and ask the model to analyze it as data. Use documented tool-result blocks for external tool data. Validate the response independently and restrict what data and tools the task can reach. If the consumer needs structured data, use a supported structured-output contract and application validation. Mitigate jailbreaks and prompt injections Claude structured outputs
Full explanation
Prompt Engineering for Reliable Claude Applications
Study guide · CCDV-F
Read the full explanation