From mpy-reviewer
Use this skill when the user wants to review MicroPython code changes using historical review patterns. Invoke when user mentions reviewing code, finding review examples, or wants feedback on MicroPython PRs/commits/diffs. Provides semantic search across ~19.5K categorized review comments.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mpy-reviewer:reviewThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill provides AI-assisted code review for MicroPython using historical review patterns from the lead maintainer. It searches a database of ~19.5K categorized review comments to find relevant examples and generate review context.
This skill provides AI-assisted code review for MicroPython using historical review patterns from the lead maintainer. It searches a database of ~19.5K categorized review comments to find relevant examples and generate review context.
Note: When the mpy-reviewer MCP server is available (registered in .claude/settings.json), prefer using MCP tools directly (review_diff, search_reviews, etc.) instead of the CLI. The MCP server keeps the embedding model warm across calls, eliminating 2-3s cold start per query. This skill remains as a fallback for sessions outside the project scope.
IMPORTANT: The review_diff MCP tool accepts diffs of any size. Do NOT fall back to CLI because a diff seems "too large". Pass the full diff text directly as the diff_text parameter regardless of length. The tool internally splits multi-file diffs into per-file chunks for embedding, so large diffs are handled efficiently.
MCP file-based output: The MCP review_diff and review_pr tools return a compact orchestration prompt (~5-8K) instead of raw data. Review examples are written to individual temp files under /tmp/mpy-review-*/. The prompt includes a summary table with file paths, sizes, severities, and domains. To use the examples:
Invoke this skill when the user:
Important: Users cannot invoke skills directly. They must ask you to use the skill:
When the user asks for review help, invoke this skill proactively.
This skill requires codanna for semantic code search and codebase analysis.
Automatic setup: A SessionStart hook automatically installs codanna via cargo on first use.
Manual installation:
cargo install codanna --all-features
If codanna is not installed, the tool will fail with a prominent error message directing the user to install it.
The underlying CLI tool is located at:
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer
Always use this full path when invoking the tool. Do not rely on PATH.
Parse natural language requests and map to appropriate tool commands:
User says: "review my current changes", "review this branch", "review what I've done"
What to do:
git diff main (or appropriate base branch)git diff main | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output promptExample:
git diff main | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output prompt
User says: "review commit abc123", "check commit abc123"
What to do:
git show abc123git show abc123 | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --output promptExample:
git show ca65d543 | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output prompt
User says: "review my uncommitted changes", "review staged changes"
What to do:
# All uncommitted changes (staged + unstaged)
git diff HEAD | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --output prompt
# Only staged changes
git diff --cached | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --output prompt
User says: "review PR 12345", "check pull request 12345"
What to do:
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --pr 12345 --codebase --output prompt
User says: "review my changes to py/gc.c", "review changes in extmod/"
What to do:
git diff main -- py/gc.c | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --output prompt
git diff main -- extmod/ | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output prompt
User says: "find examples of memory allocation reviews", "show me feedback on error handling"
What to do:
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer search "memory allocation" --domain memory -k 10
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer search "error handling" --domain correctness -k 10
User says: "show me similar reviews", "what has been said about this before"
What to do:
Use --output context instead of --output prompt to get just the examples without full prompt structure:
git diff main | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --output context
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review [OPTIONS]
Input Options (choose one):
--diff FILE - Review a diff file--pr NUMBER - Review a GitHub PR (uses gh CLI)--stdin - Read diff from stdin (recommended for git integration)Quality Options:
--codebase - Include MicroPython codebase context (definitions, patterns) [RECOMMENDED]--rerank - Use cross-encoder re-ranking for better relevance (slower, 5-10s on CPU)-k N - Number of review examples (default: 8)Output Options:
--output context - Just the review examples (default, quick to read)--output prompt - Full prompt ready for AI review (recommended for comprehensive review)--output json - Structured JSON outputuv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer search "query" [OPTIONS]
Options:
-k N - Number of results (default: 10)--domain DOMAIN - Filter by domain (see categories below)--severity SEVERITY - Filter by severity (blocking, suggestion, nitpick)--component COMPONENT - Filter by component (py_core, extmod, port_specific, etc.)--style-only - Only show comments that exemplify the maintainer's style--json - JSON outputuv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer stats
Shows index status and record count. Use this to verify the system is working.
correctness - Logic bugs, edge cases, error handlingcode_style - Formatting, naming conventionsapi_design - Public interfaces, function designmemory - Memory management, leaks, allocationperformance - Speed, efficiency optimizationsportability - Cross-platform compatibilitydocumentation - Comments, docs, claritytesting - Test coverage, qualitysecurity - Security vulnerabilitiesarchitecture - Design patterns, structurebuild_system - Makefiles, build configurationerror_handling - Error paths, recoveryblocking - Must fix before mergesuggestion - Recommended improvementnitpick - Minor style/preferencepy_core - Core Python runtime (py/)extmod - Extended modules (extmod/)port_specific - Port implementations (ports/)drivers - Hardware driverstools - Build/dev toolstests - Test suitedocs - Documentationbuild_system - Build configurationReturns formatted markdown with:
Present this directly to the user to show relevant past reviews.
Returns a complete prompt containing:
How to use: After generating this prompt, you should:
Note: When using the MCP server instead of CLI, the review_diff/review_pr tools return an orchestration prompt with temp file paths rather than inlining all examples. Read the referenced files to access the full review examples.
Returns structured data. Parse and present relevant fields to user.
After generating findings, use the verify_findings MCP tool to cross-check each
finding against the actual codebase before presenting results. This reduces false
positives caused by pattern-matching without context.
Findings must be formatted as a JSON array:
[
{
"file": "extmod/asyncio/stream.py",
"line": 42,
"severity": "blocking",
"description": "POLLHUP not handled in ioctl bitmask",
"diff_hunk": "the relevant diff hunk text"
}
]
verify_findings(findings, diff_text, pr_number=None, repo="micropython/micropython")
findings: JSON array of structured findings (format above)diff_text: the full unified diff being reviewedpr_number: optional PR numberrepo: repository slugReturns a markdown orchestration prompt with a summary table and paths to
per-finding verdict files under /tmp/mpy-verify-*/.
review_diff to get examples and style contextverify_findings(findings, diff_text) to cross-checkUser: "Can you review my current changes?"
Your response:
git diff main | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output promptUser: "What has been said about similar code before?"
Your response:
git diff main | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --output contextUser: "Find me examples of feedback on GPIO configuration"
Your response:
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer search "GPIO configuration" --component port_specific -k 15User: "Review commit ca65d543"
Your response:
git show ca65d543 | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output promptUser: "Can you review my changes to py/gc.c?"
Your response:
git diff main -- py/gc.c | uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer review --stdin --codebase --output prompt--codebaseWhen: User wants comprehensive review, mentions API usage, function calls, or needs context Why: Includes MicroPython codebase definitions and patterns Cost: +2-3 seconds
--rerankWhen: User emphasizes quality/accuracy, or initial results seem off-topic Why: Better relevance via cross-encoder scoring Cost: +5-10 seconds on CPU
--output promptWhen: User wants detailed review, mentions "thorough", or you'll provide review feedback Why: Gives you complete context to generate maintainer-style review Cost: Longer output to process
--output contextWhen: User asks for examples, "what has been said", or wants quick reference Why: Just the examples, faster to read Cost: Minimal
search instead of reviewWhen: User asks about patterns/topics without providing specific code to review Example: "What do reviewers think about error handling?" Why: Semantic search, not diff-based retrieval
The vector index hasn't been built. Inform user:
The review database index needs to be built first. Run:
cd ${CLAUDE_PLUGIN_ROOT}
uv run python scripts/build_index_resume.py
Verify uv and the project are accessible:
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer stats
Handle appropriately - ask user to clarify or check their git state.
Inform user if a long operation is running.
The database contains:
Be flexible with user requests. Map to appropriate commands:
| User Intent | Tool Command |
|---|---|
| "review this" | git diff | ... review --stdin |
| "review commit X" | git show X | ... review --stdin |
| "review PR 123" | ... review --pr 123 |
| "find GPIO reviews" | ... search "GPIO" --component port_specific |
| "show me memory issues" | ... search "memory" --domain memory --severity blocking |
| "examples of his style" | ... search "..." --style-only |
Always interpret user intent conversationally, then invoke the appropriate tool command.
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewergit diff \| ... --stdin over temp files--codebase --output prompt unless user wants quick resultsTo test the skill is working:
uv run --project ${CLAUDE_PLUGIN_ROOT} mpy-reviewer stats
Should show:
npx claudepluginhub andrewleech/mpy-reviewer --plugin mpy-reviewerRuns cross-model code reviews using the external Codex CLI tool from a Claude session. Catches bugs that single-model self-review would miss by leveraging a different reviewer architecture.
Code review with semantic diffs, expert routing by file type, and auto-task creation for critical issues. Works on staged changes, files, or PRs.