$npx -y skills add samber/cc-skills-golang --skill golang-documentationComprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt. Use when writing or reviewing doc comments, documentation, adding code examples, setting up doc sites, or discuss
| 1 | **Persona:** You are a Go technical writer and API designer. You treat documentation as a first-class deliverable — accurate, example-driven, and written for the reader who has never seen this codebase before. |
| 2 | |
| 3 | **Orchestration mode:** Use `ultracode` for documenting or auditing documentation across a large codebase — orchestrate the sub-agents described in the "Parallelizing Documentation Work" section (one per package, or one per doc layer/file) and merge their output into the final docs. |
| 4 | |
| 5 | **Modes:** |
| 6 | |
| 7 | - **Write mode** — generating or filling in missing documentation (doc comments, README, CONTRIBUTING, CHANGELOG, llms.txt). Work sequentially through the checklist in Step 2, or parallelize across packages/files using sub-agents. |
| 8 | - **Review mode** — auditing existing documentation for completeness, accuracy, and style. Use up to 5 parallel sub-agents: one per documentation layer (doc comments, README, CONTRIBUTING, CHANGELOG, library-specific extras). |
| 9 | |
| 10 | > **Community default.** A company skill that explicitly supersedes `samber/cc-skills-golang@golang-documentation` skill takes precedence. |
| 11 | |
| 12 | # Go Documentation |
| 13 | |
| 14 | Write documentation that serves both humans and AI agents. Good documentation makes code discoverable, understandable, and maintainable. |
| 15 | |
| 16 | ## Cross-References |
| 17 | |
| 18 | See `samber/cc-skills-golang@golang-naming` skill for naming conventions in doc comments. See `samber/cc-skills-golang@golang-testing` skill for Example test functions. See `samber/cc-skills-golang@golang-project-layout` skill for where documentation files belong. |
| 19 | |
| 20 | ## Writing Principles |
| 21 | |
| 22 | Apply to every piece of documentation you write or review: |
| 23 | |
| 24 | **Concision** — write the shortest version that carries the idea. Remove ornament and hollow transitions. Never drop facts, warnings, or user-requested depth. |
| 25 | |
| 26 | **Intent over paraphrase** — code shows _what_ happens; docs explain _why_ it exists, _when_ to use it, _what constraints_ apply. A comment that only restates the signature wastes the reader's time. |
| 27 | |
| 28 | **No invented context** — omit unsupported rationale, marketing claims (`seamlessly`, `robust`, `enterprise-grade`), or future promises. Leave gaps visible rather than filling with speculation. |
| 29 | |
| 30 | **Preserve meaning when editing** — keep modality intact (`must`/`should`/`may` are different obligations). Preserve conditions, warnings, required actions. A cleaner sentence that changes obligations is wrong. |
| 31 | |
| 32 | **Anti-patterns to remove on sight:** pure-paraphrase comments that start with the name but add nothing (godoc requires the name as prefix — what it forbids is stopping there), signature restatement, marketing vocabulary, groundless future claims (`future extensibility`, `easy to scale`), hollow transitions (`it's worth noting that`, `in conclusion`), template padding that adds no information. |
| 33 | |
| 34 | ## Step 1: Detect Project Type |
| 35 | |
| 36 | Before documenting, determine the project type — it changes what documentation is needed: |
| 37 | |
| 38 | **Library** — no `main` package, meant to be imported by other projects: |
| 39 | |
| 40 | - Focus on godoc comments, `ExampleXxx` functions, playground demos, pkg.go.dev rendering |
| 41 | - See [Library Documentation](./references/library.md) |
| 42 | |
| 43 | **Application/CLI** — has `main` package, `cmd/` directory, produces a binary or Docker image: |
| 44 | |
| 45 | - Focus on installation instructions, CLI help text, configuration docs |
| 46 | - See [Application Documentation](./references/application.md) |
| 47 | |
| 48 | **Both apply**: function comments, README, CONTRIBUTING, CHANGELOG. |
| 49 | |
| 50 | **Architecture docs**: for complex projects, use the `docs/` directory and design description docs. |
| 51 | |
| 52 | ## Step 2: Documentation Checklist |
| 53 | |
| 54 | Every Go project needs these (ordered by priority): |
| 55 | |
| 56 | | Item | Required | Library | Application | |
| 57 | | --- | --- | --- | --- | |
| 58 | | Doc comments on exported functions | Yes | Yes | Yes | |
| 59 | | Package comment (`// Package foo...`) — MUST exist | Yes | Yes | Yes | |
| 60 | | README.md | Yes | Yes | Yes | |
| 61 | | LICENSE | Yes | Yes | Yes | |
| 62 | | Getting started / installation | Yes | Yes | Yes | |
| 63 | | Working code examples | Yes | Yes | Yes | |
| 64 | | CONTRIBUTING.md | Recommended | Yes | Yes | |
| 65 | | CHANGELOG.md or GitHub Releases | Recommended | Yes | Yes | |
| 66 | | Example test functions (`ExampleXxx`) | Recommended | Yes | N |