Implement or audit idiomatic Go code using effective naming, errors, context, interfaces, generics, nil handling, slices/maps, documentation comments, and standard library conventions. Use when writing, refactoring, cleaning, or reviewing Golang code; reducing nesting; improving API ergonomics; checking idiomatic implementation style; or finding non-idiomatic Go in existing code.
Instalação
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Implement or audit idiomatic Go code using effective naming, errors, context, interfaces, generics, nil handling, slices/maps, documentation comments, and standard library conventions. Use when writing, refactoring, cleaning, or reviewing Golang code; reducing nesting; improving API ergonomics; checking idiomatic implementation style; or finding non-idiomatic Go in existing code.
Go Implementation Idioms
Build Workflow
Prefer straightforward code over abstraction. Make the happy path read down the page by handling errors early.
Use the standard library idioms already present in the repo: context, errors, fmt, io, testing, slog, net/http, and so on.
Keep names short but explanatory at their scope. Avoid package-name stutter in exported identifiers.
Wrap errors with context using %w when callers need errors.Is or errors.As.
Accept small interfaces and return concrete types. Avoid pointers to interfaces.
Use type parameters for real type relationships; do not use generics to avoid writing clear domain code.
Treat nil carefully: nil slices are usually fine for empty collections; maps must be made before writes.
Document exported packages, types, functions, methods, and non-obvious behavior for users.
Run gofmt/goimports after edits and keep generated code separate.
Audit Workflow
Inspect call sites before judging names, exported APIs, interfaces, or generic types.
Flag error handling that loses classification, context, wrapping, cancellation, or caller actionability.