Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

go-code-review进行代码审查

Agent Skill

go-code-review 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

16,255

周安装

664

GitHub Stars

81

下载量

5,206
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:go-code-review(进行代码审查)
来源仓库:https://github.com/cxuu/golang-skills
仓库路径:skills/go-code-review
安装命令:
npx skills add https://github.com/cxuu/golang-skills --skill go-code-review
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cxuu/golang-skills --skill go-code-review

简介

根据社区风格标准和最佳实践进行系统的 Go 代码审查。

  • 涵盖 15 个以上审查类别:格式、文档、错误处理、命名、并发、接口、数据结构、安全性、声明、函数、样式、日志记录、导入、泛型和测试
  • 包括通过 gofmt 进行自动预审检查, 去看兽医
  • 和 golangci-lint
  • 在手动审核之前发现机械问题
  • 使用一致的模板按严重性(必须修复、应该修复、nit)组织发现结果,以实现清晰的沟通
  • 参考专业技能,深入探讨错误处理、命名约定、并发模式和测试策略

SKILL.md

Go Code Review Checklist

Review Procedure

Use assets/review-template.md when formatting the output of a code review to ensure consistent structure with Must Fix / Should Fix / Nits severity grouping.
  1. Run gofmt -d. and go vet./... to catch mechanical issues first
  2. Read the diff file-by-file; for each file, check the categories below in order
  3. Flag issues with specific line references and the rule name
  4. After reviewing all files, re-read flagged items to verify they're genuine issues
  5. Summarize findings grouped by severity (must-fix, should-fix, nit)
Validation: After completing the review, re-read the diff once more to verify every flagged issue is real. Remove any finding you cannot justify with a specific line reference.

Formatting

  • gofmt: Code is formatted with gofmt or goimportsgo-linting

Documentation

  • Comment sentences: Comments are full sentences starting with the name being described, ending with a period → go-documentation
  • Doc comments: All exported names have doc comments; non-trivial unexported declarations too → go-documentation
  • Package comments: Package comment appears adjacent to package clause with no blank line → go-documentation
  • Named result parameters: Only used when they clarify meaning (e.g., multiple same-type returns), not just to enable naked returns → go-documentation

Error Handling

  • Handle errors: No discarded errors with _; handle, return, or (exceptionally) panic → go-error-handling
  • Error strings: Lowercase, no punctuation (unless starting with proper noun/acronym) → go-error-handling
  • In-band errors: No magic values (-1, "", nil); use multiple returns with error or ok bool → go-error-handling
  • Indent error flow: Handle errors first and return; keep normal path at minimal indentation → go-error-handling

Naming

  • MixedCaps: Use MixedCaps or mixedCaps, never underscores; unexported is maxLength not MAX_LENGTHgo-naming
  • Initialisms: Keep consistent case: URL/url, ID/id, HTTP/http (e.g., ServeHTTP, xmlHTTPRequest) → go-naming
  • Variable names: Short names for limited scope (i, r, c); longer names for wider scope → go-naming
  • Receiver names: One or two letter abbreviation of type (c for Client); no this, self, me; consistent across methods → go-naming
  • Package names: No stuttering (use chubby.File not chubby.ChubbyFile); avoid util, common, miscgo-packages
  • Avoid built-in names: Don't shadow error, string, len, cap, append, copy, new, makego-declarations

Concurrency

  • Goroutine lifetimes: Clear when/whether goroutines exit; document if not obvious → go-concurrency
  • Synchronous functions: Prefer sync over async; let callers add concurrency if needed → go-concurrency
  • Contexts: First parameter; not in structs; no custom Context types; pass even if you think you don't need to → go-context

Interfaces

  • Interface location: Define in consumer package, not implementor; return concrete types from producers → go-interfaces
  • No premature interfaces: Don't define before used; don't define "for mocking" on implementor side → go-interfaces
  • Receiver type: Use pointer if mutating, has sync fields, or is large; value for small immutable types; don't mix → go-interfaces

Data Structures

  • Empty slices: Prefer var t []string (nil) over t:= []string{} (non-nil zero-length) → go-data-structures
  • Copying: Be careful copying structs with pointer/slice fields; don't copy *T methods' receivers by value → go-data-structures

