Skip to content

About

Agent skills for writing and reviewing simple, idiomatic Go, plus a drop-in golangci-lint config

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Pixel art icon: a round blue burrowing animal peeking out of its burrow on a green meadow under a cyan sky

Beautiful Go

Two standard Agent Skills and a lints config that teach coding agents to write, review, and enforce simple, idiomatic Go:

  • go-best-practices loads whenever an agent writes or changes Go, and steers it toward clear, simple, maintainable code that reads like the standard library.
  • go-review reviews existing Go code, a file, a package, or a diff, and writes a prioritized report where every finding cites the rule it breaks and shows the fix.
  • lints/ is a drop-in golangci-lint configuration that enforces the machine-checkable rules in CI.

They work with Claude Code, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, and any other agent that reads the Agent Skills format. Every Go example in the skills is checked to parse and be gofmt-clean, and every check in the lint config is proven to fire.

The guidance is distilled from the official Go guidance and the two most widely used company style guides, with a condensed digest of each bundled in the skill so the agent can consult the original reasoning when it needs to:

Where the sources disagree, the skill picks a side and says why. For example, Uber prefers functional options and prefixes unexported globals with _; the skill follows Google and the standard library instead.

What it covers

skills/go-best-practices/SKILL.md is about 470 lines, organized so an agent can scan it while coding:

  1. Mindset: clarity, simplicity, concision; least mechanism; useful zero values
  2. Before handing back code: gofmt, go vet, go test -race, golangci-lint, go fix
  3. Naming: packages, initialisms, receivers, getters, stutter
  4. Packages and program structure: layout, globals, init, a thin main, imports
  5. Types and API design: consumer-side interfaces, receivers, options, enums, slices and maps, generics
  6. Errors: wrapping with %w, errors.Is/As, sentinels vs types, handle once, panics
  7. Everyday idioms, including the modern standard library gated on your go directive
  8. Concurrency: goroutine lifetimes, context, channels, mutexes, the race detector
  9. Documentation and doc comments
  10. Tests: table-driven, got before want, cmp.Diff, no assertion libraries, fakes, fuzzing
  11. Modules and compatibility
  12. Performance, in order
  13. Changing someone else's code
  14. Final checklist

skills/go-best-practices/references/ holds one digest per source, plus a table of which Go version added which feature, so the agent never writes code newer than your go.mod allows.

Install

Each skill is a folder under skills/: go-best-practices/ and go-review/. Every option below puts those folders where your agent looks for skills. Install both; the review skill leans on the best-practices skill for its rules.

Any agent, one command

The skills installer supports most agents (Node 22.20 or later):

npx skills add brrock/BeautifulGo

Add -g to install for your user instead of the current project, or -a <agent> to pick an agent, such as -a codex or -a cursor.

Claude Code

Install it as a plugin so updates arrive with one command:

claude plugin install beautiful-go --marketplace brrock/BeautifulGo

Inside a session, the same thing is:

/plugin marketplace add brrock/BeautifulGo
/plugin install beautiful-go@beautiful-go

The skills appear as /beautiful-go:go-best-practices and /beautiful-go:go-review, though you rarely need to call them, since they trigger on their own. To try it for one session without installing, clone the repo and run claude --plugin-dir ./BeautifulGo.

OpenAI Codex

codex plugin marketplace add brrock/BeautifulGo
codex plugin add beautiful-go@beautiful-go

GitHub Copilot

With GitHub CLI 2.90 or later:

gh skill install brrock/BeautifulGo go-best-practices
gh skill install brrock/BeautifulGo go-review

Add --scope user to install for your user, or --agent <name> for a different agent.

Gemini CLI

gemini skills install https://github.com/brrock/BeautifulGo --path skills/go-best-practices
gemini skills install https://github.com/brrock/BeautifulGo --path skills/go-review

Cursor or anything else: copy the folder

git clone https://github.com/brrock/BeautifulGo
mkdir -p ~/.agents/skills
cp -R BeautifulGo/skills/go-* ~/.agents/skills/
Agent User directory Project directory
Claude Code ~/.claude/skills/ .claude/skills/
OpenAI Codex ~/.agents/skills/ .agents/skills/
GitHub Copilot ~/.copilot/skills/ or ~/.agents/skills/ .github/skills/ or .agents/skills/
Cursor ~/.cursor/skills/ or ~/.agents/skills/ .cursor/skills/ or .agents/skills/
Gemini CLI ~/.gemini/skills/ or ~/.agents/skills/ .gemini/skills/ or .agents/skills/

