golang-style

Enforce Go best practices including error wrapping and godoc comments.

6|1|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/czyt/claude-skills --skill golang-style-czyt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-style
Source: https://github.com/czyt/claude-skills/tree/main/skills/golang-style
Command: npx skills add https://github.com/czyt/claude-skills --skill golang-style-czyt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures Go code adheres to best practices, improving code quality, maintainability, and consistency across projects.

Core Features & Use Cases

  • Happy Path Coding: Structures code for clear, linear execution flow.
  • Error Handling: Enforces context-aware error wrapping and the use of sentinel errors.
  • Documentation: Promotes godoc-style comments for all functions and types.
  • Naming Conventions: Prevents shadowing of Go's predeclared identifiers.
  • Line Length: Enforces a maximum line length for readability.
  • Use Case: When writing new Go functions or refactoring existing ones, this skill will guide you to implement them according to established Go idioms.

Quick Start

Apply the golang-style skill to review and refactor the provided Go code snippet for adherence to best practices.

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 standards for error handling and happy path coding?

To enforce Go coding standards, apply rules for happy path coding, sentinel errors, and context-aware error wrapping using the %w verb. This ensures clear execution flow and proper error context across all .go files.

What is the best way to prevent shadowing predeclared identifiers in Go source files?

Preventing shadowing of predeclared identifiers requires enforcing strict naming conventions during code review. This practice avoids naming collisions and unexpected behavior by checking all new Go functions and types.

How do I format Go code to comply with a 120-character line limit and godoc-style comments?

Formatting Go code to a 120-character line limit involves checking line lengths and promoting godoc-style comments for all functions and types. Using the go doc command for lookups ensures documentation aligns with established Go idioms.

How do I refactor existing Go code to follow established best practices and maintainability?

Refactoring existing Go code for maintainability involves restructuring for linear happy path execution, wrapping errors with context, and adding godoc comments. This process applies established idioms to improve code quality and consistency.

Does this Go code review approach work with all .go files in a project?

Yes, this Go code review approach applies to all .go source files within a project. It uniformly enforces coding standards, error handling rules, and documentation requirements across the entire codebase for consistent quality.