Best for
- Code contains error return values
- Code uses panic / recover
- Code involves sql.Rows, transactions, connection pools
johnqtcg/awesome-skills/skills/go-error-review/SKILL.md
Review Go code for error handling correctness, nil safety, and failure-path integrity including ignored errors, missing wrapping, panic misuse, SQL/HTTP resource lifecycle, and transaction patterns. Trigger when code contains error returns, panic calls, sql.Rows, transactions, HTTP client/server code, or nil-sensitive pointer operations. Use for error-handling and correctness-focused review.
Decision brief
Review Go code for error handling correctness, nil safety, and failure-path integrity including ignored errors, missing wrapping, panic misuse, SQL/HTTP resource lifecycle, and transaction patterns. Trigger when code contains error returns, panic calls, sql.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/johnqtcg/awesome-skills --skill "skills/go-error-review"Inspect the Agent Skill "go-error-review" from https://github.com/johnqtcg/awesome-skills/blob/d63cf368c1b106871b56454bd73c293701bef500/skills/go-error-review/SKILL.md at commit d63cf368c1b106871b56454bd73c293701bef500. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1. Define scope — files/diff under review. Apply Generated Code Exclusion Gate. 2. Gather evidence — read changed files, identify error-handling patterns: if err != nil, =, panic(, sql.Rows, tx., resp.Body, []T. 3. Load references — always load go-error-and-quality.md (error sec…
Error handling, nil safety, failure-path integrity only — not security, concurrency, performance, style, tests, or logic
Audit Go code for error handling correctness, nil safety, and failure-path integrity. Core question for every function call: "What happens when it fails?"
Code contains error return values
Security vulnerabilities → go-security-review
Permission review
The documentation asks the agent to run terminal commands or scripts.
Never claim tests ran unless they actually did. If not run: state reason + exact command.The documentation asks the agent to read local files, directories, or repositories.
**"defer f.Close() ignoring error"** — acceptable for **read-only** file opens. Flag only for **write** operations where Close flushes buffered data.The documentation asks the agent to run terminal commands or scripts.
`go test`: PASS | FAIL | Not run (reason + command)Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 30 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Audit Go code for error handling correctness, nil safety, and failure-path integrity. Core question for every function call: "What happens when it fails?"
This skill merges error handling + API request/response correctness + database operation correctness because they share one review lens: "does this code handle failure correctly?"
This skill does NOT cover: security vulnerabilities, concurrency safety, performance, code style, test quality, or business logic — those belong to sibling vertical skills.
panic / recoversql.Rows, transactions, connection pools[]*T pointer slicesgo-security-reviewgo-concurrency-reviewgo-performance-reviewgo-quality-reviewgo-logic-reviewNever claim tests ran unless they actually did. If not run: state reason + exact command.
Read go.mod. Key features:
errors.Is / errors.As (Go 1.13+)errors.Join (Go 1.20+)fmt.Errorf with multiple %w (Go 1.20+)MUST quote specific code evidence. Category match alone insufficient.
Embedded anti-examples:
json.Marshal on such structs always returns nil error."create user: insert user: insert row: ...". Cite the caller's wrapping code.== against sentinel from the same package is acceptable. Cross-package comparison must use errors.Is.Exclude: *.pb.go, *_gen.go, mock_*.go. Note excluded files in Execution Status.
if err != nil, _ =, panic(, sql.Rows, tx., resp.Body, []*T.go-error-and-quality.md (error sections); load go-api-http-checklist.md when net/http code present; load go-database-patterns.md when database code present.This skill uses mechanical grep pre-scanning to guarantee zero missed checklist items. The model's attention is reserved for semantic judgment on grep hits and semantic-only items.
$TMPDIR/review_snippet.go)Include in Execution Status: Grep pre-scan: X/12 items hit, Z confirmed as findings
Some items require two grep patterns. Run both:
log\.\|slog\. HIT AND return.*err HIT in same file| # | Item | Code Pattern Triggers | Grep Pattern |
|---|---|---|---|
| 1 | Ignored error | _ = or _ := on error-returning calls. Acceptable only for hash.Write, known-safe fmt.Fprintf to buffer | _\s*[:=]= |
| 2 | Missing error wrapping | return err without fmt.Errorf("context: %w", err) at abstraction boundary | return\s+(nil,\s*)?err\b |
| 3 | Panic misuse | panic() for recoverable errors. Acceptable only in init() or unrecoverable invariant violation | panic\( |
| 4 | Missing errors.Is/As | Direct == on error for cross-package sentinel; type switch instead of errors.As | err\s*[!=]=\s*|[!=]=\s*err |
| 5 | Pointer slice nil guard | []*T elements accessed without nil check before field/method access | \[\]\*\w |
| # | Item | Code Pattern Triggers | Grep Pattern |
|---|---|---|---|
| 6 | Unbounded server body | Missing http.MaxBytesReader / io.LimitReader on body decode. Do NOT require r.Body.Close() — framework handles it | r\.Body|Request\.Body|ReadAll |
| 7 | Client response body leak | resp.Body not closed on ALL paths including error path — prevents connection reuse | resp\.Body|Response\.Body |
| 8 | HTTP status code mismatch | 200 for creation (should be 201), 500 for not-found (should be 404) | WriteHeader|StatusCode|http\.Status |
| # | Item | Code Pattern Triggers | Grep Pattern |
|---|---|---|---|
| 9 | Unclosed sql.Rows | Missing defer rows.Close() AFTER error check; missing rows.Err() after iteration loop | \.Query[^R]|\.QueryRow|sql\.Rows |
| 10 | Wrong transaction rollback pattern | Missing defer tx.Rollback() + Commit override pattern | \.Begin\(|tx\. |
| 11 | sql.ErrNoRows mishandled | Treating as server error (500) instead of domain "not found" (404) | ErrNoRows |
| 12 | Log-and-return double reporting | Logging error AND returning it — causes duplicate log entries upstream | log\.|slog\. (compound: ALSO check return.*err in same file) |
High — Resource leak, crash, silent failure, data inconsistency.
Medium — Suboptimal error handling that makes debugging harder but no immediate failure.
path:linemust-fix | follow-upGo version: X.YGrep pre-scan: X/12 items hit, Z confirmed as findingsgo test: PASS | FAIL | Not run (reason + command)Excluded (generated): list or NoneReferences loaded: list1-2 lines with finding count.
### Findings
#### [High] Response Body Leak in HTTP Client
- **ID:** ERR-001
- **Location:** `internal/client/api.go:45`
- **Impact:** Connection pool exhaustion — resp.Body not closed on error path
- **Evidence:** `resp, err := client.Do(req)` at L42; if `resp.StatusCode != 200` at L44, function returns error at L46 without closing resp.Body. Body only closed on happy path at L52.
- **Recommendation:** Move defer immediately after nil-error check:
```go
resp, err := client.Do(req)
if err != nil { return err }
defer resp.Body.Close()
internal/repo/order.go:78for rows.Next() { ... } loop at L73-80 exits without checking rows.Err()if err := rows.Err(); err != nil { return nil, fmt.Errorf("iterating orders: %w", err) }json.Marshal(config) at config.go:30 — config is AppConfig struct with only primitive fields. Anti-example: "known-safe struct with no interface fields"2 High findings (response body leak, missing rows.Err). No Medium findings.
## No-Finding Case
If no issues found: state `No error handling findings identified.` Still output Execution Status.
## Load References Selectively
| Reference | Load When |
|-----------|-----------|
| `references/go-error-and-quality.md` | Always (error handling sections) |
| `references/go-api-http-checklist.md` | Code involves net/http, handlers, gin/echo/chi, gRPC |
| `references/go-database-patterns.md` | Code involves database/sql, pgx, sqlx, gorm, ent |
| `references/go-review-anti-examples.md` | Always |
## Review Discipline
- **Error handling, nil safety, failure-path integrity only** — not security, concurrency, performance, style, tests, or logic
- For every function call: **"what happens when it fails?"**
- Execute ALL 12 checklist items without skipping
- Server handler `r.Body`: do NOT require manual Close (framework handles it)
- Client `resp.Body`: MUST be closed on all paths
Frequently asked questions
Review Go code for error handling correctness, nil safety, and failure-path integrity including ignored errors, missing wrapping, panic misuse, SQL/HTTP resource lifecycle, and transaction patterns. Trigger when code contains error returns, panic calls, sql.
The source record exposes this install command: npx skills add https://github.com/johnqtcg/awesome-skills --skill "skills/go-error-review". Inspect the command and pinned source before running it.
Static rules flagged exec-script, read-files in the source; the page lists the matching lines and excerpts.
Alternatives
K-Dense-AI/scientific-agent-skills
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.
getcargohq/cargo-skills
Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: "run this on all my contacts", "execute the action", "kick off a batch", "build a workflow", "schedule a play", "make it run every morning", "ask the agent",
NVIDIA/skills
Use this skill when the user wants to deploy, run, debug, tear down, or call the REST API of the RTVI-CV 2D detection / tracking microservice. Trigger when the user says things like 'deploy rtvi-cv', 'start warehouse 2d', 'add a stream', 'check rtvi-cv health', or 'stop the perception container'. Not for VLM, embedding, or analytics — use the matching vss-* skill.
UiPath/skills
UiPath Coded Apps — scaffold, build, run, and deploy Coded Web Apps and Coded Action Apps: React/TypeScript apps that call UiPath Cloud APIs via the `@uipath/uipath-typescript` SDK and ship to Automation Cloud (push/pull to Studio Web, pack, publish, deploy, OAuth-PKCE). Also generates live analytics & governance dashboards from a plain-language request, wired to tenant data via the Insights real-time API, with edit and deploy flows. For RPA→uipath-rpa, Python agents→uipath-agents, Maestro flows