golang-how-to

golang-how-to

熱門

Golang 技能編排器 — 在任何 Golang 編碼、審查、除錯或設定任務中始終啟用。讀取任務上下文並從 samber/cc-skills-golang 載入最相關的技能,通常一次載入多個:撰寫 gRPC 服務時載入 golang-grpc + golang-testing + golang-error-handling;除錯 panic 時載入 golang-troubleshooting + golang-safety;稽核安全性時載入 golang-security + golang-lint + golang-safety。此外,當兩個技能看似重疊時(效能 vs 基準測試 vs 疑難排解、samber/lo vs mo vs ro、DI 叢集、安全性 vs 安全),進行消歧,並設定 CLAUDE.md 或 AGENTS.md 以在專案中強制觸發技能(/golang-how-to configure)。

2276星標
150分支
更新於 2026/6/6
SKILL.md
readonlyread-only
name
golang-how-to
description

Golang 技能編排器 — 在任何 Golang 編碼、審查、除錯或設定任務中始終啟用。讀取任務上下文並從 samber/cc-skills-golang 載入最相關的技能,通常一次載入多個:撰寫 gRPC 服務時載入 golang-grpc + golang-testing + golang-error-handling;除錯 panic 時載入 golang-troubleshooting + golang-safety;稽核安全性時載入 golang-security + golang-lint + golang-safety。此外,當兩個技能看似重疊時(效能 vs 基準測試 vs 疑難排解、samber/lo vs mo vs ro、DI 叢集、安全性 vs 安全),進行消歧,並設定 CLAUDE.md 或 AGENTS.md 以在專案中強制觸發技能(/golang-how-to configure)。

角色: 你是 Go 技能編排器。對於每個 Go 任務,識別所有相關技能並一起載入 — 任務很少只屬於單一技能。

模式:

  • 編排 — 對於任何 Go 編碼、審查、除錯或設定任務,同時載入主要技能及所有適用的次要技能。
  • 消歧 — 當兩個技能看似重疊時,顯示邊界表格。請參閱 disambiguation.md
  • 設定 — 在專案的 CLAUDE.mdAGENTS.md 中加入 ## Required Go skills 區塊。請遵循 project-config.md

技能載入

對於每個任務,同時載入主要技能及所有適用的次要技能。不要等待 — 在開始時就一起載入。

意圖 主要技能 同時載入
設計 API,選擇模式 golang-design-patterns golang-structs-interfaces, golang-naming
為型別、函式或套件命名 golang-naming golang-code-style
慣用地處理錯誤 golang-error-handling golang-safety(nil 密集型程式碼)
撰寫 goroutine、channel、同步 golang-concurrency golang-context(如果需要取消)
傳遞截止時間 / 取消操作 golang-context golang-concurrency(如果使用 goroutine)
設計 struct、嵌入、使用介面 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 相關的函式庫特定技能
查詢套件的文件、版本、匯入者或 CVE golang-pkg-go-dev golang-dependency-management
採用新的 Go 語言功能 golang-modernize golang-lint
使用 samber/lo(slice/map 輔助函式) 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-wiregolang-uber-diggolang-uber-fxgolang-samber-do

以上所有技能識別碼均為 samber/cc-skills-golang@<name> 的簡寫形式。

分類一覽

附有「使用時機」鉤子的完整目錄: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-pkg-go-dev 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

競爭叢集 — 邊界線

完整的邊界表格及路由範例:disambiguation.md

關鍵叢集及其擁有者:

  • 效能golang-performance(最佳化模式)· golang-benchmark(測量)· golang-troubleshooting(根因)· golang-observability(持續生產監控)
  • DIgolang-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
  • CLIgolang-cli(架構)· golang-spf13-cobra(指令樹)· golang-spf13-viper(設定分層)
  • 套件查詢golang-pkg-go-dev(查詢 pkg.go.dev 以取得現有路徑:版本/文件/符號/匯入者/CVE)· golang-popular-libraries(該採用哪個函式庫)· golang-dependency-management(管理 go.mod)· golang-security(全樹 CVE 掃描)
  • 間隙 — 型別 vs 架構golang-structs-interfaces(型別設計)vs golang-design-patterns(架構模式)
  • 間隙 — goroutine vs 取消golang-concurrency + golang-context — 當透過 context 取消 goroutine 時同時載入兩者
  • 間隙 — 正確性 vs 威脅golang-safety(內部錯誤)vs golang-security(外部威脅)
  • 間隙 — 功能 vs 規則golang-modernize(語言採用)vs golang-lint(靜態分析設定)

設定模式

在專案的 CLAUDE.mdAGENTS.md 中強制觸發特定技能,使其始終載入。

當以 /golang-how-to configure 呼叫時,請遵循 project-config.md


此技能並非詳盡無遺。請參閱個別技能檔案及官方 Go 文件以取得詳細指引。

如果您在此技能外掛程式中遇到錯誤或非預期行為,請在 https://github.com/samber/cc-skills-golang/issues 開啟問題。