playbook/.agents/code_quality.md

33 lines
978 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 代码质量Code Quality
本文件定义代理对代码质量的最低要求与审查清单。
## 1. 总体要求
- 遵守本标准快照中的 `docs/tsl/code_style.md``docs/tsl/naming.md`(通常位于目标项目的 `docs/standards/tsl/docs/tsl/`)。
- 改动聚焦目标;避免“顺手重构”。
- API 变更要显式说明影响与迁移方式。
## 2. 可读性
- 复杂逻辑拆分为具名函数/变量。
- 避免深层嵌套与重复代码。
- 必要注释解释“为什么”而不是“做什么”。
## 3. 错误处理
- 错误必须显式处理;禁止静默吞错。
- 失败路径要可观测(返回/抛出/日志)。
## 4. 复杂度与规模
- 单函数尽量 ≤ 60 行;超过应说明原因或拆分。
- 单次 PR 尽量小步提交,便于 review。
## 5. Review 清单
- 是否有无关改动?
- 是否有清晰的动机与行为说明?
- 是否保持模块内风格一致?
- 是否需要补测试/示例?