Back to .md Directory

šŸš€ Improved Ollama Review Guide

Guides developers in configuring an AI code review tool that filters false positives and understands project context.

May 2, 2026
0 downloads
0 views
ai prompt
View source

What this file does

Guides developers in configuring an AI code review tool that filters false positives and understands project context.

When to use it

  • Setting up AI-powered code review for a project
  • Reducing noise from automated review suggestions
  • Customizing review focus for specific codebases
  • Improving review accuracy with ensemble models

Assumes this stack

Next.jsReactOllamaqwen2.5:14b-instructgemma2:2b

šŸš€ Improved Ollama Review Guide

What's New

  1. āœ… Project context - AI now understands your Pacific Disaster Platform
  2. āœ… Better prompts - Focuses on real bugs, not style opinions
  3. āœ… False positive filtering - Removes known bad advice automatically
  4. āœ… Ensemble mode ready - Multi-model consensus for better accuracy

Quick Start

Best Quality (Recommended)

# Enable ensemble mode
echo "USE_ENSEMBLE=true" >> .env.local

# Run review
npm run ollama:review

Fast Review (Good for quick checks)

npm run ollama:fast

Review Specific File

npm run ollama:review -- src/components/YourComponent.tsx

Quality Improvements

Before (āŒ Old Issues)

  • False claims about aria-label
  • Nitpicky style suggestions
  • Generic "add comments" advice
  • Wrong framework assumptions

After (āœ… New Behavior)

  • Focused on real bugs only
  • Understands Next.js/React patterns
  • Knows your project context
  • Filters out false positives

How to Customize

1. Adjust Project Context

Edit .ollama-context.md to add:

  • New patterns to ignore
  • Specific things to check
  • Project-specific conventions

2. Add More False Positive Filters

In scripts/ollama-review.js, add patterns to filterFalsePositives():

const falsePositivePatterns = [
  /your-pattern-here/i,
  // Add more...
];

3. Change Review Focus

Modify getReviewFocus() in the script to emphasize different areas.


Best Practices

āœ… DO Use For:

  • Pre-commit checks - Catch bugs before pushing
  • Complex logic - Get second opinion on tricky code
  • New features - Quick sanity check
  • Learning - Understand potential issues

āŒ DON'T Rely On For:

  • Final say - Human review is still essential
  • Framework expertise - AI can be wrong about React/Next.js
  • Architecture - Complex decisions need human judgment
  • Security audits - Use dedicated security tools

Troubleshooting

"Too many false positives"

  1. Check .ollama-context.md has your patterns
  2. Add more filters to filterFalsePositives()
  3. Use ensemble mode for consensus

"Review too generic"

  1. Add more specific context to .ollama-context.md
  2. Update getReviewFocus() for your file types
  3. Try different models (qwen2.5:14b is best)

"Missing real issues"

  1. Enable ensemble mode
  2. Reduce SKIP_TRIVIAL threshold
  3. Review more files at once (context helps)

Model Recommendations

TaskModelWhy
Deep reviewqwen2.5:14b-instructBest reasoning, catches real issues
Fast checkgemma2:2bQuick, good for obvious bugs
ConsensusMultiple (ensemble)Best accuracy, reduces false positives

Metrics

Track your improvements:

  • Bugs caught before production
  • False positives reduced
  • Time saved in reviews
  • Team agreement with suggestions

Good luck! šŸš€

What's inside

7 sections covering setup, customization, best practices, troubleshooting, and model recommendations with code examples.

Change this for your project

  • Replace Pacific Disaster Platform with your project context
  • Replace .ollama-context.md with your own context file
  • Replace scripts/ollama-review.js with your script path
  • Replace qwen2.5:14b-instruct with your preferred model

Where it goes

Keep alongside your test suite. Used to define and score model evaluations.

Worth borrowing

  • Ensemble mode using multiple models to reduce false positives
  • Explicit false positive filtering via pattern matching in a dedicated function

Related Documents