go-documentation

Standardize Go doc comments, package docs, and godoc formatting.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/HadiCherkaoui/opencode-config --skill go-documentation-hadicherkaoui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-documentation
Source: https://github.com/HadiCherkaoui/opencode-config/tree/main/skills/golang/go-documentation
Command: npx skills add https://github.com/HadiCherkaoui/opencode-config --skill go-documentation-hadicherkaoui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go projects often suffer from inconsistent or incomplete documentation. This Skill provides guidelines to standardize doc comments, package docs, and godoc formatting to improve readability and maintainability.

Core Features & Use Cases

  • Doc Comments: normative rules for exported names to have doc comments and to begin with the object's name; use full sentences and proper punctuation.
  • Struct Documentation: guidance on documenting struct types and their fields, including embedded types.
  • Godoc Formatting: conventions for formatting package docs, package comments, and code examples to produce clean godoc output.
  • Examples: guidance to include runnable examples that illustrate usage and behavior.

Quick Start

Apply these guidelines when writing or reviewing Go packages to ensure clear, complete documentation.

Frequently Asked Questions about go-documentation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write doc comments for exported Go functions?

Doc comments for exported Go functions should begin with the exported name, use complete sentences, and end with proper punctuation. This standardizes Go package documentation to ensure clear, readable godoc output across your codebase.

What is the best way to document Go struct fields and embedded types?

Documenting Go struct fields requires clear, consistent comments that describe the field's purpose and behavior. Standardizing struct documentation ensures exported fields and embedded types are fully explained, improving overall package readability and maintenance.

How do I add runnable examples to a Go package?

Add runnable examples to a Go package by creating functions named Example in your test files. These examples illustrate package usage and behavior, producing clean, executable documentation that appears directly in the generated godoc output.

Why does my godoc output look poorly formatted?

Godoc output appears poorly formatted when package comments and doc comments do not follow established conventions. Applying standard godoc formatting rules to your code comments ensures the generated documentation displays cleanly and consistently.

Do I need to follow specific rules for package documentation in Go?

Yes, Go package documentation requires following normative rules for doc comments, package comments, and examples. Adhering to these conventions ensures your package documentation is complete, consistent, and discoverable through godoc.

What should I check when reviewing Go documentation?

When reviewing Go documentation, check that exported names have doc comments starting with the object's name, struct fields are documented, and formatting follows godoc conventions. This ensures clear, complete, and consistent documentation across the codebase.