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.
npx agentmods add commands/codelably/harmony-claude-code/python-reviewgit clone --depth 1 https://github.com/codelably/harmony-claude-codeWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00039 | $0.02095 |
| Opus 5 | $0.00019 | $0.01047 |
| Sonnet 5 | $0.00008 | $0.00419 |
| Haiku 4.5 | $0.00004 | $0.00210 |
Grade A, and why
python-review 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 298 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Python 代码审查 (Python Code Review)
此命令调用 python-reviewer 智能体(Agent),进行全面的 Python 专项代码审查。
此命令的作用
- 识别 Python 变更:通过
git diff查找修改过的.py文件 - 运行静态分析:执行
ruff、mypy、pylint、black --check - 安全扫描:检查 SQL 注入、命令注入、不安全的反序列化
- 类型安全审查:分析类型提示(Type Hints)和 mypy 错误
- Pythonic 代码检查:验证代码是否符合 PEP 8 和 Python 最佳实践
- 生成报告:按严重程度(Severity)对问题进行分类
适用场景
在以下情况下使用 /python-review:
- 编写或修改 Python 代码后
- 提交 Python 变更前
- 审查包含 Python 代码的拉取请求(Pull Requests)
- 接入新的 Python 代码库时
- 学习 Pythonic 模式和惯用法时
审查类别
严重 (CRITICAL) (必须修复)
- SQL/命令注入漏洞
- 不安全的 eval/exec 使用
- Pickle 不安全的反序列化
- 硬编码凭据
- YAML 不安全的加载 (unsafe load)
- 隐藏错误的裸 except 子句
高 (HIGH) (应该修复)
- 公共函数缺失类型提示
- 可变默认参数 (Mutable default arguments)
- 静默吞掉异常
- 未对资源使用上下文管理器 (Context Managers)
- 使用 C 风格循环而非推导式 (Comprehensions)
- 使用 type() 而非 isinstance()
- 无锁状态下的竞态条件
中 (MEDIUM) (建议考虑)
- 违反 PEP 8 格式规范
- 公共函数缺失文档字符串 (Docstrings)
- 使用 print 语句而非日志 (Logging)
- 低效的字符串操作
- 无命名常量的魔术数字 (Magic numbers)
- 未使用 f-strings 进行格式化
- 不必要的列表创建
运行的自动化检查
# 类型检查
mypy .
# 代码检查与格式化
ruff check .
black --check .
isort --check-only .
# 安全扫描
bandit -r .
# 依赖审计
pip-audit
safety check
# 测试
pytest --cov=app --cov-report=term-missing
示例用法
User: /python-review
Agent:
# Python 代码审查报告
## 已审查文件
- app/routes/user.py (已修改)
- app/services/auth.py (已修改)
## 静态分析结果
✓ ruff: 无问题
✓ mypy: 无错误
⚠️ black: 2 个文件需要重新格式化
✓ bandit: 无安全问题
## 发现的问题
[CRITICAL] SQL 注入漏洞
文件: app/routes/user.py:42
问题: 用户输入直接插入到 SQL 查询中
```python
query = f"SELECT * FROM users WHERE id = {user_id}" # 不良做法
修复: 使用参数化查询
query = "SELECT * FROM users WHERE id = %s" # 推荐做法
cursor.execute(query, (user_id,))
[HIGH] 可变默认参数 文件: app/services/auth.py:18 问题: 可变默认参数会导致状态共享
def process_items(items=[]): # 不良做法
items.append("new")
return items
修复: 使用 None 作为默认值
def process_items(items=None): # 推荐做法
if items is None:
items = []
items.append("new")
return items
[MEDIUM] 缺失类型提示 文件: app/services/auth.py:25 问题: 公共函数没有类型注解
def get_user(user_id): # 不良做法
return db.find(user_id)
修复: 添加类型提示
def get_user(user_id: str) -> Optional[User]: # 推荐做法
return db.find(user_id)
[MEDIUM] 未使用上下文管理器 文件: app/routes/user.py:55 问题: 异常发生时文件未关闭
f = open("config.json") # 不良做法
data = f.read()
f.close()
修复: 使用上下文管理器
with open("config.json") as f: # 推荐做法
data = f.read()
摘要
- 严重 (CRITICAL): 1
- 高 (HIGH): 1
- 中 (MEDIUM): 2
建议: ❌ 在修复严重问题前阻止合并
需要格式化
运行: black app/routes/user.py app/services/auth.py
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.
- yesterday First seen · 298 lines · 39 tokens per session scan A b84389e26fee
python-review is a command published in the GitHub repository codelably/harmony-claude-code (42 stars, last pushed 6mo ago), licensed MIT. It adds 39 tokens to every session and 2,095 once invoked, about $0.0002 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.
Other commands, from other repositories
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.
implement
Execute the implementation plan by processing and executing all tasks defined in tasks.md.