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.

9 stars

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

$curl -o ~/.claude/skills/python-reviewer/SKILL.md --create-dirs "https://raw.githubusercontent.com/j7-dev/everything-github-copilot/main/skills/python-reviewer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/python-reviewer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How python-reviewer Compares

Feature / Agentpython-reviewerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/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

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 optimization

Related Skills

wordpress-reviewer

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

pytest、TDD手法、フィクスチャ、モック、パラメータ化、カバレッジ要件を使用したPythonテスト戦略。

python-patterns

9
from j7-dev/everything-github-copilot

Pythonic イディオム、PEP 8標準、型ヒント、堅牢で効率的かつ保守可能なPythonアプリケーションを構築するためのベストプラクティス。

wpds

9
from j7-dev/everything-github-copilot

Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc.

wp-wpcli-and-ops

9
from j7-dev/everything-github-copilot

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

9
from j7-dev/everything-github-copilot

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.