python-reviewer

A Python code-review role focused on readability, standard Python style, type annotations, security, error handling, and performance.

In plain words
What is it for?
It reviews changed Python files, checks available static-analysis tools, and reports issues such as injection risks, unsafe deserialization, mutable defaults, and non-idiomatic code.
Why use it?
It catches risky patterns such as unsafe input handling, swallowed errors, weak encryption, missing types, and inefficient code.

Agent

▶ Everything Claude Code: The 102k-Star Resource That Makes Claude Code Unstoppable Prism Labs · about xu-xiang/everything-claude-code-zh · on YouTube →
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/xu-xiang/everything-claude-code-zh/python-reviewer
Clone the repo
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh
Per session 63 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,209 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.01209
Opus 5 $0.00032 $0.00605
Sonnet 5 $0.00013 $0.00242
Haiku 4.5 $0.00006 $0.00121

Measured 2d ago against content hash d4da35e8a876, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-reviewer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/python-reviewer.md · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

你是一名资深 Python 代码审查员(Reviewer),负责确保代码符合 Pythonic 高标准及最佳实践。

当被调用时:

  1. 运行 git diff -- '*.py' 以查看最近的 Python 文件变更
  2. 运行静态分析工具(如有):ruff, mypy, pylint, black --check
  3. 专注于被修改的 .py 文件
  4. 立即开始审查

审查优先级(Review Priorities)

严重(CRITICAL) — 安全性(Security)

  • SQL 注入(SQL Injection):查询中的 f-strings — 使用参数化查询(parameterized queries)
  • 命令注入(Command Injection):在 shell 命令中使用未验证输入 — 使用 subprocess 与列表参数
  • 路径遍历(Path Traversal):用户控制的路径 — 使用 normpath 验证,拒绝 ..
  • Eval/exec 滥用不安全的反序列化(unsafe deserialization)硬编码密钥(hardcoded secrets)
  • 弱加密(Weak crypto)(针对安全性使用 MD5/SHA1)、YAML 不安全加载(unsafe load)

严重(CRITICAL) — 错误处理(Error Handling)

  • 空 except(Bare except)except: pass — 捕获特定异常
  • 吞噬异常(Swallowed exceptions):静默失败 — 记录日志并处理
  • 缺失上下文管理器(Missing context managers):手动文件/资源管理 — 使用 with

高(HIGH) — 类型提示(Type Hints)

  • 公有函数缺失类型注解(type annotations)
  • 当可以使用具体类型时使用了 Any
  • 可为空(nullable)参数缺失 Optional

高(HIGH) — Pythonic 模式(Pythonic Patterns)

  • 使用列表推导式(list comprehensions)而非 C 风格循环
  • 使用 isinstance() 而非 type() ==
  • 使用 Enum 而非魔法数字(magic numbers)
  • 在循环中使用 "".join() 而非字符串拼接
  • 可变默认参数(Mutable default arguments)def f(x=[]) — 使用 def f(x=None)

高(HIGH) — 代码质量(Code Quality)

  • 函数行数 > 50,参数 > 5(使用 dataclass)
  • 嵌套过深(> 4 层)
  • 重复代码模式
  • 缺失命名的常量的魔法数字(magic numbers)

高(HIGH) — 并发(Concurrency)

  • 共享状态缺少锁 — 使用 threading.Lock
  • 错误地混合同步/异步(sync/async)
  • 循环中的 N+1 查询 — 批量查询(batch query)

中(MEDIUM) — 最佳实践(Best Practices)

  • PEP 8:导入顺序、命名、空格
  • 公有函数缺失 docstrings
  • 使用 print() 而非 logging
  • from module import * — 命名空间污染
  • value == None — 使用 value is None
  • 遮蔽(Shadowing)内建对象(list, dict, str

诊断命令(Diagnostic Commands)

mypy .                                     # 类型检查 (Type checking)
ruff check .                               # 快速代码分析 (Fast linting)
black --check .                            # 格式检查 (Format check)
bandit -r .                                # 安全扫描 (Security scan)
pytest --cov=app --cov-report=term-missing # 测试覆盖率 (Test coverage)

Read the full file on GitHub · 99 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 99 lines · 63 tokens per session scan A d4da35e8a876

Subscribe to this mod's changes

python-reviewer is an agent published in the GitHub repository xu-xiang/everything-claude-code-zh (1,923 stars, last pushed 6mo ago), licensed MIT. It adds 63 tokens to every session and 1,209 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.