Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
cxuu avatar

Go Documentation

  • 949 installs
  • 137 repo stars
  • Updated June 20, 2026
  • cxuu/golang-skills

go-documentation is a Claude Code skill that generates idiomatic Go doc comments following Google conventions and godoc-compatible output for developers who need professional package documentation.

About

go-documentation is a Claude Code skill from cxuu/golang-skills that teaches agents to write Go documentation matching Google Go Style Guide conventions. The skill covers package-level doc comments, exported types, functions, methods, constants, and error variables with godoc-compatible formatting including cross-references like [NewWidget]. Developers reach for go-documentation when adding or reviewing doc comments in Go modules, libraries, or internal packages. Output renders correctly in pkg.go.dev and local godoc viewers.

  • Teaches package, type, function, method and constant documentation conventions
  • Demonstrates correct use of comment markers, headings and cross-references
  • Shows how to document errors, constants, zero-value behavior and concurrency guarantees
  • Includes deprecation handling and functional-options guidance
  • Produces documentation consumable by godoc, pkg.go.dev and IDE hover tools

Go Documentation by the numbers

  • 949 all-time installs (skills.sh)
  • +40 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #274 of 1,879 Documentation skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cxuu/golang-skills --skill go-documentation

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs949
repo stars137
Security audit3 / 3 scanners passed
Last updatedJune 20, 2026
Repositorycxuu/golang-skills

How do you write idiomatic Go godoc comments?

Generate idiomatic Go documentation that follows Google conventions and produces godoc-compatible output.

Who is it for?

Go developers documenting packages, libraries, or internal modules who want Google-style godoc output without manual style guide lookups.

Skip if: Non-Go projects or teams that only need README files without inline godoc comments on exported symbols.

When should I use this skill?

The developer asks to document Go packages, functions, types, or review existing godoc comments for style compliance.

What you get

Godoc-compatible package docs, function comments, and exported symbol documentation.

  • Package doc comments
  • Function and type documentation
  • Godoc-ready source comments

Files

SKILL.mdMarkdownGitHub ↗

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) { ...

Unexported types/functions with unobvious behavior should also have doc comments.

Validation: After adding doc comments, run bash scripts/check-docs.sh to verify no exported symbols are missing documentation. Fix any gaps before proceeding.

---

Comment Sentences

Normative: Documentation comments must be complete sentences.
  • Capitalize the first word, end with punctuation
  • Exception: may begin with uncapitalized identifier if clear
  • End-of-line comments for struct fields can be phrases

---

Comment Line Length

Advisory: Aim for ~80 columns, but no hard limit.

Break based on punctuation. Don't split long URLs.

---

Struct Documentation

Group fields with section comments. Mark optional fields with defaults:

type Options struct {
    // General setup:
    Name  string
    Group *FooGroup

    // Customization:
    LargeGroupThreshold int // optional; default: 10
}

---

Package Comments

Normative: Every package must have exactly one package comment.
// Package math provides basic constants and mathematical functions.
package math
  • For main packages, use the binary name: // The seed_generator command ...
  • For long package comments, use a doc.go file

---

What to Document

Advisory: Document non-obvious behavior, not obvious behavior.
TopicDocument when...Skip when...
ParametersNon-obvious behavior, edge casesRestates the type signature
ContextsBehavior differs from standard cancellationStandard ctx.Err() return
ConcurrencyAmbiguous thread safety (e.g., read that mutates)Read-only is safe, mutation is unsafe
CleanupAlways document resource release
ErrorsSentinel values, error types (use *PathError)
Named resultsMultiple params of same type, action-oriented namesType alone is clear enough

Key principles:

  • Context cancellation returning ctx.Err() is implied — don't restate it
  • Read-only ops are assumed thread-safe; mutations assumed unsafe — don't restate
  • Always document cleanup requirements (e.g., Call Stop to release resources)
  • Use pointer in error type docs (*PathError) for correct errors.Is/errors.As
  • Don't name results just to enable naked returns — clarity > brevity

---

Runnable Examples

Advisory: Provide runnable examples in test files (*_test.go).
func ExampleConfig_WriteTo() {
    cfg := &Config{Name: "example"}
    cfg.WriteTo(os.Stdout)
    // Output:
    // {"name": "example"}
}

Examples appear in Godoc attached to the documented element.

---

Quick Reference

TopicKey Rule
Doc commentsStart with name, use full sentences
Line length~80 chars, prioritize readability
Package commentsOne per package, above package clause
ParametersDocument non-obvious behavior only
ContextsDocument exceptions to implied behavior
ConcurrencyDocument ambiguous thread safety
CleanupAlways document resource release
ErrorsDocument sentinels and types (note pointer)
ExamplesUse runnable examples in test files
FormattingBlank lines for paragraphs, indent for code

---

Related Skills

  • Naming conventions: See go-naming when choosing names for the identifiers your doc comments describe
  • Testing examples: See go-testing when writing runnable Example test functions that appear in godoc
  • Linting enforcement: See go-linting when using revive or other linters to enforce doc comment presence
  • Style principles: See go-style-core when balancing documentation verbosity against clarity and concision

Related skills

How it compares

Pick go-documentation over generic documentation skills when the codebase is Go and comments must pass godoc and Google style review.

FAQ

What Go documentation style does go-documentation follow?

go-documentation follows Google Go Style Guide conventions for doc comments. The skill produces godoc-compatible comments for packages, types, functions, methods, and constants that render on pkg.go.dev.

Can go-documentation document error variables and constants?

go-documentation covers error variables like ErrNotFound and exported constants such as MaxRetries. Comments use idiomatic Go phrasing and link to related constructors with godoc cross-reference syntax.

Is Go Documentation safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.