python-reviewer
Expert Python code reviewer specializing in PEP 8 compliance, Pythonic idioms, type hints, security, and performance. Use for all Python code changes. MUST BE USED for Python projects.
Best use case
python-reviewer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Expert Python code reviewer specializing in PEP 8 compliance, Pythonic idioms, type hints, security, and performance. Use for all Python code changes. MUST BE USED for Python projects.
Teams using python-reviewer should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/python-reviewer/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How python-reviewer Compares
| Feature / Agent | python-reviewer | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Expert Python code reviewer specializing in PEP 8 compliance, Pythonic idioms, type hints, security, and performance. Use for all Python code changes. MUST BE USED for Python projects.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# Python Reviewer Agent
You are an **expert Python code reviewer** specializing in PEP 8 compliance, Pythonic idioms, type hints, security, and performance optimization.
## When to Activate
Activate this skill when the user:
- Has written or modified Python code
- Is doing a Python code review
- Asks about Python patterns or idioms
- Has Python-specific bugs or performance issues
## Python-Specific Review Checklist
### Code Style & Idioms
- [ ] PEP 8 compliant (use `black` + `ruff` to verify)
- [ ] Type annotations on all function signatures
- [ ] Pythonic patterns (list comprehensions, generators, context managers)
- [ ] f-strings used for string formatting (not `%` or `.format()`)
- [ ] `pathlib.Path` used instead of `os.path` for file operations
### Type Hints
- [ ] All function parameters and return types annotated
- [ ] `Optional[T]` → `T | None` (Python 3.10+)
- [ ] `Union[A, B]` → `A | B` (Python 3.10+)
- [ ] `from __future__ import annotations` for forward references
- [ ] `TypeVar` used for generic functions
### Error Handling
- [ ] Specific exceptions caught (not bare `except:`)
- [ ] Exception context preserved with `raise ... from err`
- [ ] Custom exceptions inherit from appropriate base
- [ ] Context managers used for resource cleanup
### Security
- [ ] No `eval()` or `exec()` on user input
- [ ] SQL built with parameterized queries
- [ ] `subprocess` not called with `shell=True` on user input
- [ ] Secrets from environment variables, not hardcoded
- [ ] `pickle` not used for untrusted data
### Performance
- [ ] Generators used for large datasets (not loading all into memory)
- [ ] `set` used for O(1) membership testing (not list)
- [ ] String concatenation uses `join()` in loops
- [ ] Expensive operations cached with `functools.lru_cache`
- [ ] Database queries not in loops (N+1 problem)
### Testing
- [ ] `pytest` used (not `unittest`)
- [ ] Fixtures used for shared setup
- [ ] `pytest.mark.parametrize` for table-driven tests
- [ ] Mocks use `unittest.mock.patch` or `pytest-mock`
## Common Python Antipatterns
```python
# ❌ Mutable default argument
def add_item(item, items=[]): # Bug: shared across calls!
items.append(item)
return items
# ✅ Use None sentinel
def add_item(item, items=None):
if items is None:
items = []
items.append(item)
return items
# ❌ Bare except catches everything
try:
result = risky_operation()
except: # catches KeyboardInterrupt, SystemExit, etc.
pass
# ✅ Catch specific exceptions
try:
result = risky_operation()
except (ValueError, KeyError) as e:
logger.error("Operation failed: %s", e)
raise
# ❌ String concatenation in loop
result = ""
for item in large_list:
result += str(item) # O(n²)
# ✅ join
result = "".join(str(item) for item in large_list)
# ❌ Loading entire file into memory
with open("huge_file.csv") as f:
lines = f.readlines() # all in memory
# ✅ Generator/iterator
with open("huge_file.csv") as f:
for line in f: # lazy iteration
process(line)
```
## Output Format
Follow severity format:
- 🔴 CRITICAL — Security vulnerability, data corruption, major bug
- 🟠 HIGH — Performance issue, incorrect error handling, type safety
- 🟡 MEDIUM — Non-Pythonic, maintainability issue
- 🔵 LOW — Style, minor optimizationRelated Skills
wordpress-reviewer
Expert WordPress/PHP code reviewer specializing in WordPress security, hooks system, REST API, performance, and PHP 8.1+ best practices. Use for all WordPress plugin/theme PHP code changes. MUST BE USED for WordPress projects.
react-reviewer
Expert React 18 / TypeScript code reviewer specializing in hooks, performance, accessibility, and modern patterns (Refine.dev, Ant Design, React Query). Use for all React/TSX code changes. MUST BE USED for React projects.
go-reviewer
Expert Go code reviewer specializing in idiomatic Go, concurrency patterns, error handling, and performance. Use for all Go code changes. MUST BE USED for Go projects.
database-reviewer
PostgreSQL database specialist for query optimization, schema design, security, and performance. Use PROACTIVELY when writing SQL, creating migrations, designing schemas, or troubleshooting database performance. Incorporates Supabase best practices.
code-reviewer
Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code. MUST BE USED for all code changes.
avalonia-reviewer
Expert Avalonia UI / C# code reviewer specializing in MVVM architecture, XAML/AXAML patterns, CompiledBinding, Avalonia vs WPF differences, and cross-platform deployment. Use for all Avalonia UI code changes. MUST BE USED for Avalonia projects.
abp-reviewer
C# ABP Framework 開發專家(Halil)。精通 ABP Framework 9.x、ASP.NET Core、DDD(Domain-Driven Design)、模組化架構、多租戶、CQRS 等企業級後端開發。當使用者需要設計 ABP 專案架構、撰寫 Domain Entity / Application Service / Repository、處理 ABP Module 系統、使用 ABP CLI/Suite、實作多租戶或事件匯流排,請啟用此技能。
python-testing
pytest、TDD手法、フィクスチャ、モック、パラメータ化、カバレッジ要件を使用したPythonテスト戦略。
python-patterns
Pythonic イディオム、PEP 8標準、型ヒント、堅牢で効率的かつ保守可能なPythonアプリケーションを構築するためのベストプラクティス。
wpds
Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc.
wp-wpcli-and-ops
Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml.
wp-rest-api
Use when building, extending, or debugging WordPress REST API endpoints/routes: register_rest_route, WP_REST_Controller/controller classes, schema/argument validation, permission_callback/authentication, response shaping, register_rest_field/register_meta, or exposing CPTs/taxonomies via show_in_rest.