Skip to content
Back to skills

Go Standards

ASecurity

Personal Go engineering defaults, grounded in the standard library, for implementing, reviewing, refactoring, or testing Go code. Use when working on Go packages, CLIs, libraries, concurrency primitives, parsers, formatters, config loading, errors, documentation, examples, table-driven tests, fuzz tests, compatibility-sensitive APIs, or repository standards for high-quality Go code. The project's own conventions take precedence over these defaults.

  • 9 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 6, 2026
code-qualitygotestingrefactoringapiperformancedocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 17, 2026

npx -y skills add leefowlercu/agent-kit --skill go-standards --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Go Standards?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Go Standards
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leefowlercu-go-standards/badge)](https://www.skillsdirectory.com/skills/leefowlercu-go-standards)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: go-standards
description: Personal Go engineering defaults, grounded in the standard library, for implementing, reviewing, refactoring, or testing Go code. Use when working on Go packages, CLIs, libraries, concurrency primitives, parsers, formatters, config loading, errors, documentation, examples, table-driven tests, fuzz tests, compatibility-sensitive APIs, or repository standards for high-quality Go code. The project's own conventions take precedence over these defaults.
---

# Go Standards

## Operating Mode

Use this skill to make Go code boring, explicit, well-tested, and compatible. Prefer the Go standard library's ordinary public-package style over clever runtime/compiler/internal tricks.

## Precedence

This skill holds the user's personal Go defaults. It fills gaps; it does not override the project.

When guidance conflicts, follow the first source that addresses it:

1. The user's instructions in the current conversation.
2. The project's written standards: the nearest `AGENTS.md` or `CLAUDE.md`, `CONTRIBUTING.md`, and style or architecture docs.
3. The project's enforced tooling: `.golangci.yml`, pre-commit hooks, and the checks CI runs.
4. The conventions in the surrounding code: package layout, naming, error wording, and test libraries and structure. If the repository is inconsistent, match the nearest code (the same package or module).
5. This skill, including its references.

- Do not restructure, rename, or reformat existing code to match this skill unless the user asks.
- Apply this skill's layout and style rules only where the project has no rule or pattern of its own.
- In reviews, judge code against the project's conventions, not this skill's.
- When following the project means departing from this skill in a way the user might not expect, say so in one line.

## Core Workflow

1. Classify the task as implementation, bug fix, API design, refactor, review, or diagnosis.
2. Before proposing code, check Precedence sources 2-4: instruction files, lint and CI configuration, `go.mod`, and the target package and its tests.
3. Write or update tests first when behavior changes; use the standard `testing` package unless the project uses another test library.
4. Implement the smallest API and implementation that satisfies the tests and the project's conventions.
5. Run `gofmt`, or the project's configured formatter, on changed Go files, then run the narrowest meaningful `go test` command. Broaden to `go test ./...` when shared behavior or package boundaries changed.
6. Report exact commands run and any unverified risk.

## Default Standards

- Design APIs around small functions, small interfaces, explicit contracts, and useful zero values.
- Document exported identifiers with behavior, edge cases, concurrency guarantees, ownership rules, and compatibility notes.
- Prefer plain data flow and early returns. Add abstraction only when it removes real duplication or clarifies a boundary.
- Use package-private helpers for implementation details. Use `internal/` for cross-package implementation sharing that must not become public API.
- Return stable, contextual errors. Use wrapping when callers should match with `errors.Is` or `errors.As`; avoid exposing sentinels unless callers need a stable contract.
- Keep tests deterministic, fast, and behavior-focused. Prefer table-driven unit tests for edge cases; add examples for public onboarding; add fuzz tests for parsers, decoders, escaping, tokenization, and boundary-heavy transformations.
- Use `log/slog` for logging and prefer `any` over `interface{}` unless local compatibility requires otherwise.
- Use build tags and platform-specific files for OS/architecture behavior instead of large runtime branches.
- Preserve compatibility unless the user explicitly asks for a breaking change.

## References

Load only the reference needed for the task:

- `references/stdlib-patterns.md`: Load for API design, docs, errors, testing, concurrency, performance, compatibility, platform-specific code, or review checklists.
- `references/stdlib-examples.md`: Load when concrete examples would help apply `references/stdlib-patterns.md` without relying on access to the Go source tree.
- `references/repo-baseline.md`: Load when creating modules, changing package layout, adding logging, or choosing unit vs acceptance test structure.
- `references/cobra-viper.md`: Load when implementing or reviewing Cobra commands, Viper configuration, or Go CLI layout.

## Review Posture

For Go reviews, lead with correctness, compatibility, race/deadlock risk, API ambiguity, error matching regressions, missing tests, and portability. Avoid style-only findings unless they materially affect maintainability or violate the project's conventions. Do not flag code for departing from this skill where the project follows its own convention.

## Do Not Generalize

Do not copy patterns from `runtime`, `syscall`, `unsafe`, compiler packages, generated tables, assembly, or deeply optimized algorithms unless the target package has the same constraints. Convert those observations into ordinary principles: isolate unsafe code, document invariants, test edge cases, and measure performance before optimizing.

Files in this skill

  • SKILL.md3.9 KB
  • agents/openai.yaml252 B
  • references/cobra-viper.md5.1 KB
  • references/repo-baseline.md2.5 KB
  • references/stdlib-examples.md6.3 KB
  • references/stdlib-patterns.md7.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.