python-expert-best-practices-code-review by wispbit-ai/skills
npx skills add https://github.com/wispbit-ai/skills --skill python-expert-best-practices-code-review简洁、实用、有主见。只关注编写生产级 Python 代码所需的核心要点。
在以下情况下参考本指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 错误处理 | 关键 | dict-、operators- |
| 2 | 常见错误 | 关键-高 | no-mutable-、no-generic- |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 3 | 代码清晰度 | 高-中 | listcomp-、no-inline- |
| 4 | 代码风格 | 低 | avoid-、unnecessary- |
dict-required-keys - 对必需的字典键使用 d[key],以便通过 KeyError 快速失败no-mutable-defaults - 函数/方法参数中不要使用可变默认值operators-return-notimplemented - 对于不支持的操作数类型返回 NotImplemented,并有意设计 + 与 += 的行为no-generic-except - 避免使用通用的 except 子句,以防止隐藏意外错误listcomp-no-side-effects - 列表推导式必须产生一个你使用的值(避免产生副作用的列表推导式)no-inline-imports - 将所有 import 语句放在文件顶部avoid-explanatory-comments - 避免为自解释的代码添加不必要的注释unnecessary-else-blocks - 在 return/break/continue 语句后避免不必要的 else 块阅读各个规则文件以获取详细解释和代码示例:
rules/dict-required-keys.md
rules/no-mutable-defaults.md
rules/operators-return-notimplemented.md
rules/no-generic-except.md
rules/listcomp-no-side-effects.md
rules/no-inline-imports.md
rules/avoid-explanatory-comments.md
rules/unnecessary-else-blocks.md
每个规则文件包含:
每周安装量
229
代码仓库
GitHub 星标数
5
首次出现
2026年2月10日
安全审计
安装于
cursor215
opencode181
gemini-cli173
github-copilot169
codex168
amp158
Simple, pragmatic, opinionated. Only what matters for writing production-grade python code.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Error Handling | CRITICAL | dict-, operators- |
| 2 | Common Bugs | CRITICAL-HIGH | no-mutable-, no-generic- |
| 3 | Code Clarity | HIGH-MEDIUM | listcomp-, no-inline- |
| 4 | Code Style | LOW | avoid-, unnecessary- |
dict-required-keys - Use d[key] for required dictionary keys to fail fast with KeyErrorno-mutable-defaults - No mutable defaults in function/method parametersoperators-return-notimplemented - Return NotImplemented for unsupported operand types and design + vs += intentionallyno-generic-except - Avoid generic except clauses to prevent hiding unexpected errorslistcomp-no-side-effects - List comprehensions must produce a value you use (no side-effect listcomps)no-inline-imports - Place all import statements at the top of the fileavoid-explanatory-comments - Avoid unnecessary comments for self-documenting codeunnecessary-else-blocks - Avoid unnecessary else blocks after return/break/continue statementsRead individual rule files for detailed explanations and code examples:
rules/dict-required-keys.md
rules/no-mutable-defaults.md
rules/operators-return-notimplemented.md
rules/no-generic-except.md
rules/listcomp-no-side-effects.md
rules/no-inline-imports.md
rules/avoid-explanatory-comments.md
rules/unnecessary-else-blocks.md
Each rule file contains:
Weekly Installs
229
Repository
GitHub Stars
5
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor215
opencode181
gemini-cli173
github-copilot169
codex168
amp158
PPTX 文件处理全攻略:Python 脚本创建、编辑、分析 .pptx 文件内容与结构
805 周安装