pythonista-reviewing
Code Review Best Practices
Core Philosophy
Review at PR level, not file-by-file. Focus on egregious structural issues, not minutia. Look for cross-file patterns that indicate architectural problems.
Quick Start
# ALWAYS filter out lock files first (often 10k+ lines of noise)
git diff main...HEAD -- . ':!uv.lock' ':!poetry.lock' > /tmp/pr-diff.txt
wc -lc /tmp/pr-diff.txt # Most diffs fit in 256KB after this
# If still too big, filter more
git diff main...HEAD -- . ':!uv.lock' ':!docs/*' > /tmp/code-diff.txt
What to Look For - Egregious Issues Only
Quick Checklist
- Code duplication - Same logic in 2+ places?
- Repeated patterns - Same code structure 3+ times?
- God functions - Functions over 100 lines?
- Weak types - Any, object, raw dict/list, missing annotations?
- Type-deficient patterns - hasattr, getattr instead of proper types?
- Meaningless tests - Tests that just verify assignment?
- Dead code - Unused functions, commented code?
What NOT to Flag
- Variable naming (unless truly confusing)
- Line length, comment style, whitespace, import order
These are auto-fixable or minor. Focus on structural problems.
LLM-Based Full Diff Review
Why use external LLM tools? Claude Code has a 25K context limit per tool call. For reviewing entire PR diffs (50K-200K+ tokens), use models with larger context windows.
Benefits:
- Cross-file pattern detection in one pass
- Different models catch different issues
- Faster than file-by-file review
Workflow
# 1. Extract changes (handles lock file exclusion automatically)
./scripts/extract-changes.sh # PR: current branch vs main
./scripts/extract-changes.sh abc123 # Specific commit
./scripts/extract-changes.sh auth/login # Path pattern (fuzzy match)
# 2. Run code review with large-context model
./scripts/llm-review.sh -m gpt-4o
./scripts/llm-review.sh -m claude-3-5-sonnet-latest
# 3. Run specialized reviews
./scripts/llm-review-tests.sh -m gpt-4o # Test quality
./scripts/llm-review-types.sh -m gpt-4o # Type hints
Setup
Requires Simon Willison's llm tool:
pip install llm
llm keys set openai # For GPT-4
pip install llm-claude-3 # For Claude
llm keys set claude
See references/llm-tooling.md for full setup and usage guide.
Using LLM Findings
LLM review provides hints, not final answers:
- Identify areas to investigate deeper
- Cross-check with different models
- Use Claude Code to implement actual fixes
Human-in-the-Loop After Code Review
CRITICAL: After completing a code review, ALWAYS:
- Present findings - Output the full review report
- List suggested actions - Number each potential fix
- Ask for approval - Use AskUserQuestion before executing
- Wait for explicit approval - User may reject or approve selectively
Example flow:
[Code review findings output]
## Suggested Actions
1. Add format-duration validator to Schema
2. Add tests for format-duration validation
Which items should I proceed with?
Reference Files
- references/what-to-flag.md - Duplication, weak types, god functions
- references/code-bloat-patterns.md - AI-generated bloat patterns
- references/llm-tooling.md - LLM tool setup and usage
Remember: The ENTIRE POINT of full diff review is cross-file patterns. Don't chunk unless you absolutely must!
Related Skills
- /pythonista-testing - Test code review
- /pythonista-typing - Type issues to flag
- /pythonista-patterning - Pattern discovery
- /pythonista-debugging - Root cause analysis
More from gigaverse-app/skillet
metaskill-authoring
Write Claude Code skills and SKILL.md files. Use when creating new skills, writing skill content, structuring SKILL.md, organizing skill directories, or when user mentions "write skill", "create skill", "author skill", "new skill", "skill structure", "SKILL.md", "skill content", "skill template".
9metaskill-triggering
Optimize skill triggers and descriptions for reliable activation. Use when skill is not triggering, optimizing trigger keywords, writing frontmatter, debugging activation, or when user mentions "trigger", "frontmatter", "description", "skill not triggering", "optimize trigger", "skill won't fire", "skill activation", "trigger keywords".
8metaskill-packaging
Package skills, agents, commands, and hooks as Claude Code plugins. Use when creating plugins, packaging skills for distribution, setting up plugin structure, dogfooding plugins, or when user mentions "plugin structure", "plugin.json", "package plugin", "distribute plugin", "marketplace", "dogfood", "install plugin", "plugin placement", "--plugin-dir".
8metaskill-naming
Brainstorm and validate names for plugins, skills, agents, and commands. Use when naming a new plugin, choosing atom names, validating naming conventions, or when user mentions "name plugin", "name skill", "naming convention", "brainstorm names", "what should I call", "plugin name", "good name for".
7metaskill-grouping
Create skill groups (multiple related skills packaged as a plugin). Use when creating plugins, organizing multiple related skills, building skill families, packaging tools together, or when user mentions "plugin", "multiple skills", "related skills", "skill group", "skill family", "organize skills", "cross-reference", "package skills", "shared agents". ALWAYS consider this pattern when someone asks to "create a skill" - they often need a skill GROUP packaged as a plugin.
7nicegui-development
Use when building UI with NiceGUI, creating components, fixing styling issues, or when user mentions "nicegui", "quasar", "tailwind", "ui.row", "ui.column", "gap spacing", "state management", "controller", "dialog", "modal", "ui component", "ui layout".
6