godoc-comments

Write Go doc comments for exported packages, types, functions, and variables.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/rigerc/flattenfetch --skill godoc-comments
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: godoc-comments
Source: https://github.com/rigerc/flattenfetch/tree/main/.agents/skills/godoc-comments
Command: npx skills add https://github.com/rigerc/flattenfetch --skill godoc-comments

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Go projects often lack cohesive, correctly formatted documentation for packages, types, functions, and variables, which hinders understanding and maintenance.

Core Features & Use Cases

  • Provides guidance on writing Go doc comments that render correctly in go doc, pkg.go.dev, and IDEs.
  • Covers naming conventions, syntax (headings, links, lists, code blocks), and common mistakes to reduce documentation errors.
  • Useful during code reviews or refactors to ensure exported identifiers have proper, consistent documentation.

Quick Start

Start by adding a package comment above each package declaration and follow the guidelines to document types and functions accordingly.

Frequently Asked Questions about godoc-comments

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

FAQPage Schema
How do I write Go doc comments that render correctly on pkg.go.dev?

To write Go doc comments that render correctly on pkg.go.dev, apply standard syntax rules for headings, links, lists, and code blocks above exported names and package declarations. This ensures proper rendering across go doc, pkg.go.dev, and IDEs.

What is the correct syntax for headings and links in godoc comments?

Correct godoc syntax requires specific formatting for headings, links, lists, and code blocks to ensure proper rendering. Following these standard comment guidelines for exported identifiers prevents documentation errors and display inconsistencies across tools.

Do I need to document all exported names in a Go package?

Yes, you need to document all exported names in a Go package. Adding clear, complete doc comments to packages, types, functions, and variables ensures cohesive project documentation and reduces maintenance issues during code reviews or refactoring.

How do I add a package comment in Go?

To add a package comment in Go, place the comment directly above the package declaration. Follow standard godoc guidelines to ensure the package overview renders correctly in go doc, pkg.go.dev, and your IDE.

What are common formatting mistakes in Go documentation?

Common Go documentation mistakes include incorrect syntax for headings, links, lists, and code blocks. Applying standard godoc comment guidelines across exported names reduces these documentation errors and ensures consistent rendering across platforms.

Can I use standard markdown in Go doc comments?

Go doc comments use a specific syntax for headings, links, lists, and code blocks rather than standard markdown. Following the correct godoc formatting practices ensures your documentation renders properly in go doc, pkg.go.dev, and IDEs.