How to Write Better System Prompts for Claude
Learn to craft effective system prompts for Claude AI with clear instructions, examples, and best practices for better AI responses.
- Define Claude's role and expertise level. Start your system prompt by explicitly stating what Claude should act as. Use phrases like 'You are a senior software engineer' or 'You are a technical writing expert.' This establishes the knowledge domain and perspective Claude should adopt. Be specific about the expertise level rather than generic.
- Specify the exact output format. Tell Claude precisely how to structure responses. Use formatting instructions like 'Respond in numbered steps,' 'Use bullet points for each feature,' or 'Format as JSON with specific field names.' Include any required sections, word limits, or style guidelines. The more specific your format requirements, the more consistent Claude's outputs will be.
- Set clear behavioral boundaries. Establish what Claude should and should not do. Include instructions like 'Never provide investment advice' or 'Always ask for clarification before making assumptions.' Define the tone (professional, casual, technical) and any limitations on the scope of responses. This prevents unwanted behaviors and keeps Claude focused.
- Include context about the target audience. Specify who Claude is communicating with and their knowledge level. Write instructions like 'Explain to software developers familiar with Python' or 'Write for complete beginners with no technical background.' This helps Claude adjust complexity, terminology, and examples appropriately for the intended audience.
- Provide specific examples within the prompt. Include 1-2 concrete examples of ideal responses or interactions within your system prompt. Show Claude exactly what good output looks like for your use case. Examples should demonstrate the format, tone, and level of detail you expect. This creates a reference point for consistent quality.
- Add error handling and edge case instructions. Tell Claude how to respond when it lacks information or encounters unclear requests. Include instructions like 'If the request is ambiguous, ask specific clarifying questions' or 'When you don't know something, say so directly rather than guessing.' This prevents hallucination and improves reliability.
- Test and refine with real use cases. Run your system prompt against actual queries you plan to use. Check that Claude's responses match your expectations for format, tone, and accuracy. Identify patterns in unwanted responses and add specific instructions to address them. Iterate on the prompt based on real performance rather than theoretical scenarios.