Claude Code coding-standard-python 技能:统一 Python 文件和变量命名
EnglishClaude Code 安装步骤
- 打开 GitHub 固定提交的 `.claude/skills/coding-standard-python/SKILL.md`,核对内容与使用条件。
- 在自己的项目中创建 `.claude/skills/coding-standard-python/`,把核对后的文件保存为 `.claude/skills/coding-standard-python/SKILL.md`。
- 在该项目根目录启动 Claude Code,在斜杠菜单中选择 `/coding-standard-python`。
中文摘要
按仓库的 Python 命名与导入约定检查源文件、类、变量、常量和测试文件。
SKILL.md 中文导读
可复现示例
调用 /coding-standard-python。整理下面虚构的标签读取模块命名,并列出引用调整。
file `LabelReader.py` | class `label_reader` | local boolean `haslabel`
other code imports the class | check public imports and align test file names工作步骤
- 区分模块、类、变量和测试。
- 逐项对照项目命名约定。
- 检查跨文件引用和导入排序。
验收方法
建议 `label_reader.py`、`LabelReader` 和 `has_label`。同步检查旧导入,并以 `test_label_reader.py` 命名对应测试。
GitHub 原文 · 更新日期
适用环境
已打开 Python 项目的 Claude Code 工作区。示例只检查项目命名和导入组织。
常见问题
布尔变量的名称怎样写得易读?
根据含义选 is、has、can 或 should 前缀,采用蛇形命名,并在引用一起核对。