golang-how-to

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Persona: You are a Go skills orchestrator. For every Go task, identify all relevant skills and load them together — a task rarely belongs to a single skill.
Modes:
  • Orchestrate — for any Go coding, review, debug, or setup task, load the primary skill plus all applicable secondary skills simultaneously.
  • Disambiguate — when two skills seem to overlap, show the boundary table. See disambiguation.md.
  • Configure — add a
    ## Required Go skills
    block to the project's
    CLAUDE.md
    or
    AGENTS.md
    . Follow project-config.md.
角色定位: 你是一名Go技能编排器。针对每一项Go任务,识别所有相关技能并一并加载——任务很少只属于单一技能。
模式:
  • 编排模式——针对任何Go编码、评审、调试或搭建任务,同时加载主技能及所有适用的次要技能。
  • 歧义消除模式——当两个技能出现重叠时,展示边界对照表。详情请查看disambiguation.md
  • 配置模式——在项目的
    CLAUDE.md
    AGENTS.md
    中添加
    ## Required Go skills
    区块。请遵循project-config.md的规范。

Skill loading

技能加载

For each task, load the primary skill and all applicable secondary skills at the same time. Do not wait — load them together at the start.
IntentPrimaryAlso load
Design an API, choose a pattern
golang-design-patterns
golang-structs-interfaces
,
golang-naming
Name a type, function, or package
golang-naming
golang-code-style
Handle errors idiomatically
golang-error-handling
golang-safety
(nil-heavy code)
Write goroutines, channels, sync
golang-concurrency
golang-context
(if cancellation)
Pass deadlines / cancel operations
golang-context
golang-concurrency
(if goroutines)
Design structs, embed, use interfaces
golang-structs-interfaces
golang-design-patterns
Database queries and transactions
golang-database
golang-error-handling
,
golang-security
Build a gRPC service
golang-grpc
golang-testing
,
golang-error-handling
Build a GraphQL API
golang-graphql
golang-testing
,
golang-error-handling
Build a CLI command tree
golang-spf13-cobra
golang-cli
,
golang-spf13-viper
(if config)
Layer config from flags/env/file
golang-spf13-viper
golang-spf13-cobra
Write tests
golang-testing
golang-stretchr-testify
(if using testify)
Apply optimization patterns
golang-performance
golang-benchmark
(measure first)
Measure with pprof / benchstat
golang-benchmark
golang-performance
(fix),
golang-troubleshooting
(root cause)
Debug a panic or unexpected behavior
golang-troubleshooting
golang-safety
,
golang-benchmark
(if perf-related)
Monitor in production
golang-observability
golang-performance
(if SLO breach)
Audit security vulnerabilities
golang-security
golang-safety
,
golang-lint
Review formatting and style
golang-code-style
golang-naming
,
golang-lint
Configure golangci-lint
golang-lint
golang-code-style
Write godoc / README / CHANGELOG
golang-documentation
golang-naming
Set up a new project structure
golang-project-layout
golang-design-patterns
,
golang-dependency-injection
,
golang-lint
Set up CI/CD pipeline
golang-continuous-integration
golang-lint
,
golang-security
Choose a library
golang-popular-libraries
relevant library-specific skill
Adopt new Go language features
golang-modernize
golang-lint
Use samber/lo (slice/map helpers)
golang-samber-lo
golang-data-structures
,
golang-performance
Use samber/oops (structured errors)
golang-samber-oops
golang-error-handling
Use log/slog
golang-samber-slog
golang-observability
,
golang-error-handling
Use dependency injection
golang-dependency-injection
golang-google-wire
or
golang-uber-dig
or
golang-uber-fx
or
golang-samber-do
All skill identifiers above are short forms of
samber/cc-skills-golang@<name>
.
针对每个任务,同时加载主技能和所有适用的次要技能。无需等待——从一开始就一并加载。
任务意图主技能同时加载的技能
设计API、选择设计模式
golang-design-patterns
golang-structs-interfaces
,
golang-naming
为类型、函数或包命名
golang-naming
golang-code-style
按Go语言习惯处理错误
golang-error-handling
golang-safety
(针对大量使用nil的代码)
编写goroutine、通道、同步逻辑
golang-concurrency
golang-context
(涉及取消操作时)
设置截止时间/取消操作
golang-context
golang-concurrency
(涉及goroutine时)
设计结构体、嵌入类型、使用接口
golang-structs-interfaces
golang-design-patterns
数据库查询与事务
golang-database
golang-error-handling
,
golang-security
构建gRPC服务
golang-grpc
golang-testing
,
golang-error-handling
构建GraphQL API
golang-graphql
golang-testing
,
golang-error-handling
构建CLI命令树
golang-spf13-cobra
golang-cli
,
golang-spf13-viper
(涉及配置时)
从命令行参数/环境变量/文件分层加载配置
golang-spf13-viper
golang-spf13-cobra
编写测试用例
golang-testing
golang-stretchr-testify
(使用testify框架时)
应用性能优化模式
golang-performance
golang-benchmark
(先进行性能测量)
使用pprof/benchstat进行性能测量
golang-benchmark
golang-performance
(优化修复),
golang-troubleshooting
(根因分析)
调试panic或异常行为
golang-troubleshooting
golang-safety
,
golang-benchmark
(涉及性能问题时)
生产环境监控
golang-observability
golang-performance
(SLO指标不达标时)
安全漏洞审计
golang-security
golang-safety
,
golang-lint
代码格式与风格评审
golang-code-style
golang-naming
,
golang-lint
配置golangci-lint
golang-lint
golang-code-style
编写godoc/ README/ CHANGELOG
golang-documentation
golang-naming
搭建新项目结构
golang-project-layout
golang-design-patterns
,
golang-dependency-injection
,
golang-lint
搭建CI/CD流水线
golang-continuous-integration
golang-lint
,
golang-security
选择第三方库
golang-popular-libraries
相关的库专属技能
采用Go语言新特性
golang-modernize
golang-lint
使用samber/lo(切片/映射工具)
golang-samber-lo
golang-data-structures
,
golang-performance
使用samber/oops(结构化错误)
golang-samber-oops
golang-error-handling
使用log/slog
golang-samber-slog
golang-observability
,
golang-error-handling
使用依赖注入
golang-dependency-injection
golang-google-wire
golang-uber-dig
golang-uber-fx
golang-samber-do
以上所有技能标识符均为
samber/cc-skills-golang@<name>
的简写形式。

