go-skills
New16 Go skills covering style, naming, error handling, testing, documentation, concurrency, context, interfaces, data structures, control flow, performance, linting, code review, and defensive programming
Summary
This skill provides 16 modular Go best practices covering style, naming, error handling, testing, documentation, concurrency, context, interfaces, data structures, control flow, performance, linting, code review, and defensive programming.
- It helps developers write idiomatic, production-quality Go code by following established style guides and common review patterns.
Overview
AI Agent Skills for writing idiomatic, production-quality Go code. 20 modular skills teach AI coding assistants Go best practices derived from:
Skills are tuned following agentskills.io best practices: content the agent already knows is omitted, procedural decision trees guide multi-step tasks, 48 reference files load on demand via progressive disclosure, 8 bundled scripts automate common checks, and 4 asset templates ensure consistent output.
Skills Included
| Skill | Description |
|---|---|
| go-code-review | Systematic checklist for reviewing Go code and PR submissions |
| go-concurrency | Goroutine lifecycle, channels, mutexes, parallelization, thread-safety |
| go-context | Context.Context placement, cancellation, deadlines, request-scoped data |
| go-control-flow | Idiomatic conditionals, loops, switch/break behavior, guard clauses |
| go-data-structures | Slices, maps, arrays — allocation with new vs make, append, copying |
| go-declarations | Variable/const/type declarations, var vs :=, iota enums, shadowing |
| go-defensive | API boundary hardening, defer cleanup, Must functions, time handling |
| go-documentation | Doc comments, package docs, godoc formatting, runnable examples |
| go-error-handling | Error strategy decisions, wrapping (%v vs %w), sentinels, logging patterns |
| go-functional-options | Functional options pattern for constructors with optional config |
| go-functions | Function ordering, signature formatting, Printf verbs, Stringer interface |
| go-generics | When to use generics, constraints, common pitfalls, type aliases |
| go-interfaces | Interface design, abstractions, embedding, "accept interfaces return structs" |
| go-linting | Linters, golangci-lint setup, nolint directives, CI/CD integration |
| go-logging | Structured logging with slog, log levels, request-scoped context, migration |
| go-naming | Naming decision flow for packages, types, functions, variables, receivers |
| go-packages | Package organization, imports, package size, CLI/flag patterns |
| go-performance | String optimization, capacity hints, benchmarking, strconv over fmt |
| go-style-core | Formatting, nesting reduction, style principles, fallback style guide |
| go-testing | Table-driven tests, subtests, test helpers, assertions, test organization |
Bundled Scripts
8 scripts automate common Go checks. All support --help, --json for structured output, and meaningful exit codes (0 = clean, 1 = issues found, 2 = error). Analysis scripts support --limit to cap output size, and destructive scripts require --force to overwrite existing files.
| Script | Skill | Purpose |
|---|---|---|
pre-review.sh | go-code-review | Run gofmt + go vet + golangci-lint before review |
check-naming.sh | go-naming | Detect SCREAMING_SNAKE, Get-prefixed getters, bad package names |
check-docs.sh | go-documentation | Find exported symbols missing doc comments |
check-errors.sh | go-error-handling | Catch bare returns, string comparison on errors, log-and-return |
check-interface-compliance.sh | go-interfaces | Find interfaces missing compile-time verification |
bench-compare.sh | go-performance | Run benchmarks with optional benchstat comparison |
setup-lint.sh | go-linting | Generate .golangci.yml with recommended linters |
gen-table-test.sh | go-testing | Scaffold a table-driven test file |
Quick Install
Using npx skills (Recommended)
The easiest way to install across any AI coding agent. Supports Cursor, Codex, OpenCode, Cline, GitHub Copilot, Windsurf, Roo Code, and 25+ more agents.
npx skills add cxuu/golang-skills --allClaude Code
# Add the marketplace (one time)
/plugin marketplace add cxuu/golang-skills
# Install the skills
/plugin install golang-skills@cxuu-golang-skillsCursor (Native Remote Rule)
- Open Cursor Settings (Cmd+Shift+J on Mac, Ctrl+Shift+J on Windows/Linux)
- Navigate to Rules → Add Rule → Remote Rule (Github)
- Enter:
https://github.com/cxuu/golang-skills
How It Works
These skills follow the Agent Skills open standard, which works across multiple AI coding tools. When you're writing Go code:
- Automatic activation: The AI agent loads relevant skills based on context
(e.g., go-naming when you're writing a new function)
- Procedural guidance: Decision trees and step-by-step procedures for
multi-step tasks like code review and error strategy selection
- Progressive disclosure: Core rules load immediately; 48 reference files
load on demand when specific situations arise
- Automation: 8 bundled scripts handle repetitive checks so the agent
focuses on higher-level guidance
- Conditional cross-references: Skills link to each other with "when"
conditions to avoid unnecessary context loading
Project Structure
skills/
├── go-*/
│ ├── SKILL.md # Core rules (< 225 lines each)
│ ├── references/ # Detailed guidance, loaded on demand
│ ├── scripts/ # Automation scripts (8 skills)
│ └── assets/ # Output templates (4 skills)
├── evals/
│ ├── evals.json # 51 trigger evals + 15 quality evals
│ └── files/ # Sample Go files for quality evals
└── source/ # Original style guide sourcesLicense
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
Install & Usage
mkdir -p .claude/skillsmkdir -p .claude/skills && curl -o .claude/skills/go-skills.md https://raw.githubusercontent.com/cxuu/golang-skills/main/SKILL.md/go-skillsUse Cases
Usage Examples
/go-skills go-code-review review this PR for idiomatic Go style
Check my Go code for proper error handling and context usage
Apply Go best practices to this function: [paste code]
Security Audits
Frequently Asked Questions
What is go-skills?
This skill provides 16 modular Go best practices covering style, naming, error handling, testing, documentation, concurrency, context, interfaces, data structures, control flow, performance, linting, code review, and defensive programming. It helps developers write idiomatic, production-quality Go code by following established style guides and common review patterns.
How to install go-skills?
To install go-skills: create the skills directory (mkdir -p .claude/skills), then run: mkdir -p .claude/skills && curl -o .claude/skills/go-skills.md https://raw.githubusercontent.com/cxuu/golang-skills/main/SKILL.md. Finally, /go-skills in Claude Code.
What is go-skills best for?
go-skills is a skill categorized under General. It is designed for: testing, code-review, documentation. Created by cxuu.
What can I use go-skills for?
go-skills is useful for: Review a pull request for Go code to ensure it follows idiomatic style and best practices.; Learn how to properly handle errors and use context in Go applications.; Write concurrent Go code with correct goroutine lifecycle and channel usage.; Improve code quality by applying defensive programming techniques at API boundaries.; Set up consistent naming, documentation, and linting across a Go codebase..