cxuu avatar

Go Documentation

Structured guide for writing Go doc comments, with a validation script for exported symbols and package comments.

skills.sh installs
1.3K
GitHub stars
196
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers doc comment basics, comment sentence rules, line length, struct field grouping, and package comments, with an advisory table on what to document
  • Includes scripts/check-docs.sh, which runs an AST helper to flag exported symbols missing doc comments, plus templates and references for examples and formatting
  • Enforces one package comment per package and requires doc comments on every top-level exported name
  • Designed for Go developers writing or reviewing exported APIs, and for agents creating new exported types, functions, or packages

Install

$ npx -y skills add cxuu/golang-skills --skill go-documentation -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Go Documentation

Resource Routing

  • scripts/check-docs.sh - Run when checking exported functions, types, methods, constants, and packages for missing doc comments.
  • scripts/check-docs-ast.go - Implementation helper invoked by check-docs.sh; patch this when changing documentation analysis behavior.
  • assets/doc-template.go - Use when starting a documented package or exported API.
  • references/CONVENTIONS.md - Read when documenting parameters, context behavior, concurrency safety, cleanup, errors, or named results.
  • references/EXAMPLES.md - Read when adding runnable examples or package examples.
  • references/FORMATTING.md - Read when formatting Godoc lists, paragraphs, links, and code blocks.

Doc Comments

Normative: All top-level exported names must have doc comments.

Basic Rules

  1. Begin with the name of the object being described
  2. An article ("a", "an", "the") may precede the name
  3. Use full sentences (capitalized, punctuated)
// A Request represents a request to run a command.
type Request struct { ...

// Encode writes the JSON encoding of req to w.
func Encode(w io.Writer, req *Request) { ...

Details

Repository
github.com/cxuu/golang-skills
Categories
Go, Technical Documentation
First seen
May 16, 2026

More from cxuu/golang-skills

All 20

Similar to Go Documentation

More Go