Index of every page on this site: llms.txt
All skills
qiao-925 avatar

/python-coding-standards

@50a1ee4
Run it yourself

Python 实现基线能力单元,帮助 Agent 在 Python 代码实现、修改、补全、重构与审查场景中,先对齐项目既有约定,再落实类型边界、日志纪律、命名与结构可读性,避免把个人偏好或项目私货写成通用规范。关键词:Python、编码规范、类型提示、日志、命名、代码结构、项目对齐。

Use this Skill: https://skilld.dev/gh/qiao-925/qiao-skills/python-coding-standards

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestype-discipline.md

≈356 tokens on demand. Your agent reads this file only when SKILL.md points to it.

类型边界:优先标清公共接口

核心目标

类型提示的价值在于减少边界歧义,而不是追求“注解覆盖率”。

优先级

第一优先级

  • 公共函数与公共方法
  • 跨模块调用边界
  • 返回值不显然的函数
  • 容易混淆的数据结构

第二优先级

  • 关键类属性
  • 复杂回调与高阶函数
  • 容易误用的可空值与联合类型

低优先级

  • 含义非常直接的短生命周期局部变量
  • 仅为“看起来完整”而添加的重复注解

默认基线

  • 有返回值就写清返回类型。
  • 无返回值显式写 -> None。
  • 新增或修改公共边界时,优先补齐类型提示。
  • 复杂公共 API 在行为不显然时,补必要 docstring。

风格建议

  • 尊重项目当前 Python 版本和 typing 风格。
  • 如果项目已普遍使用 list[str] 这类现代写法,沿用它。
  • 如果项目仍使用 List[str]、Optional[str] 等传统写法,先保持一致,不要局部切风格。

反模式

  • 为了“规范”给每个局部变量都加注解。
  • 不看项目 Python 版本,直接引入不兼容的类型语法。
  • 只补参数类型,不补返回值,让边界仍然模糊。

检查清单

  • 公共边界与跨模块接口类型是否清楚。
  • 类型写法是否与项目现有风格一致。
  • docstring 是否只补在真正需要解释的地方。

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7mo4 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    This skill provides a comprehensive set of Python coding standards and guidelines for an AI agent, focusing on type hints, logging, naming conventions, and code structure. No security risks were detected.

  • Socket7mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

  • Runlayer8mo

    5 files scanned · No issues

Signed by skilld at 50a1ee4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
Other metadata
metadata
{
  "type": "declarative",
  "category": "language-engineering",
  "scope": "python",
  "role": "skill-unit"
}

README badge

README badge for qiao-925/qiao-skills/python-coding-standards