Skip to main content
LlamaCoding

Best Llama Prompt for Code Review

This optimized Llama prompt for code review helps you get professional-quality results in seconds. Perfect for coding professionals who want to leverage AI effectively.

๐Ÿ“The Optimized Prompt

You are a senior engineer conducting a thorough code review.

**Task:** Review the provided code comprehensively.

**Check for:**
1. **Bugs** - Logic errors, edge cases, null checks
2. **Security** - Vulnerabilities, injection risks, auth issues
3. **Performance** - Inefficiencies, memory leaks, N+1 queries
4. **Readability** - Naming, structure, comments, DRY
5. **Best practices** - Design patterns, SOLID, error handling

**Format your response as:**
- ๐Ÿ”ด Critical issues (must fix)
- ๐ŸŸก Suggestions (should consider)
- ๐ŸŸข What's done well
- Refactored code (if needed)

**Code to review:**
```
[PASTE YOUR CODE]
```

๐Ÿ’ฌExample Output

Here's an example of what Llama might generate using this prompt:

## Code Review Results

### ๐Ÿ”ด Critical Issues

**1. SQL Injection Vulnerability (Line 23)**
```javascript
// VULNERABLE
const query = `SELECT * FROM users WHERE id = ${userId}`;

// SECURE
const query = 'SELECT * FROM users WHERE id = $1';
const result = await db.query(query, [userId]);
```

**2. Missing Error Handling (Line 45)**
The async function doesn't have try/catch, causing unhandled promise rejections.

### ๐ŸŸก Suggestions

**1. Consider using constants for magic numbers**
```javascript
const MAX_RETRIES = 3; // Instead of hardcoded 3
```

**2. Function is too long (80+ lines)**
Consider breaking into smaller, testable functions.

### ๐ŸŸข What's Done Well
- Clear variable naming
- Good use of async/await
- Comprehensive input validation

๐Ÿ“ŠPrompt Performance

Scores are estimated based on prompt characteristics (not live model calls).

Best Model:ChatGPT
Best for:General tasks
Confidence:Medium
ChatGPT
88
Gemini
84
Claude
82
Grok
75
Llama
70

๐Ÿ†Why ChatGPT wins for this prompt

  • โ€ขVersatile across many use cases
  • โ€ขConsistent, reliable outputs
  • โ€ขStrong instruction following

๐Ÿ’กWhy This Prompt Works

  • โœ“Color-coded severity makes issues easy to prioritize
  • โœ“Covers security, performance, and maintainability
  • โœ“Provides concrete fixes, not just criticism
  • โœ“Balances critique with positive feedback
  • โœ“Structured format ensures thorough review

โ“Frequently Asked Questions

What makes this the best Llama prompt for code review?

This prompt is specifically optimized for Llama and code review tasks. It includes role assignment, clear structure, and specific output requirements that Llama responds to best, resulting in more accurate and useful outputs.

Can I customize this code review prompt?

Absolutely! Replace the placeholder text in brackets [LIKE THIS] with your specific details. The more context you provide, the better your results will be.

Does this prompt work with other AI models besides Llama?

Yes, while this prompt is optimized for Llama, it will work well with other AI models like ChatGPT, Claude, Gemini, and Llama. You may see slight variations in output style.

How do I get the best results from this prompt?

Fill in all placeholder sections with specific details, be clear about your desired outcome, and don't hesitate to ask for revisions if the first output isn't perfect. Iteration is key to great AI results.

Related Llama Prompts

Try This Prompt with Other AI Models

Explore More