Prompt Templates
Ready-to-use prompt templates for common Claude AI tasks.
Code Development
Code Review Template
markdown
You are an expert code reviewer. Review this code for:
- Bugs and logic errors
- Performance issues
- Security vulnerabilities
- Code style and best practices
- Documentation completeness
Code to review:
```[language]
[code]Provide specific feedback with line references and suggested improvements.
### Test Generation Template
```markdown
Generate comprehensive unit tests for this code:
```[language]
[code]Requirements:
- Test all public methods/functions
- Include edge cases and error scenarios
- Use appropriate test framework ([pytest/jest/etc])
- Aim for >90% code coverage
- Include setup/teardown if needed
### Debugging Template
```markdown
Help me debug this issue:
**Code:**
```[language]
[code]Error Message:
[error]Expected Behavior: [description]
Actual Behavior: [description]
Please identify the root cause and provide a fix with explanation.
## Data Analysis
### Data Exploration Template
```markdown
Analyze this dataset and provide insights:
**Data:**
```[format]
[data]Analysis Requirements:
- Descriptive statistics
- Data quality assessment
- Key patterns and trends
- Anomalies or outliers
- Recommendations for further analysis
Present findings with visualizations if applicable.
### SQL Query Template
```markdown
Generate an SQL query for this requirement:
**Database Schema:**
```sql
[schema]Requirements: [detailed requirements]
Constraints:
- Performance optimized
- Include proper indexing suggestions
- Handle edge cases
- Return results in [format]
## Documentation
### API Documentation Template
```markdown
Generate comprehensive API documentation for this code:
```[language]
[code]Include:
- Endpoint description
- Parameters (required/optional)
- Request/response examples
- Error codes and handling
- Authentication requirements
- Rate limiting information
### README Template
```markdown
Create a comprehensive README.md for this project:
**Project Name:** [name]
**Description:** [brief description]
**Tech Stack:** [technologies]
Include:
- Installation instructions
- Quick start guide
- Configuration options
- Usage examples
- Contributing guidelines
- License informationContent Creation
Blog Post Template
markdown
Write a technical blog post about [topic]:
**Target Audience:** [developers/beginners/experts]
**Tone:** [professional/casual/educational]
**Length:** [word count]
Structure:
- Engaging introduction with hook
- Clear problem statement
- Step-by-step solution
- Code examples with explanations
- Best practices and tips
- Conclusion with key takeawaysTechnical Explanation Template
markdown
Explain [complex topic] in simple terms:
**Audience Level:** [beginner/intermediate/advanced]
**Context:** [specific use case]
Requirements:
- Start with basic concepts
- Use analogies where helpful
- Include practical examples
- Progress from simple to complex
- Provide further reading resourcesBusiness Analysis
Requirements Analysis Template
markdown
Analyze these requirements and create a technical specification:
**Business Requirements:**
[requirements]
**Constraints:**
[technical/budget/time constraints]
Provide:
- Functional requirements breakdown
- Technical architecture suggestions
- Implementation phases
- Risk assessment
- Resource estimates
- Success metricsCode Architecture Template
markdown
Design a software architecture for this system:
**Requirements:**
[functional requirements]
**Non-functional Requirements:**
- Performance: [metrics]
- Scalability: [requirements]
- Security: [requirements]
- Availability: [requirements]
Provide:
- High-level architecture diagram
- Component breakdown
- Technology recommendations
- Database design
- Deployment strategySpecialized Templates
Security Audit Template
markdown
Perform a security audit of this code:
```[language]
[code]Check for:
- Input validation vulnerabilities
- Authentication/authorization issues
- SQL injection risks
- XSS vulnerabilities
- CSRF protection
- Data encryption
- Logging and monitoring
Provide severity ratings and remediation steps.
### Performance Optimization Template
```markdown
Optimize this code for performance:
```[language]
[code]Performance Goals: [specific metrics]
Constraints: [memory/CPU/network limitations]
Analyze:
- Bottlenecks and hot paths
- Algorithm complexity
- Memory usage patterns
- I/O operations
- Caching opportunities
Provide optimized version with benchmarks.
### Migration Planning Template
```markdown
Create a migration plan for:
**From:** [current system/technology]
**To:** [target system/technology]
**System Details:**
[current architecture/data/dependencies]
**Constraints:**
- Downtime: [acceptable limits]
- Data integrity: [requirements]
- Rollback: [strategy needed]
Provide:
- Step-by-step migration plan
- Risk mitigation strategies
- Testing procedures
- Rollback plan
- Timeline estimatesPrompt Engineering Tips
XML Structure Template
xml
<instructions>
<role>You are a [expert type]</role>
<task>[specific task description]</task>
<input>
<format>[expected input format]</format>
<constraints>[any limitations]</constraints>
</input>
<output>
<format>[required output format]</format>
<style>[tone/style requirements]</style>
</output>
<examples>
<example>
<input>[example input]</input>
<output>[example output]</output>
</example>
</examples>
</instructions>Chain of Thought Template
markdown
Think through this step-by-step:
1. **Understanding**: What is the user asking for?
2. **Analysis**: What information do I need?
3. **Planning**: What's the best approach?
4. **Execution**: How should I implement this?
5. **Validation**: Does this meet the requirements?
Now provide your response:Few-Shot Template
markdown
Here are examples of the task:
**Example 1:**
Input: [input 1]
Output: [output 1]
**Example 2:**
Input: [input 2]
Output: [output 2]
**Example 3:**
Input: [input 3]
Output: [output 3]
Now complete this one:
Input: [new input]
Output:Custom Template Creator
Use this meta-template to create domain-specific templates:
markdown
Create a prompt template for [specific domain/task]:
**Domain:** [field/industry]
**Common Use Cases:** [list typical scenarios]
**Required Expertise Level:** [beginner/expert]
**Typical Input Format:** [description]
**Desired Output Format:** [description]
The template should:
- Be clear and specific
- Include relevant examples
- Handle edge cases
- Be reusable across similar tasks
- Follow prompt engineering best practicesUsage Guidelines
Template Customization
- Replace placeholders in [brackets] with actual values
- Adjust complexity based on your audience
- Add domain-specific examples for better results
- Test and iterate to improve effectiveness
Best Practices
- Be specific about output format requirements
- Include concrete examples when possible
- Set clear boundaries and constraints
- Use consistent terminology
- Test with edge cases
See Also: Workflow: Prompt Engineering | Commands Reference