golang-style

Enforce Go coding conventions including error wrapping and godoc-style comments.

253|7|Updated Apr 8, 2016
One-click install
npx skills add https://github.com/fredrikaverpil/dotfiles --skill golang-style
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-style
Source: https://github.com/fredrikaverpil/dotfiles/tree/main/stow/shared/.claude/skills/golang-style
Command: npx skills add https://github.com/fredrikaverpil/dotfiles --skill golang-style

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces idiomatic Go practices, clear error handling, and documented APIs to improve code quality.

Core Features & Use Cases

  • Happy Path Coding: Encourage straightforward, non-nested main logic.
  • Error Wrapping: Enforce wrapping with context using %w
  • Documentation: Encourage proper comments and godoc-style documentation.

Quick Start

Start a new Go file with proper error handling and comments, then run the style checks to verify conventions

Frequently Asked Questions about golang-style

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

FAQPage Schema
How do I enforce Go coding conventions across my project?

Enforce Go coding conventions by applying style checks that verify happy-path logic, error wrapping with %w, sentinel errors, godoc comments, line length caps at 120 characters, and proper naming conventions before writing or editing .go files.

What's the best way to handle errors in Go code?

Wrap errors with context using %w to preserve the error chain, define package-level sentinel errors for specific conditions, and avoid nested error-handling logic by structuring code around the happy path.

How do I document Go code properly with godoc?

Write godoc-style comments starting with the function or package name, end all comments with periods, and use `go doc` for documentation lookup to ensure your API is properly documented and discoverable.

Can I use this with existing Go projects to improve code quality?

Yes, apply the style checks to existing .go files to enforce consistent Go conventions, catch quality issues like shadowed identifiers and improper error handling, and standardize documentation across your codebase.

What Go naming and formatting rules does this enforce?

This enforces Go naming conventions, avoids shadowing predeclared identifiers, enforces a 120-character line-length limit, requires period-ending comments, and ensures happy-path code structure throughout your project.