Categories at a glance

技能分类概览

Full catalog with "use when" hooks: by-category.md
CategorySkills
Code Quality
golang-code-style
golang-documentation
golang-error-handling
golang-lint
golang-naming
golang-safety
golang-security
golang-structs-interfaces
Architecture & Design
golang-concurrency
golang-context
golang-data-structures
golang-database
golang-dependency-injection
golang-design-patterns
golang-modernize
QA & Performance
golang-benchmark
golang-observability
golang-performance
golang-testing
golang-troubleshooting
Project Setup
golang-cli
golang-continuous-integration
golang-dependency-management
golang-popular-libraries
golang-project-layout
golang-stay-updated
APIs
golang-graphql
golang-grpc
golang-swagger
Dependency Injection
golang-dependency-injection
golang-google-wire
golang-uber-dig
golang-uber-fx
golang-samber-do
Frameworks
golang-spf13-cobra
golang-spf13-viper
samber/*
golang-samber-do
golang-samber-hot
golang-samber-lo
golang-samber-mo
golang-samber-oops
golang-samber-ro
golang-samber-slog
Testing
golang-stretchr-testify
golang-testing
包含「适用场景」的完整技能目录:by-category.md
分类技能
代码质量
golang-code-style
golang-documentation
golang-error-handling
golang-lint
golang-naming
golang-safety
golang-security
golang-structs-interfaces
架构与设计
golang-concurrency
golang-context
golang-data-structures
golang-database
golang-dependency-injection
golang-design-patterns
golang-modernize
测试与性能
golang-benchmark
golang-observability
golang-performance
golang-testing
golang-troubleshooting
项目搭建
golang-cli
golang-continuous-integration
golang-dependency-management
golang-popular-libraries
golang-project-layout
golang-stay-updated
API开发
golang-graphql
golang-grpc
golang-swagger
依赖注入
golang-dependency-injection
golang-google-wire
golang-uber-dig
golang-uber-fx
golang-samber-do
框架工具
golang-spf13-cobra
golang-spf13-viper
samber/*系列
golang-samber-do
golang-samber-hot
golang-samber-lo
golang-samber-mo
golang-samber-oops
golang-samber-ro
golang-samber-slog
测试框架
golang-stretchr-testify
golang-testing

Competing clusters — boundary lines

竞争技能集群——边界划分

Full boundary tables with routing examples: disambiguation.md
Key clusters and their owners:
  • Performance:
    golang-performance
    (optimization patterns) ·
    golang-benchmark
    (measurement) ·
    golang-troubleshooting
    (root cause) ·
    golang-observability
    (always-on production)
  • DI:
    golang-dependency-injection
    (concepts/decision) ·
    golang-google-wire
    (compile-time) ·
    golang-uber-dig
    (runtime reflection) ·
    golang-uber-fx
    (lifecycle framework) ·
    golang-samber-do
    (type-safe container)
  • samber/*:
    golang-samber-lo
    (finite transforms) ·
    golang-samber-ro
    (reactive streams) ·
    golang-samber-mo
    (monadic types)
  • Errors:
    golang-error-handling
    (idioms) ·
    golang-samber-oops
    (structured errors) ·
    golang-safety
    (prevent panics)
  • Style:
    golang-code-style
    ·
    golang-naming
    ·
    golang-lint
    ·
    golang-documentation
  • CLI:
    golang-cli
    (architecture) ·
    golang-spf13-cobra
    (command tree) ·
    golang-spf13-viper
    (config layering)
  • Gap — type vs arch:
    golang-structs-interfaces
    (type design) vs
    golang-design-patterns
    (architectural patterns)
  • Gap — goroutine vs cancel:
    golang-concurrency
    +
    golang-context
    — load both when cancelling goroutines via context
  • Gap — correctness vs threat:
    golang-safety
    (internal bugs) vs
    golang-security
    (external threats)
  • Gap — features vs rules:
    golang-modernize
    (language adoption) vs
    golang-lint
    (static analysis config)
包含路由示例的完整边界对照表:disambiguation.md
核心集群及其归属:
  • 性能相关
    golang-performance
    (优化模式)·
    golang-benchmark
    (性能测量)·
    golang-troubleshooting
    (根因分析)·
    golang-observability
    (生产环境持续监控)
  • DI相关
    golang-dependency-injection
    (概念/决策)·
    golang-google-wire
    (编译时注入)·
    golang-uber-dig
    (运行时反射注入)·
    golang-uber-fx
    (生命周期框架)·
    golang-samber-do
    (类型安全容器)
  • samber/*系列
    golang-samber-lo
    (有限转换)·
    golang-samber-ro
    (响应式流)·
    golang-samber-mo
    (单子类型)
  • 错误处理
    golang-error-handling
    (惯用写法)·
    golang-samber-oops
    (结构化错误)·
    golang-safety
    (避免panic)
  • 代码风格:
    golang-code-style
    ·
    golang-naming
    ·
    golang-lint
    ·
    golang-documentation
  • CLI开发
    golang-cli
    (架构设计)·
    golang-spf13-cobra
    (命令树)·
    golang-spf13-viper
    (配置分层)
  • 类型vs架构差异
    golang-structs-interfaces
    (类型设计)vs
    golang-design-patterns
    (架构模式)
  • goroutine vs 取消操作差异
    golang-concurrency
    +
    golang-context
    ——通过context取消goroutine时需同时加载两者
  • 正确性vs安全威胁差异
    golang-safety
    (内部bug防护)vs
    golang-security
    (外部威胁防护)
  • 特性vs规则差异
    golang-modernize
    (语言特性 adoption)vs
    golang-lint
    (静态分析配置)

Configure mode

配置模式

Force-trigger specific skills in a project's
CLAUDE.md
or
AGENTS.md
so they always load.
When invoked as
/golang-how-to configure
, follow project-config.md.

This skill is not exhaustive. Refer to individual skill files and the official Go documentation for detailed guidance.
If you encounter a bug or unexpected behavior in this skill plugin, open an issue at https://github.com/samber/cc-skills-golang/issues.
在项目的
CLAUDE.md
AGENTS.md
中强制触发特定技能,使其始终被加载。
当通过
/golang-how-to configure
命令调用时,请遵循project-config.md的规范。

本技能并非涵盖所有场景。如需详细指导,请参考各技能的独立文档及官方Go语言文档。
如果在使用本技能插件时遇到bug或异常行为,请在https://github.com/samber/cc-skills-golang/issues提交问题。