Claude Code does not read .agents/skills/, so use its own directory or the plugin. Restart the agent if the skill doesn't show up right away.

claude.ai

claude.ai takes one zip per skill, with the skill folder as the zip root:

cd skills
zip -r ../go-best-practices.zip go-best-practices -x '*.DS_Store' -x '*/evals/*'
zip -r ../go-review.zip go-review -x '*.DS_Store' -x '*/evals/*'

Upload each under Customize > Skills. Code execution must be enabled first.

Reviewing existing code

Ask your agent to review a file, package, or diff, for example "review store/store.go" or "what would you change in this PR". The go-review skill runs gofmt, go vet, go test -race, and golangci-lint when a toolchain is available, then writes a report with three tiers: must fix, should fix, and consider. Every finding gives a file:line location, the rule it breaks with its source (a Code Review Comments section, a Google Decisions or Best Practices entry, an Uber guideline, or a vet check), and the smallest code change that fixes it. Each report ends with what the code already does well.

Enforcing the rules with golangci-lint

The skills teach the rules; the lints keep them from slipping back in. Copy lints/.golangci.yml to your module root and run:

golangci-lint run
golangci-lint fmt

On top of the standard set (errcheck, govet, ineffassign, staticcheck, unused), it flags == on wrapped errors, sentinels not named Err..., unchecked type assertions, contexts stored in structs, HTTP calls without a context or a closed body, constructors returning interfaces, mixed receiver types, embedded mutexes, untagged marshaled structs, mutable globals, init functions, shadowed builtins, needless loop-variable copies, code the go fix modernizers would rewrite, test helpers without t.Helper(), and 25 revive rules from Code Review Comments, including os.Exit outside main, bool control-flag parameters, Id instead of ID, and this receivers. A bare //nolint without a linter name and a reason is itself an error. Linters marked [lib] fit packages that other modules import; applications can drop them.

Every check is proven. lints/check/ holds one deliberate violation per linter and revive rule, lints/clean/ holds idiomatic code that must produce no findings, and this script runs both from the repo root:

python3 scripts/check-lints.py

It fails if a check stops firing, or if the config starts flagging the idioms the skill recommends.

Layout

BeautifulGo/
├── .claude-plugin/
│   ├── plugin.json         Claude Code plugin manifest
│   └── marketplace.json    lets this repo act as its own marketplace
├── .agents/plugins/
│   └── marketplace.json    the same, for Codex
├── plugin.json             Codex plugin manifest
├── assets/icon.png         plugin icon
├── skills/
│   ├── go-best-practices/  writing skill
│   │   ├── SKILL.md
│   │   ├── references/     one digest per source
│   │   └── evals/
│   └── go-review/          review skill
│       ├── SKILL.md
│       └── evals/
├── lints/
│   ├── .golangci.yml       drop-in golangci-lint v2 config
│   ├── check/              one deliberate violation per check
│   └── clean/              idiomatic code that must stay clean
├── scripts/
│   ├── check-skill.py      validates skills, references, links, evals, and manifests
│   ├── check-lints.py      proves every lint fires and the clean code stays clean
│   └── check-examples.py   checks every Go example parses and is gofmt-clean
├── CHANGELOG.md
├── CONTRIBUTING.md
└── README.md

Testing the skills

skills/go-best-practices/evals/ holds three test cases in the layout claude plugin eval reads: a library API task (a semver package), an application CLI task (a log summarizer), and a refactor-this-package task with a deliberately messy input file. skills/go-review/evals/ reviews the same messy package. Each case has the prompt, a description of a good result, and one assertion per file under graders/. Run them with and without the skill from each skill's directory:

claude plugin eval . --allow-tools Write,Edit,Bash --scaffold

These are real model runs and are billed.

Updating

Edit the skill, bump version in both .claude-plugin/plugin.json and plugin.json (the checker fails if they differ), add a CHANGELOG.md entry, commit, and push. Claude Code plugin users pick up the new version with claude plugin update beautiful-go; Codex users with codex plugin marketplace upgrade beautiful-go.

Credits

Beautiful Go is a rewrite of BeautifulRust by Morgan Linton, whose structure, review format, and eval approach it keeps. MIT licensed; see LICENSE.

About

Agent skills for writing and reviewing simple, idiomatic Go, plus a drop-in golangci-lint config

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages