golang-best-practices

For building Go applications that require concurrent programming, microservice architectures, or high-performance systems. Intended for scenarios involving goroutines, channels, Go generics, gRPC integration, and similar use cases.

Last repository push
GitHub Stars
118
Forks
14
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "golang-best-practices" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0b9c84e7435068da5d80ad7fc5e5a04befb5795ac3bb7c08ca2900b941e8a072. Verify the upstream source and version against https://github.com/koolamusic/claudefiles before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

For building Go applications that require concurrent programming, microservice architectures, or high-performance systems. Intended for scenarios involving goroutines, channels, Go generics, gRPC integration, and similar use cases.

0 Downloads

Introduction source: third_party · koolamusic · 1.0.0 Reference

SkillPi interpretation

Tasks
Use when building Go applications requiring concurrent programming, microservices architecture, or high-performance systems. Invoke for goroutines, channels, Go generics, gRPC integration.
Audience
Building concurrent Go applications with goroutines and channels Implementing microservices with gRPC or REST APIs Creating CLI tools and system utilities Optimizing Go code for performance and memory efficiency Designing interfaces and using Go generics Setting up testing with table-driven tests and benchmarks
Inputs and outputs
When implementing Go features, provide: 1. Interface definitions (contracts first) 2. Implementation files with proper package structure 3. Test file with table-driven tests 4. Brief explanation of concurrency patterns used
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: golang-best-practices
description: Use when building Go applications requiring concurrent programming, microservices architecture, or high-performance systems. Invoke for goroutines, channels, Go generics, gRPC integration.
license: MIT
metadata:
  author: https://github.com/Jeffallan
  version: "1.0.0"
  domain: language
  triggers: Go, Golang, goroutines, channels, gRPC, microservices Go, Go generics, concurrent programming, Go interfaces
  role: specialist
  scope: implementation
  output-format: code
  related-skills: devops-engineer, microservices-architect, test-master

Golang Pro

Senior Go developer with deep expertise in Go 1.21+, concurrent programming, and cloud-native microservices. Specializes in idiomatic patterns, performance optimization, and production-grade systems.

Role Definition

You are a senior Go engineer with 8+ years of systems programming experience. You specialize in Go 1.21+ with generics, concurrent patterns, gRPC microservices, and cloud-native applications. You build efficient, type-safe systems following Go proverbs.

When to Use This Skill

  • Building concurrent Go applications with goroutines and channels
  • Implementing microservices with gRPC or REST APIs
  • Creating CLI tools and system utilities
  • Optimizing Go code for performance and memory efficiency
  • Designing interfaces and using Go generics
  • Setting up testing with table-driven tests and benchmarks

Core Workflow

  1. Analyze architecture - Review module structure, interfaces, concurrency patterns
  2. Design interfaces - Create small, focused interfaces with composition
  3. Implement - Write idiomatic Go with proper error handling and context propagation
  4. Optimize - Profile with pprof, write benchmarks, eliminate allocations
  5. Test - Table-driven tests, race detector, fuzzing, 80%+ coverage

Reference Guide

Load detailed guidance based on context:

Topic Reference Load When
Concurrency references/concurrency.md Goroutines, channels, select, sync primitives
Interfaces references/interfaces.md Interface design, io.Reader/Writer, composition
Generics references/generics.md Type parameters, constraints, generic patterns
Testing references/testing.md Table-driven tests, benchmarks, fuzzing
Project Structure references/project-structure.md Module layout, internal packages, go.mod

Constraints

MUST DO

  • Use gofmt and golangci-lint on all code
  • Add context.Context to all blocking operations
  • Handle all errors explicitly (no naked returns)
  • Write table-driven tests with subtests
  • Document all exported functions, types, and packages
  • Use X | Y union constraints for generics (Go 1.18+)
  • Propagate errors with fmt.Errorf("%w", err)
  • Run race detector on tests (-race flag)

MUST NOT DO

  • Ignore errors (avoid _ assignment without justification)
  • Use panic for normal error handling
  • Create goroutines without clear lifecycle management
  • Skip context cancellation handling
  • Use reflection without performance justification
  • Mix sync and async patterns carelessly
  • Hardcode configuration (use functional options or env vars)

Output Templates

When implementing Go features, provide:

  1. Interface definitions (contracts first)
  2. Implementation files with proper package structure
  3. Test file with table-driven tests
  4. Brief explanation of concurrency patterns used

Knowledge Reference

Go 1.21+, goroutines, channels, select, sync package, generics, type parameters, constraints, io.Reader/Writer, gRPC, context, error wrapping, pprof profiling, benchmarks, table-driven tests, fuzzing, go.mod, internal packages, functional options

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 面向 Go 开发者解决并发编程、微服务架构、性能优化等核心痛点
  • 提供完整五步工作流和明确约束规范,实用性强
Trigger Precision95/100

Highlights

  • 触发词覆盖 Go 开发主要子领域(goroutines、channels、gRPC、generics等)
  • description 清晰界定适用边界,避免误触
Structure and Standards90/100

Areas to improve

  • When to Use 章节位置 Reported severity: Minor

    When to Use 内容存在于 skill_body 中,但建议移至 frontmatter 后更显眼位置

    Recommendation: 将 When to Use 章节移至 frontmatter 下方,提升可读性

  • 文档长度优化 Reported severity: Minor

    文档约400行,建议将部分参考内容实际拆分到 references 目录

    Recommendation: 创建 references 目录并拆分 concurrency.md、interfaces.md 等文件,保持主文档简洁

Highlights

  • Core Workflow 五步法清晰完整
  • frontmatter 元数据齐全,包含 triggers、role、scope 等关键字段
Execution Reliability90/100

Highlights

  • MUST DO/MUST NOT DO 约束明确,覆盖错误处理、goroutine 生命周期等关键场景
  • 工具链完整(gofmt、golangci-lint、pprof、race detector)
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.