Przejdź do treści
Biblioteka skilli
Programowanie · Pisanie

go-documentation

/go-documentation

Pomaga pisać i recenzować dokumentację pakietów, typów, funkcji i metod w Go, także proaktywnie przy nowych eksportowanych symbolach.

Repozytorium
golang-skills ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
19.06.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
7
Skrypty
3
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 19.06.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co sprawdzić przed instalacją
  • 3 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: assets/doc-template.go, scripts/check-docs-ast.go, scripts/check-docs.sh

Co robi i kiedy

Pomaga pisać i recenzować dokumentację pakietów, typów, funkcji i metod w Go, także proaktywnie przy nowych eksportowanych symbolach.

Oryginalny opis (EN)

Use when writing or reviewing documentation for Go packages, types, functions, or methods. Also use proactively when creating new exported types, functions, or packages, even if the user doesn't explicitly ask about documentation. Does not cover code comments for non-exported symbols (see go-style-core).

Jak działa

  1. Resource Routing
  2. Doc Comments
  3. Comment Sentences
  4. Comment Line Length
  5. Struct Documentation
  6. Package Comments
  7. What to Document
  8. Runnable Examples
  9. Quick Reference
  10. Related Skills
Sekcje z nagłówków SKILL.md, w oryginale · 151 linii, 719 słów
Podgląd SKILL.md
---
name: go-documentation
description: Use when writing or reviewing documentation for Go packages, types, functions, or methods. Also use proactively when creating new exported types, functions, or packages, even if the user doesn't explicitly ask about documentation. Does not cover code comments for non-exported symbols (see go-style-core).
allowed-tools: Bash(bash:*)
---

# 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)

```go
// 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:

```go
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.

```go
// 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.

| Topic | Document when... | Skip when... |
|-------|-----------------|--------------|
| Parameters | Non-obvious behavior, edge cases | Restates the type signature |
| Contexts | Behavior differs from standard cancellation | Standard `ctx.Err()` return |
| Concurrency | Ambiguous thread safety (e.g., read that mutates) | Read-only is safe, mutation is unsafe |
| Cleanup | Always document resource release | — |
| Errors | Sentinel values, error types (use `*PathError`) | — |
| Named results | Multiple params of same type, action-oriented names | Type 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`).

```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

| Topic | Key Rule |
|-------|----------|
| Doc comments | Start with name, use full sentences |
| Line length | ~80 chars, prioritize readability |
| Package comments | One per package, above `package` clause |
| Parameters | Document non-obvious behavior only |
| Contexts | Document exceptions to implied behavior |
| Concurrency | Document ambiguous thread safety |
| Cleanup | Always document resource release |
| Errors | Document sentinels and types (note pointer) |
| Examples | Use runnable examples in test files |
| Formatting | Blank lines for paragraphs, indent for code |

---

## Related Skills

- **Naming conventions**: See [go-naming](../go-naming/SKILL.md) when choosing names for the identifiers your doc comments describe
- **Testing examples**: See [go-testing](../go-testing/SKILL.md) when writing runnable `Example` test functions that appear in godoc
- **Linting enforcement**: See [go-linting](../go-linting/SKILL.md) when using revive or other linters to enforce doc comment presence
- **Style principles**: See [go-style-core](../go-style-core/SKILL.md) when balancing documentation verbosity against clarity and concision
Pliki w paczce (7)
  • SKILL.md 5 KB
  • assets/doc-template.go 2 KB
  • references/CONVENTIONS.md 7 KB
  • references/EXAMPLES.md 3 KB
  • references/FORMATTING.md 2 KB
  • scripts/check-docs-ast.go 8 KB
  • scripts/check-docs.sh 1 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · cxuu/golang-skills100Apache-2.0
h0rn3t/golang-skills100Apache-2.0
typefox/agent-skills100MIT
eduardo-sl/go-agent-skills100MIT
muratmirgun/gophers100MIT
muratmirgun/gophers100MIT

Migawka bazy z 28.10.2026 · wersja paczki 76b07c915781 (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90go-naming
    Podpowiada nazwy pakietów, typów, funkcji, metod i zmiennych w Go, także dla nowych typów i publicznych API.
  • 100go-naming
    Pomaga nazywać pakiety, typy, funkcje, metody, zmienne, stałe i odbiorniki w Go w sposób idiomatyczny i czytelny, także przy tworzeniu nowych typów i eksportowanych API.
  • 95types-check
    Waliduje argumenty funkcji w R za pomocą pliku funkcji check_*, przy pisaniu eksportowanych funkcji i przeglądzie kodu.
  • 100repo-source-code-test-packages
    Pisze testy jednostkowe pakietów Formisch core i methods z poprawnymi typami TypeScript, także przy naprawie błędów typów.
  • 100repo-website-api-create
    Tworzy strony dokumentacji API dla nowych funkcji, typów i komponentów Formisch, które jeszcze nie mają opisu na stronie.
  • 90java-docs
    Stosuje dobre praktyki Javadoc przy dodawaniu i przeglądzie dokumentacji typów, metod, pakietów i publicznych API Javy.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.