golang-code-style

Enforce idiomatic Go code style and clarity across source files.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/tamago0224/kuroshio-mta --skill golang-code-style-tamago0224
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-code-style
Source: https://github.com/tamago0224/kuroshio-mta/tree/main/.agents/skills/golang-code-style
Command: npx skills add https://github.com/tamago0224/kuroshio-mta --skill golang-code-style-tamago0224

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Reduce inconsistent, unclear, or non-idiomatic Go code by providing concise style guidance and actionable recommendations that improve readability, maintainability, and review quality across a codebase.

Core Features & Use Cases

  • Guideline summary for formatting, naming, control flow, function design, and composite literal usage to make code more predictable and easier to review.
  • Practical rules: prefer gofmt/gofumpt style, break long calls at semantic boundaries, use := vs var appropriately, initialize slices/maps to non-nil, prefer early returns and switch over long if-else chains, and keep functions focused with reasonable parameter counts.
  • Integrates with linters and review workflows: use when writing code, performing PR reviews, configuring lint rules, or training team conventions.
  • Use Case: run during a code review to produce a prioritized list of style issues and suggested fixes with explanations suited for developer education.

Quick Start

Ask the golang-code-style skill to review a Go file and list recommended stylistic changes with concise explanations.

Frequently Asked Questions about golang-code-style

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

FAQPage Schema
How do I enforce consistent Go code style and readability across my project?

Enforce Go code style by applying idiomatic rules for formatting, variable usage, and early returns. Prioritize gofmt or gofumpt style, break long calls at semantic boundaries, and use linters to automate consistency checks during code reviews.

What are the best practices for writing idiomatic Go code with proper control flow?

Best practices for idiomatic Go code include preferring early returns over deep nesting, using switch statements instead of long if-else chains, and initializing slices and maps to non-nil to ensure predictable behavior and readability.

How do I review a Go file for non-idiomatic code and get suggested fixes?

Review a Go file by checking it against established style guidelines for naming, composite literal usage, and function parameter counts. This produces a prioritized list of stylistic issues with concise explanations and suggested fixes for developer education.

Can I use this to configure linters for team code conventions in Golang?

Yes, you can use these style guidelines to configure linters and establish team conventions. It provides actionable recommendations for nil-safe slice initialization, proper := vs var usage, and line breaking that integrate directly into review workflows.

Does this Go code style guidance work without external dependencies?

Yes, the guidance operates without external dependencies, focusing solely on source file clarity. It relies on standard Go formatting principles and practical rules like semantic line breaking and focused function design to improve maintainability.

Why should I use early returns and semantic line breaks in Go source files?

Use early returns and semantic line breaks in Go source files to reduce inconsistent and unclear code. These practices make functions more predictable, prevent deep nesting, and significantly improve readability and review quality across the codebase.