go-best-practices

Audit Go code for architecture, style, and concurrency correctness.

13|3|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/danicat/skills --skill go-best-practices-danicat
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-best-practices
Source: https://github.com/danicat/skills/tree/main/go-best-practices
Command: npx skills add https://github.com/danicat/skills --skill go-best-practices-danicat

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps teams prevent common and costly Go engineering issues by enforcing architectural rules, consistent style, and concurrency-safe patterns during audits, refactors, and reviews.

Core Features & Use Cases

  • Architecture guardrails: Enforces NO pkg/, encourages a flat-by-default structure, and promotes standard Go project layout (with internal/ and cmd/ usage).
  • Style and quality enforcement: Directs users to check style_cheatsheet.md first and apply senior-grade feedback using senior_review_checklist.md.
  • Concurrency safety: Requires goroutine lifecycle clarity (Context, WaitGroup) and recommends errgroup for parallel work.
  • Workflow for actionability: Provides stepwise guidance for audit, refactor, and review, plus domain-specific references for HTTP services, advanced testing, linting, Ebitengine, and Go idioms.
  • Use cases: Ideal for “audit and fix” requests on existing Go repos, preparing PRs for senior review, or refactoring code to remove architectural violations like a disallowed pkg/ directory.

Quick Start

Use the go-best-practices skill to review a Go repository for disallowed architecture patterns and concurrency risks.

Frequently Asked Questions about go-best-practices

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

FAQPage Schema
How do I review Go code for concurrency safety and goroutine leaks?

To review Go code for concurrency safety, enforce goroutine lifecycle clarity using Context and WaitGroup, validate exit conditions, and recommend errgroup for parallel execution to prevent leaks. This ensures production readiness during audits and PR reviews.

What is the best way to refactor a Go project to remove a disallowed pkg/ directory?

The best way to refactor a Go project removing pkg/ is enforcing a flat-by-default structure and migrating code into standard internal/ and cmd/ directories. This architectural guardrail prevents common layout violations and prepares repositories for senior review.

How do I enforce senior-grade code review standards for HTTP services in Golang?

To enforce senior-grade code review standards for Golang HTTP services, consult a senior review checklist and style cheatsheet to audit architecture, validate concurrency correctness, and ensure consistent project layout before merging production code.

Can I use this approach to audit existing Go repositories for architectural violations?

Yes, you can audit existing Go repositories for architectural violations by applying stepwise guidance to identify disallowed patterns, check style compliance, and validate goroutine exit conditions for immediate refactoring and production readiness.

Why does my Go service hang during parallel execution despite using errgroup?

A Go service might hang during parallel execution if goroutine exit conditions lack clear Context or WaitGroup lifecycle management. Validating goroutine hygiene and errgroup-compatible practices resolves deadlocks and ensures safe concurrent execution.