Security

  • Crypto rand: Use crypto/rand for keys, not math/randgo-defensive
  • Don't panic: Use error returns for normal error handling; panic only for truly exceptional cases → go-defensive

Declarations and Initialization

  • Group similar: Related var/const/type in parenthesized blocks; separate unrelated → go-declarations
  • var vs:=: Use var for intentional zero values; := for explicit assignments → go-declarations
  • Reduce scope: Move declarations close to usage; use if-init to limit variable scope → go-declarations
  • Struct init: Always use field names; omit zero fields; var for zero structs → go-declarations
  • Use any: Prefer any over interface{} in new code → go-declarations

Functions

  • File ordering: Types → constructors → exported methods → unexported → utilities → go-functions
  • Signature formatting: All args on own lines with trailing comma when wrapping → go-functions
  • Naked parameters: Add /* name */ comments for ambiguous bool/int args, or use custom types → go-functions
  • Printf naming: Functions accepting format strings end in f for go vetgo-functions

Style

  • Line length: No rigid limit, but avoid uncomfortably long lines; break by semantics, not arbitrary length → go-style-core
  • Naked returns: Only in short functions; explicit returns in medium/large functions → go-style-core
  • Pass values: Don't use pointers just to save bytes; pass string not *string for small fixed-size types → go-performance
  • String concatenation: + for simple; fmt.Sprintf for formatting; strings.Builder for loops → go-performance

Logging

  • Use slog: New code uses log/slog, not log or fmt.Println for operational logging → go-logging
  • Structured fields: Log messages use static strings with key-value attributes, not fmt.Sprintf → go-logging
  • Appropriate levels: Debug for developer tracing, Info for notable events, Warn for recoverable issues, Error for failures → go-logging
  • No secrets in logs: PII, credentials, and tokens are never logged → go-logging

Imports

  • Import groups: Standard library first, then blank line, then external packages → go-packages
  • Import renaming: Avoid unless collision; rename local/project-specific import on collision → go-packages
  • Import blank: import _ "pkg" only in main package or tests → go-packages
  • Import dot: Only for circular dependency workarounds in tests → go-packages

Generics

  • When to use: Only when multiple types share identical logic and interfaces don't suffice → go-generics
  • Type aliases: Use definitions for new types; aliases only for package migration → go-generics

Testing

  • Examples: Include runnable Example functions or tests demonstrating usage → go-documentation
  • Useful test failures: Messages include what was wrong, inputs, got, and want; order is got!= wantgo-testing
  • TestMain: Use only when all tests need common setup with teardown; prefer scoped helpers first → go-testing
  • Real transports: Prefer httptest.NewServer + real client over mocking HTTP → go-testing

Automated Checks

Run automated pre-review checks:

bash scripts/pre-review.sh ./...         # text output
bash scripts/pre-review.sh --json ./...  # structured JSON output

Or manually: gofmt -l <path> && go vet./... && golangci-lint run./...

Fix any issues before proceeding to the checklist above. For linter setup and configuration, see go-linting.


Integrative Example

Read references/WEB-SERVER.md when building a production HTTP server and want to verify your code applies concurrency, error handling, context, documentation, and naming conventions together.

Related Skills

  • Style foundations: See go-style-core when resolving formatting debates or applying the clarity > simplicity > concision priority
  • Linting setup: See go-linting when configuring golangci-lint or adding automated checks to CI
  • Error strategy: See go-error-handling when reviewing error wrapping, sentinel errors, or the handle-once pattern
  • Naming conventions: See go-naming when evaluating identifier names, receiver names, or package-symbol stuttering
  • Testing patterns: See go-testing when reviewing test code for table-driven structure, failure messages, or helper usage
  • Concurrency safety: See go-concurrency when reviewing goroutine lifetimes, channel usage, or mutex placement
  • Logging practices: See go-logging when reviewing log usage, structured logging, or slog configuration

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.89%
按下载量换算1,920

Claude

29.91%
按下载量换算1,557

Cursor

18.53%
按下载量换算965

Gemini CLI

9.84%
按下载量换算512

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills