golang-best-practices

适用于构建需要并发编程、微服务架构或高性能系统的 Go 应用程序。用于 goroutine、channel、Go 泛型、gRPC 集成等场景。

仓库最近推送
GitHub Stars
118
Forks
14
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "golang-best-practices":https://skillpi.com/zh/skills/deepskill-0b9c84e7435068da5d80ad7fc5e5a04befb5795ac3bb7c08ca2900b941e8a072。安装前核对上游来源和版本:https://github.com/koolamusic/claudefiles。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

适用于构建需要并发编程、微服务架构或高性能系统的 Go 应用程序。用于 goroutine、channel、Go 泛型、gRPC 集成等场景。

0 下载

介绍来源: third_party · koolamusic · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
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

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

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

亮点

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

待提升项

  • When to Use 章节位置 原报告严重程度:轻微

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

    改进建议:将 When to Use 章节移至 frontmatter 下方,提升可读性

  • 文档长度优化 原报告严重程度:轻微

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

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

亮点

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

亮点

  • MUST DO/MUST NOT DO 约束明确,覆盖错误处理、goroutine 生命周期等关键场景
  • 工具链完整(gofmt、golangci-lint、pprof、race detector)
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

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

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • github.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。