Go Documentation logo

Go Documentation

Community
eduardo-sl
go-documentation

Go documentation conventions: godoc comments, package docs, testable Example functions, deprecation notices, doc links, and project docs (README, CHANGELOG, llms.txt). Use when: "add godoc", "document this package", "write doc comments", "add examples to docs", "deprecate a function", "write a README", "update the changelog", "improve the docs". Not for: commit messages (git-commit), code style (go-coding-standards).

Overview

Publishereduardo-sl
Repositorygo-agent-skills
Skill namego-documentation
Stars
86
Forks
11
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by eduardo-sl on GitHub. Read the source before you install it.

Installation

Install the Go Documentation AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(code-quality)/go-documentation
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.

Use it in TypingMind

Enable Go Documentation in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Go Documentation on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Go Documentation is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Go Documentation

Godoc is not free-form prose — it's a convention the toolchain renders. Comments that follow the convention become browsable documentation on pkg.go.dev; comments that don't become noise.

Community default. A project skill or agent-config rule that explicitly supersedes go-documentation takes precedence over this one.

Detailed reference material, loaded on demand:

  • references/project-docs.md — README templates for libraries and services, CHANGELOG, llms.txt, CONTRIBUTING.

Read a reference file only when the summary below is not enough.

1. Doc Comment Form

Every exported identifier gets a doc comment. It starts with the identifier's name and is a complete sentence:

go
// ✅ Good
// ParseDuration parses a duration string such as "300ms" or "2h45m".
// It returns an error if the string is not a valid duration.
func ParseDuration(s string) (Duration, error) { ... }

// ❌ Bad — doesn't start with the name, fragment, restates signature
// this function parses durations
func ParseDuration(s string) (Duration, error) { ... }
  • Groups of related constants/variables may share one comment on the block: // Common HTTP methods. above the const (...) group.
  • Unexported identifiers: comment when the purpose isn't obvious from the name — same form, no obligation.
  • Say what the caller needs: behavior, error conditions, nil/zero-value handling, concurrency safety. Not the implementation.

2. Package Documentation

One package comment per package, on the package clause. For more than a few sentences, put it in a dedicated doc.go:

go
// Package retry implements backoff strategies for retrying failed
// operations.
//
// The zero value of Policy retries three times with exponential
// backoff. Use functional options to customize:
//
//	p := retry.NewPolicy(retry.WithMaxAttempts(5))
//	err := p.Do(ctx, fetchUser)
package retry
  • Begins with "Package ...".
  • Indented lines (one tab) render as code blocks.
  • main packages: the comment describes the command and its flags — it becomes the command's documentation.

3. Doc Links and Formatting (Go 1.19+)

go
// Fetch retrieves the resource. It honors the deadline of ctx and
// returns [ErrNotFound] if the resource does not exist.
//
// For batch retrieval use [Client.FetchAll]. See the [net/http]
// package for transport configuration.
func (c *Client) Fetch(ctx context.Context, id string) (*Resource, error)
  • [Name], [Type.Method], [pkg/path] become hyperlinks on pkg.go.dev.
  • A line starting with # is a heading (rare; only in long package docs).
  • Lists: lines starting with a space and a bullet. Keep them shallow.

4. Testable Examples

Example functions are documentation the compiler checks. Put them in example_test.go in the <pkg>_test package:

go
func ExampleParseDuration() {
    d, _ := ParseDuration("1h30m")
    fmt.Println(d.Minutes())
    // Output: 90
}

// Method example: ExampleType_Method
func ExamplePolicy_Do() { ... }

// Second example for the same symbol: suffix
func ExampleParseDuration_negative() { ... }
  • The // Output: comment makes it a test — go test fails if the printed output differs. Examples without it compile but don't run.
  • Write an example for every non-trivial exported API. It renders directly under the symbol on pkg.go.dev.

5. Deprecation

go
// Fetch retrieves the resource.
//
// Deprecated: Use [Client.FetchContext] instead, which honors
// context cancellation.
func (c *Client) Fetch(id string) (*Resource, error)
  • The paragraph must start exactly with Deprecated: .
  • Always name the replacement.
  • Tools (gopls, staticcheck, pkg.go.dev) surface these automatically.

6. What NOT to Write

go
// ❌ Noise — restates the code
// GetName returns the name.
func (u *User) GetName() string { return u.name }

// ❌ Maintenance history — belongs in git
// Changed 2024-03-01 by alice: added caching.

// ❌ Commented-out code kept "for reference"

If a doc comment can only restate the signature, improve the name until the comment says something the signature can't — or accept a minimal comment for symmetry in a fully documented API.

7. Project-Level Documentation

  • README — a library leads with what it does, install, the minimal working example, and a pkg.go.dev link instead of duplicating the API. A service leads with how to run it, its configuration table (generated from the config struct where possible), and where health, metrics and runbooks live.
  • CHANGELOG — Keep a Changelog sections (Added, Changed, Deprecated, Removed, Fixed, Security), written for the module's users, not as a commit log.
  • llms.txt — a short Markdown index at the docs root pointing AI assistants at the API reference and examples.
  • Go 1.27+: go doc example.com/pkg@v1.2.3 reads another version's docs without changing go.mod; go doc -ex lists executable examples.

Templates: references/project-docs.md.

Executable Verification

bash
go vet ./...                  # flags some malformed doc comments
gofmt -l .                    # Go 1.19+ gofmt normalizes doc comments
go test ./...                 # runs Example functions with Output
go doc ./mypkg Symbol         # render what users will actually see

For a browsable preview, run a local pkgsite if available: go run golang.org/x/pkgsite/cmd/pkgsite@latest and open the module.

Verification Checklist

  1. Every exported identifier has a doc comment starting with its name
  2. Package has a package comment ("Package ..."), in doc.go if long
  3. Error conditions and nil/zero-value behavior documented for exported APIs
  4. Concurrency safety stated where callers could guess wrong
  5. [Symbol] doc links used instead of bare names in running text
  6. Non-trivial exported APIs have Example functions with // Output:
  7. Deprecations use the exact Deprecated: form and name a replacement
  8. No comments restating signatures, tracking history, or holding dead code
  9. go test ./... passes with examples enabled
  10. README leads with purpose and a working example; CHANGELOG updated for user-visible changes

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Go Documentation AI skill do?

Go documentation conventions: godoc comments, package docs, testable Example functions, deprecation notices, doc links, and project docs (README, CHANGELOG, llms.txt). Use when: "add godoc", "document this package", "write doc comments", "add examples to docs", "deprecate a function", "write a README", "update the changelog", "improve the docs". Not for: commit messages (git-commit), code style (go-coding-standards).

Why use Go Documentation on TypingMind?

Because you install it once and use it with any model. Go Documentation is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Go Documentation in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(code-quality)/go-documentation. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Go Documentation?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Go Documentation?

As many as you like. As long as a model supports skills, you can use Go Documentation with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Go Documentation AI skill free?

Yes. It is published on GitHub by eduardo-sl under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