MicroPython code review RAG system
npx claudepluginhub andrewleech/mpy-reviewerMicroPython code review assistant backed by 18,614 categorized review comments
Code review feedback for MicroPython projects, based on historical review patterns from the micropython/micropython repository. Surfaces relevant past reviews, coding conventions, and common issues to help you catch problems before submitting a PR.
When you're working on MicroPython code, mpy-reviewer searches a database of ~19.5K categorized review comments to find feedback relevant to your changes. It covers:
Results are filtered by component (py_core, extmod, ports, etc.), severity (blocking, suggestion, nitpick), and domain, so feedback is targeted to the code you're actually changing.
/plugin marketplace add andrewleech/mpy-reviewer
/plugin install mpy-reviewer@mpy-reviewer
The plugin's SessionStart hook installs dependencies via uv and starts the MCP server automatically. Requires Python 3.10+, uv, and Rust/cargo (codanna is installed automatically for codebase-aware search).
Once installed, ask Claude to review your code:
Can you review my current branch?
Can you review commit ca65d543?
Can you review my changes to py/gc.c?
Find examples of memory allocation reviews.
For use outside Claude Code:
cd /path/to/mpy-reviewer
uv sync
uv run mpy-reviewer stats
Reviews follow the patterns established in the MicroPython project's review history: terse, technical, and direct. No filler, no gratuitous praise.
Feedback is characteristically brief. Nitpicks are extremely short (median 45 characters), blocking comments are concise but include enough technical detail to explain why.
Common patterns:
Examples from real reviews:
"please no blank lines at start of files"
"please put `void` in arg list"
"this can just be a `bool`"
"Why not `mp_obj_get_int(args[3])`? That will do error checking that it's an int."
"Please use `mp_hal_pin_config(...)`"
"To avoid labels and goto (which is nice if possible)..."
"I think this function should be called X. Is that what it's doing?"
These are the most common categories of feedback across the project's review history:
API Design:
Code Style:
Portability:
Testing:
Documentation:
# Search for relevant past reviews
mpy-reviewer search "memory allocation error handling" -k 10
# Search with filters
mpy-reviewer search "GPIO configuration" --component port_specific --domain api_design
# Review a PR
mpy-reviewer review --pr 17321
# Review a diff from stdin
git diff main | mpy-reviewer review --stdin --output prompt
# Review a diff file
mpy-reviewer review --diff changes.patch
# Show index statistics
mpy-reviewer stats
from rag.retriever import search, find_similar
# Semantic search
results = search("memory allocation in C", top_k=10)
# Search with filters
results = search(
"error handling",
top_k=10,
domain="correctness",
component="py_core",
severity="blocking",
)
# Find similar reviews for a code diff
results = find_similar(diff_text, top_k=8)
Use uv run python or activate the venv first (source .venv/bin/activate).
When running as a plugin, the MCP server provides these tools: