Skill go-dev
Menerapkan standar pengembangan Go termasuk konvensi penamaan, error handling, pola concurrency, dan praktik testing.
- Bintang GitHub
- 1.061
- File
- 3
- Commit terakhir
- 26 Agu 2026
- Lisensi
- —
- Tool yang diizinkan
- —
Apa fungsi skill go-dev?
Menerapkan standar pengembangan Go termasuk konvensi penamaan, error handling, pola concurrency, dan praktik testing.
Ringkasan dibuat dari SKILL.md skill ini.
Tentang skill go-dev
Skill ini memungkinkan Anda menjaga kualitas codebase Go melalui kepatuhan ketat terhadap standar industri. Developer dapat menggunakannya untuk menegakkan konvensi penamaan tertentu, pola error handling, dan keamanan concurrency pada file .go, go.mod, dan go.sum. Saat agent memuat skill ini, ia akan bertindak sebagai reviewer spesialis yang memastikan kode mengikuti panduan Effective Go dan Uber Go.
Skill ini mengintegrasikan perintah toolchain esensial seperti goimports untuk formatting, go vet untuk static analysis, dan golangci-lint untuk pengecekan komprehensif. Skill ini juga mengelola protokol testing dengan memanfaatkan go test menggunakan flag race detection dan coverage. Dengan menerapkan aturan-aturan ini, agent akan menghasilkan kode yang menghindari kesalahan umum seperti error yang tidak ditangani, lifecycle goroutine yang tidak tepat, atau konkatenasi string yang tidak efisien dalam loop. Skill ini membantu menstrukturkan proyek ke dalam direktori standar seperti cmd, internal, dan pkg sekaligus mencegah penggunaan nama package yang tidak bermakna seperti util atau base.
Apa yang bisa dilakukan agent dengannya
- 1Deteksi masalah concurrencyVerifikasi bahwa goroutine dikelola dengan context dan periksa data races selama proses testing.
Ditulis dari SKILL.md milik skill tersebut. Setiap use case diverifikasi dengan kutipan darinya.
Cara install skill go-dev
Setiap perintah menyalin folder skill ke direktori skills client. Restart client atau mulai sesi baru untuk memuatnya.Install skill go-dev di Plugin
/plugin marketplace add doccker/cc-use-exp /plugin install cc-use-exp@cc-use-exp
Install skill go-dev di Claude Code
~/.claude/skills/go-dev/SKILL.md
$ npx degit doccker/cc-use-exp/skills/go-dev ~/.claude/skills/go-devInstall skill go-dev di Claude Code (project)
.claude/skills/go-dev/SKILL.md
$ npx degit doccker/cc-use-exp/skills/go-dev .claude/skills/go-devInstall skill go-dev di Codex
~/.agents/skills/go-dev/SKILL.md
$ npx degit doccker/cc-use-exp/skills/go-dev ~/.agents/skills/go-devInstall skill go-dev di Gemini CLI
~/.gemini/skills/go-dev/SKILL.md
$ npx degit doccker/cc-use-exp/skills/go-dev ~/.gemini/skills/go-devInstall skill go-dev di Claude.ai
npx degit doccker/cc-use-exp/skills/go-dev go-dev && zip -r go-dev.zip go-dev # claude.ai → Customize → Skills → + → Create skill → Upload a skill → go-dev.zip
Pengecekan otomatis
Berjalan 15 Nov 2026Laporan lengkap →Belum terverifikasi. Skill perlu skor 80, tanpa temuan serius, dan data yang cukup untuk kami cek. Cara kerja checks · Yang perlu diperbaiki untuk menambah poin
- Source repository terhubung dan dapat dijangkaudoccker/cc-use-exp/skills/go-dev is public and reachablegithub.com/doccker/cc-use-exp/tree/HEAD/skills/go-dev ↗Lolos
- Lisensi open source (OSI)No licenseTemuan
- Ada commit atau release dalam satu tahun terakhirLast commit 2026-08-26github.com/doccker/cc-use-exp/commits ↗Lolos
- Skrip tanpa unduh-lalu-jalankan atau pencurian kredensialNo scripts in the skill folderLolos
- Tidak ada instruksi tersembunyi di SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/doccker/cc-use-exp/blob/HEAD/skills/go-dev/SKILL. ↗Lolos
- Tool yang diizinkan otomatis dibatasiNo pre-approved tools; the agent asks before using onegithub.com/doccker/cc-use-exp/blob/HEAD/skills/go-dev/SKILL. ↗Lolos
- SKILL.md mengikuti format Agent Skillsthe description does not say when to use the skill; the description is only 30 charactersgithub.com/doccker/cc-use-exp/blob/HEAD/skills/go-dev/SKILL. ↗Temuan
SKILL.md
Lihat di GitHubGo 开发规范
参考来源: Effective Go、Go Code Review Comments、uber-go/guide
工具链
goimports -w . # 格式化并整理 import
go vet ./... # 静态分析
golangci-lint run # 综合检查
go test -v -race -cover ./... # 测试(含竞态检测和覆盖率)
命名约定
| 类型 | 规则 | 示例 |
|---|---|---|
| 包名 | 小写单词,不用下划线 | user, orderservice |
| 变量/函数 | 驼峰命名,缩写词一致大小写 | userID, HTTPServer |
| 常量 | 导出用驼峰,私有可驼峰或全大写 | MaxRetryCount |
| 接口 | 单方法用方法名+er | Reader, Writer |
禁止: common, util, base 等无意义包名
import 顺序
import (
"context" // 标准库
"fmt"
"github.com/gin-gonic/gin" // 第三方库
"project/internal/model" // 项目内部
)
错误处理
必须处理错误,不能忽略:
// ✅ 好:添加上下文
if err != nil {
return fmt.Errorf("failed to query user %d: %w", userID, err)
}
// ❌ 差:忽略错误
result, _ := doSomething()
错误包装: 使用 %w 保留错误链,用 errors.Is() / errors.As() 检查
并发编程
基本原则:
- 优先使用 channel 通信
- 启动 goroutine 前考虑:谁来等待它?怎么停止它?
- 使用
context.Context控制生命周期
// ✅ 好:使用 context 控制
func process(ctx context.Context) error {
done := make(chan error, 1)
go func() { done <- doWork() }()
select {
case err := <-done:
return err
case <-ctx.Done():
return ctx.Err()
}
}
数据竞争: 使用 go test -race 检测
测试规范
// 表驱动测试
func TestAdd(t *testing.T) {
tests := []struct {
name string
a, b int
expected int
}{
{"positive", 1, 2, 3},
{"zero", 0, 0, 0},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := Add(tt.a, tt.b)
if got != tt.expected {
t.Errorf("Add(%d, %d) = %d, want %d", tt.a, tt.b, got, tt.expected)
}
})
}
}
性能优化
| 陷阱 | 解决方案 |
|---|---|
| 循环中拼接字符串 | 使用 strings.Builder |
| 未预分配 slice | make([]T, 0, cap) |
| N+1 查询 | 批量查询 + 预加载 |
| 无限制并发 | 使用 semaphore 或 worker pool |
| Raw SQL 别名用了保留字 | 避免 year_month/order/status/rank 等 MySQL 保留字做别名 |
# 性能分析
go test -cpuprofile=cpu.prof -bench=.
go tool pprof cpu.prof
项目结构
project/
├── cmd/ # 可执行文件入口
├── internal/ # 私有代码
│ ├── handler/
│ ├── service/
│ ├── repository/
│ └── model/
├── pkg/ # 公共代码
├── go.mod
└── go.sum
详细参考
| 文件 | 内容 |
|---|---|
references/go-style.md |
命名约定、错误处理、并发、测试、性能 |
references/date-time.md |
日期加减、账期计算、AddDate 溢出处理 |
📋 本回复遵循:
go-dev- [具体章节]
Berkas dalam skill ini
3Pertanyaan seputar skill go-dev
Bagaimana cara install skill go-dev di Claude Code?
Jalankan npx degit doccker/cc-use-exp/skills/go-dev ~/.claude/skills/go-dev. Claude Code memuat skill dari ~/.claude/skills (semua proyek) atau .claude/skills (satu proyek) dan menggunakan skill saat deskripsinya cocok dengan tugas.
Client mana saja yang bisa menggunakan skill go-dev?
Client apa pun yang membaca format Agent Skills: Claude Code, Codex, Gemini CLI, dan claude.ai (unggah sebagai ZIP). Script dalam skill hanya berjalan di client yang mengizinkan eksekusi kode.