golang-code-review

基于《Golang 工匠》的 Go 代码综合审查器,涵盖命名、结构体、函数、接口设计和错误处理五大方面。Use when reviewing Go code to ensure it follows best practices and idiomatic patterns.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "golang-code-review" with this command: npx skills add caijiatao/skills/caijiatao-skills-golang-code-review

Golang Code Reviewer

基于《Golang 工匠》的 Go 代码综合审查器,涵盖命名、结构体、函数、接口设计和错误处理五大方面。

触发时机

当用户请求以下任务时触发:

  • "审查代码" / "review code"
  • "检查 Go 代码" / "check go code"
  • 编写、审查或重构 Go 代码时

审查领域

领域描述参考
命名规范包名、变量名、函数名、常量名、接口名检查review-naming
结构体设计字段顺序、嵌入使用、构造函数、自定义类型review-structs
函数设计职责单一性、参数设计、返回值设计review-functions
接口设计接口大小、定义位置、组合、空接口使用review-interfaces
错误处理错误创建、包装、判断、信息设计review-errors

审查流程

  1. 检查命名规范(包名、变量名、函数名、常量名、接口名)
  2. 检查结构体设计(字段顺序、嵌入使用、构造函数)
  3. 检查函数设计(职责单一性、参数、返回值)
  4. 检查接口设计(接口大小、定义位置、组合)
  5. 检查错误处理(错误创建、判断、信息设计)
  6. 提供具体的改进建议

输出格式

直接使用 Edit 工具修改代码,将不规范的代码改为符合 Go 最佳实践的代码。

  • 不符合规范的命名 → 直接改为正确命名
  • 结构体字段顺序混乱 → 直接调整字段顺序
  • 函数参数过多 → 直接改为使用结构体
  • 函数职责过多 → 直接拆分为多个函数
  • 接口过大 → 直接拆分为小接口
  • 错误处理不当 → 直接改为正确的错误处理

核心原则

  1. 发现问题直接改为正确版本
  2. 一次审查完成所有相关修改
  3. 修改后代码应该直接可以运行
  4. 保持建设性,专注于改进建议

资源来源

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

code-review

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

code-review

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

code-review

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

code-review

No summary provided by upstream source.

Repository SourceNeeds Review
golang-code-review | V50.AI