// Structure Claude prompts for clarity and better results using roles, explicit instructions, context, positive framing, and strategic organization. Use when crafting prompts for complex tasks, long documents, tool workflows, or code generation.
| name | Writing Effective Prompts |
| description | Structure Claude prompts for clarity and better results using roles, explicit instructions, context, positive framing, and strategic organization. Use when crafting prompts for complex tasks, long documents, tool workflows, or code generation. |
Set behavioral context upfront:
You are an expert software test engineer. Help me write comprehensive unit tests covering edge cases and error conditions.
Replace vague requests with specific requirements:
Create a dashboard with:
- Real-time data visualization
- Interactive filtering and drill-down
- Responsive design (mobile + desktop)
- Export functionality for reports
Include as many relevant features as possible.
Explain why to help Claude generalize:
Your response will be read aloud via text-to-speech, so avoid ellipses (TTS engines cannot pronounce them). Use complete sentences instead.
Tell what TO do, not what NOT to do:
Format your response as plain text with clear paragraph breaks.
Examples powerfully shape output. Use <example> tags:
<example>
Input: "Added JWT authentication"
Output:
feat(auth): implement JWT-based authentication
Add login endpoint and token validation middleware.
</example>
Structure multi-section responses clearly:
<code_quality>
Assess overall code quality and patterns
</code_quality>
<security_review>
Review security concerns step-by-step
</security_review>
<optimization_suggestions>
List specific performance improvements
</optimization_suggestions>
Break multi-step processes into explicit phases:
Phase 1: Research and Analysis
- Examine existing codebase structure
- Identify patterns and conventions
Phase 2: Design and Planning
- Create architectural design
- Define interfaces and data flow
Phase 3: Implementation
- Build core functionality
- Add error handling
- Implement tests
Put large documents (~20K+ tokens) at the top, queries at the end:
[20,000 tokens of annual report]
[15,000 tokens of competitor analysis]
Analyze above. Identify strategic advantages and Q3 focus areas.
Improves response quality by up to 30% for complex multi-document inputs.
<documents>
<document>
<source>annual_report_2023.pdf</source>
<document_content>
[CONTENT]
</document_content>
</document>
<document>
<source>competitor_analysis.xlsx</source>
<document_content>
[CONTENT]
</document_content>
</document>
</documents>
Provide comprehensive market position analysis with specific recommendations.
For accuracy in long document analysis:
1. Extract relevant quotes from documents (use <relevant_quotes> tags)
2. Based on quotes, provide analysis (use <analysis> tags)
3. List recommendations (use <recommendations> tags)
You have access to file and search tools. When working with multiple files:
- Execute independent operations in parallel
- Prefer batch operations over sequential processing
- Verify changes before finalizing
- Clean up temporary artifacts when complete
Request simultaneous execution for efficiency.
Create an analytics dashboard.
Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond basics to create a fully-featured implementation.
For frontend code:
For general solutions:
Please write a high quality, general purpose solution. Implement logic that works for all valid inputs, not just test cases. Don't hard-code values. Provide a principled, maintainable implementation following best practices.