code-quality-go
Skill345 starsChanged 35 days agoApache-2.0View on GitHub
Use when writing or reviewing Go in this repo's client module (sink-connector-client), or when asked for "worldclass"/"idiomatic" Go. Covers error handling, interfaces, concurrency (goroutines/channels), and a deep review checklist for defect classes common in Go client libraries.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- clickhouse-sink-reviewSkill
- code-quality-architectureSkill
- code-quality-bashSkill
- code-quality-jvmSkill
- code-quality-pythonSkill
- code-quality-sqlSkill
- code-reuse-firstSkill
- code-reuse-reviewSkill
- design-note-debtSkill
- destructive-operation-safetySkill
- mandatory-code-change-validationSkill
- pr-self-reviewSkill
- repro-harness-negative-proofSkill
- sink-connector-mysql-source-of-truthSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Errors are values, checked explicitly: Never ignore an error return (_ = f() is a red flag unless genuinely justified and commented).
- Very specific: line 30
Small interfaces, defined by the consumer: Prefer io.Reader-sized interfaces over large ones.
- Very specific: line 32
Avoid goroutine leaks: Every goroutine must have a clear exit condition.
- Very specific: line 36
Channels for ownership transfer, mutexes for shared state: Don't reach for channels where a simple sync.Mutex-guarded field is clearer and …
- Very specific: line 68
Run this over every changed .go file during pr-self-review's per-language pass.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Worldclass Go
Overview
Idiomatic Go for sink-connector-client, the Go client for this project.
Favor explicit error handling, small interfaces, and straightforward
concurrency over cleverness — this is client-library code other programs
will depend on, so its public API and error contract matter more than
internal elegance.
When to Use
- Writing or reviewing
.gofiles insink-connector-client - Designing a Go public API, error type, or concurrency pattern
- A user asks for "worldclass / idiomatic" Go
Core Rules
- Errors are values, checked explicitly. Never ignore an error return
(
_ = f()is a red flag unless genuinely justified and commented). Wrap with context (fmt.Errorf("doing X: %w", err)) so a caller canerrors.Is/errors.Aswithout losing the chain. - Small interfaces, defined by the consumer. Prefer
io.Reader-sized interfaces over large ones; accept interfaces, return concrete types. - Avoid goroutine leaks. Every goroutine must have a clear exit
condition; use
context.Contextfor cancellation and propagate it through the call chain rather than inventing a bespoke done-channel per function. - Channels for ownership transfer, mutexes for shared state. Don't
reach for channels where a simple
sync.Mutex-guarded field is clearer and cheaper. deferfor cleanup, close to the resource acquisition, including on error paths.- Table-driven tests (
[]struct{ ... }+ a loop) over repeated near-identical test functions. - Keep the public API surface minimal — exported types/functions are a compatibility promise for this client library; prefer unexported helpers unless something genuinely needs to be public.
// BAD
data, _ := conn.Read()
go func() { process(data) }() // no way to stop this goroutine
// GOOD
data, err := conn.Read()
if err != nil {
return fmt.Errorf("reading from connection: %w", err)
}
go func(ctx context.Context) {
select {
case <-ctx.Done():
return
default:
process(data)
}
}(ctx)Deep Review Checklist (Go)
Run this over every changed .go file during pr-self-review's
per-language pass.
- Ignored errors — any
_ = f()or unchecked return value; confirm it is genuinely safe to ignore, and comment why if so. - Goroutine leaks — a spawned goroutine with no cancellation path, or one that blocks forever on a channel nobody will ever write to/close.
- Nil pointer dereference on a zero-value struct returned from a constructor-like function on an error path.
- Data races — shared state written from more than one goroutine
without a mutex/channel; run
go test -racein CI and treat a race as a Blocker, not a flaky-test annoyance. - Context propagation — a long-running call (network I/O, retries)
that doesn't accept and respect a
context.Context, making it impossible for a caller to time out or cancel. - Error wrapping loses the original type — using
fmt.Errorf("%v", err)instead of%wwhere a caller might neederrors.Is/errors.As. - Exported API churn — a change to an exported type/function/field in this client library is a compatibility break for every consumer; flag it loudly even if the PR doesn't mention compatibility.
- Retry logic without backoff or a cap — a client retrying a failed call to the connector or to ClickHouse with no backoff/limit can turn a transient failure into sustained load.
Anti-Patterns
Ignored errors · unbounded goroutines with no cancellation · large
"kitchen sink" interfaces · mutating exported struct fields with no
accessor discipline where invariants need protecting · panics used for
ordinary error handling (reserve panic for truly unrecoverable
programmer errors).
Sources
Effective Go (go.dev/doc/effective_go) · Go Code Review Comments
(go.dev/wiki/CodeReviewComments) · go vet / staticcheck documentation.
Cross-References
pr-self-review, code-quality-architecture.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

