go

Provide Go coding best practices for reviews, error handling, testing, and style.

1|Updated Oct 23, 2021
One-click install
npx skills add https://github.com/taiidani/dotfiles --skill go-taiidani
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go
Source: https://github.com/taiidani/dotfiles/tree/main/.opencode/skills/go
Command: npx skills add https://github.com/taiidani/dotfiles --skill go-taiidani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill offers concise guidance on Go coding best practices, helping developers write clean, maintainable, and reliable Go code.

Core Features & Use Cases

  • Clarity over cleverness: Encourages readable code.
  • Error handling: Promotes explicit error checks and wrapping.
  • Testing: Recommends table‑driven tests and using go vet, go test, etc.
  • Style: Advises on formatting, context usage, and avoiding global mutable state.
  • Use case: When a developer requests a code review or wants advice on Go project structure.

Quick Start

Ask the go skill for best‑practice tips before writing your next Go function.

Frequently Asked Questions about go

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

FAQPage Schema
What are the best practices for error handling in Go?

Go error handling best practices recommend explicit error checks and wrapping. You should prioritize clarity over cleverness by handling errors directly where they occur and utilizing error wrapping to maintain context across function calls.

How do I write table-driven tests in Go?

Table-driven tests in Go use standard tooling like go test and go vet. You should structure test cases in slices, iterate over them to execute test logic, and rely on go vet to catch suspicious constructs during your testing workflow.

Does this Go code review guidance enforce standard formatting rules?

This Go code review guidance advises on style conventions and formatting. It emphasizes using standard Go tooling such as fmt to ensure code formatting compliance and advises on proper context usage while avoiding global mutable state.

How should I structure my Go project for maintainability?

For maintainable Go projects, this guidance encourages readable code and clear project structure. It promotes avoiding global mutable state, utilizing context properly, and following standard Go style conventions during code reviews.

What is the best way to handle context usage in Go projects?

The best way to handle context usage in Go is to pass context explicitly through your function calls. This guidance advises on proper context implementation to manage timeouts and cancellations while avoiding global mutable state.