go

Generate idiomatic Go code with error handling, concurrency, and table-driven tests.

1|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/tho/skills --skill go-tho
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go
Source: https://github.com/tho/skills/tree/main/skills/go
Command: npx skills add https://github.com/tho/skills --skill go-tho

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you produce maintainable, idiomatic Go code and reviews by enforcing consistent standards for structure, correctness, performance, and safety.

Core Features & Use Cases

  • Go code quality guardrails: clear conventions on naming, formatting, dependency choices, and project layout (modules, cmd/internal separation).
  • Modern Go idioms & lifecycle rules: error wrapping, logging guidance, concurrency practices (goroutine shutdown, context usage), and security constraints (no secrets, safe input handling).
  • Testing rigor: table-driven tests, red/green TDD expectations, race-safe execution, fuzzing for untrusted input, and integration test skipping patterns.

Quick Start

Use the go skill when you need the AI to write, review, or refactor Go code that follows modern standards and solid testing/error-handling practices.

Frequently Asked Questions about go

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle errors safely in Go using fmt.Errorf and errors.Is?

Safe error handling in Go requires wrapping errors with fmt.Errorf using the %w verb, then checking specific error types using errors.Is and errors.As. This approach preserves the original error chain for accurate upstream evaluation.

What is the best way to manage goroutine lifecycle and context cancellation in Go concurrency?

Goroutine lifecycle management in Go requires explicit context cancellation and structured shutdown procedures. Passing contexts ensures concurrent operations terminate cleanly, preventing leaks and race conditions during process exit.

How do I write table-driven tests in Go that execute race-safe?

Table-driven tests in Go use structs to define input and expected output cases, executing them via t.Run subtests. Running tests with the -race flag ensures concurrent operations remain safe from data races.

Does Go structured logging with log/slog work well for HTTP services?

Structured logging with log/slog integrates directly into modern Go HTTP services. It provides key-value paired log outputs, replacing standard log dependencies for better filtering and consistent service observability.

When do I need to run govulncheck for Go security checks?

Run govulncheck during Go testing and CI pipelines to detect known vulnerabilities in module dependencies. It analyzes code paths to ensure untrusted inputs and dependencies do not expose security risks.

Why does Go code review focus on gofmt formatting and module usage?

Go code review enforces gofmt formatting and proper module usage to guarantee consistency across project layouts. Separating cmd and internal directories ensures clear dependency boundaries and maintainable structure.