Automated summary
This skill restates the idiomatic Go conventions to follow before creating or editing any .go file: happy path flow, error wrapping with %w, sentinel errors, and godoc-style comments.
Strengths
- Shows correct-versus-wrong snippets side by side, so each rule is directly actionable
- Targets the spots where models most often drift in Go: bare error returns, main logic nested inside if err == nil blocks, and shadowed predeclared identifiers
- Reminds the reader to declare package-level sentinel errors and check them with errors.Is()
- Uses the Go proverbs as a mental frame (happy path, "Errors are values", "Don't panic")
Limitations
- It is a prose checklist with no automated verification, so nothing enforces that the generated code complies
- The list of predeclared identifiers to avoid cuts off at the types section and is therefore incomplete
- Does not address testing, project layout, or Go modules
Load it whenever a task involves writing or editing Go code, so the conventions apply on the first pass.
Not useful for code in another language, or for reviewing prose with no .go files being produced.
Security analysis
SafeThis is a purely stylistic Go coding-conventions document. It contains no executable instructions beyond benign `go doc` documentation lookups, no file deletion, no network calls, no credential handling, and no attempt to disable safety mechanisms. The declared allowed-tools is empty, so there is no tool-execution surface at all.
No concerns found
How this analysis is madeExamples
Write a GetUser function in internal/store/user.go that returns a package-level ErrNotFound sentinel when the record is missing and wraps any DB error with the user ID as context.Refactor my ProcessOrder function in order.go so the success path flows straight down instead of nesting the main logic inside if err == nil blocks.Review comment.go: make every comment end with a period, add a godoc comment on each exported function, and rename any parameter that shadows a Go predeclared identifier.name: golang-style
description:
Use this skill BEFORE writing or editing any Go (.go) files. Triggers when
about to create, modify, or add code to .go files. Enforces happy path coding,
error wrapping, sentinel errors, godoc-style comments, and go doc usage.
Go Coding Conventions
Proverbs
Try to follow the proverbs:
Go Proverbs Simple, Poetic, Pithy Don't communicate by sharing memory, share memory by communicating. Concurrency is not parallelism. Channels orchestrate; mutexes serialize. The bigger the interface, the weaker the abstraction. Make the zero value useful. interface{} says nothing. Gofmt's style is no one's favorite, yet gofmt is everyone's favorite. A little copying is better than a little dependency. Syscall must always be guarded with build tags. Cgo must always be guarded with build tags. Cgo is not Go. With the unsafe package there are no guarantees. Clear is better than clever. Reflection is never clear. Errors are values. Don't just check errors, handle them gracefully. Design the architecture, name the components, document the details. Documentation is for users. Don't panic.
Follow these conventions strictly when writing Go code.
Happy Path Coding
Structure code so the successful path flows straight down. Handle errors immediately, then continue with main logic.
// Correct: happy path flows down.
func ProcessUser(id string) (*User, error) {
user, err := db.GetUser(id)
if err != nil {
return nil, fmt.Errorf("get user %s: %w", id, err)
}
if err := user.Validate(); err != nil {
return nil, fmt.Errorf("validate user %s: %w", id, err)
}
return user, nil
}
// Wrong: main logic nested inside conditions.
func ProcessUser(id string) (*User, error) {
user, err := db.GetUser(id)
if err == nil {
if err := user.Validate(); err == nil {
return user, nil
} else {
return nil, err
}
}
return nil, err
}
Error Wrapping
Always wrap errors with context using %w. Include the operation and relevant
identifiers.
// Correct: wrapped with context.
if err != nil {
return fmt.Errorf("create order for customer %s: %w", customerID, err)
}
// Wrong: no context.
if err != nil {
return err
}
Sentinel Errors
Define package-level sentinel errors for expected error conditions. Use
errors.Is() to check.
// Define at package level.
var (
ErrNotFound = errors.New("not found")
ErrUnauthorized = errors.New("unauthorized")
ErrInvalidInput = errors.New("invalid input")
)
// Return sentinel errors.
func GetUser(id string) (*User, error) {
user := db.Find(id)
if user == nil {
return nil, ErrNotFound
}
return user, nil
}
// Check with errors.Is().
user, err := GetUser(id)
if errors.Is(err, ErrNotFound) {
// Handle not found case.
}
Comments
All comments end with a period.
// ProcessOrder handles order creation and validation.
func ProcessOrder(o *Order) error {
// Validate the order before processing.
if err := o.Validate(); err != nil {
return err
}
// Continue with order processing.
return nil
}
Naming Conventions
Never use Go's predeclared identifiers as variable or parameter names. These include built-in functions and constants that can be shadowed but should not be.
// Wrong: shadows built-in identifiers.
func process(new string, len int, make bool) error {
copy := "data"
return nil
}
// Correct: use descriptive names instead.
func process(name string, length int, shouldCreate bool) error {
dataCopy := "data"
return nil
}
Predeclared identifiers to avoid:
- Functions:
new,make,len,cap,append,copy,delete,close,panic,recover,print,println,complex,real,imag,clear,min,max - Constants:
true,false,iota,nil - Types:
error,bool,string,int,int8,int16,int32,int64,uint,uint8,uint16,uint32,uint64,uintptr,float32,float64,complex64,complex128,byte,rune,any,comparable
Line Length
Maximum line length is 120 characters. Break long lines at logical points.
// Correct: break at logical points.
func ProcessOrderWithValidation(
ctx context.Context,
order *Order,
validator OrderValidator,
) (*Result, error) {
return nil, fmt.Errorf(
"process order %s for customer %s: %w",
order.ID,
order.CustomerID,
err,
)
}
Documentation Lookup
Use go doc to look up standard library and package documentation:
go doc fmt.Errorf
go doc errors.Is
go doc context
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/go-coding-conventions-mrwakdbn' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/go-coding-conventions-mrwakdbn/download' --output '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md.part' && mv '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md.part' '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md' && test -s '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/golang-style' && cp -R '.skill-downloads/go-coding-conventions-mrwakdbn' '.claude/skills/golang-style'Cursor
test -f '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md' && test -s '.skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/golang-style' && cp -R '.skill-downloads/go-coding-conventions-mrwakdbn' '.cursor/skills/golang-style'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/go-coding-conventions-mrwakdbn'openskills read 'go-coding-conventions-mrwakdbn'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/go-coding-conventions-mrwakdbn/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.