go-style-guide

Enforce consistent Go coding standards for formatting, naming, and error handling.

1|Updated Nov 4, 2018
One-click install
npx skills add https://github.com/ryanmoran/workspace --skill go-style-guide-ryanmoran
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-style-guide
Source: https://github.com/ryanmoran/workspace/tree/main/skills/go-style-guide
Command: npx skills add https://github.com/ryanmoran/workspace --skill go-style-guide-ryanmoran

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured Go style guide to help teams write clear, idiomatic, and maintainable Go code. It consolidates Google's best practices for formatting, naming, error handling, interfaces, concurrency, and API design to reduce bikeshedding and improve readability across projects.

Core Features & Use Cases

  • Clarity and consistency: Enforces a common set of rules for formatting, naming, and error handling.
  • Code reviews and refactoring: Guides review decisions and refactorings to align with best practices.
  • Onboarding and API design: Accelerates onboarding and ensures consistent interfaces and patterns.

Quick Start

Apply the Go style guide to a sample Go file by running gofmt for formatting, review identifiers for MixedCaps naming, and wrap errors with fmt.Errorf("%w", err) to preserve error context.

Frequently Asked Questions about go-style-guide

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

FAQPage Schema
What are the standard Go naming conventions for clear and idiomatic code?

Standard Go naming conventions use MixedCaps for identifiers to ensure clear, idiomatic code. This style guide enforces consistent naming rules across packages, functions, and interfaces to improve readability and reduce bikeshedding.

How do I handle errors in Go while preserving context during refactoring?

To handle errors in Go while preserving context, wrap them with fmt.Errorf using the %w verb. This style guide provides actionable rules for error handling to maintain clarity and consistency across projects.

What is the best way to enforce a consistent Go coding standard across my projects?

The best way to enforce a consistent Go coding standard is by applying a structured style guide during code authoring and reviews. This guide consolidates rules for formatting, concurrency, and API design to produce maintainable code.

How do I use gofmt to format Go code for code reviews?

You use gofmt to format Go code by running it on your source files to enforce standard formatting. This style guide integrates gofmt compatibility rules to ensure code is mechanically formatted before reviews.

Does this Go style guide cover best practices for interfaces and concurrency?

Yes, this Go style guide covers best practices for interfaces and concurrency. It defines actionable rules for API design and concurrent processing to help teams write clear, idiomatic code.

When should I not use general Go style guide rules for API design?

You should not use general Go style guide rules for API design when your project requires highly specialized performance decisions or interface patterns. This guide focuses on standard idiomatic code rather than niche optimizations.