From golang
Go 工具链使用规范:gofmt/goimports 格式化、go mod 依赖管理、golangci-lint v2 静态检查、govulncheck 安全扫描、delve 调试器、go test -fuzz 模糊测试、pprof 性能分析。适用于工具选型、命令执行、开发环境配置场景。
npx claudepluginhub lazygophers/ccplugin --plugin golangThis skill uses the workspace's default tool permissions.
- **dev** - 开发专家
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides MCP server integration in Claude Code plugins via .mcp.json or plugin.json configs for stdio, SSE, HTTP types, enabling external services as tools.
| 场景 | Skill | 说明 |
|---|---|---|
| 核心规范 | Skills(golang:core) | 核心规范:强制约定 |
| Lint | Skills(golang:lint) | golangci-lint v2 配置 |
| 测试 | Skills(golang:testing) | 测试命令和策略 |
gofmt -w .
goimports -w .
{
"go.formatTool": "goimports",
"go.lintTool": "golangci-lint",
"go.lintOnSave": "file",
"go.formatOnSave": true
}
go mod init github.com/username/project
go mod tidy
go get github.com/lazygophers/utils@latest
go mod graph
go list -m all
# go.mod 中指定 toolchain
go 1.23.0
toolchain go1.23.4
# 更新 toolchain
go get go@1.23.4
go get toolchain@go1.23.4
# 安装
go install golang.org/x/vuln/cmd/govulncheck@latest
# 检查项目漏洞
govulncheck ./...
# 检查二进制
govulncheck -mode=binary ./myapp
go vet ./...
# 安装最新版
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
# 运行
golangci-lint run ./...
# 自动修复
golangci-lint run --fix
# 安装
go install github.com/go-delve/delve/cmd/dlv@latest
# 调试
dlv debug ./cmd/main.go
dlv test ./internal/impl/
# 附加到进程
dlv attach <pid>
# 单元测试 + race 检测
go test -v -race -cover ./...
# 模糊测试(Go 1.18+)
go test -fuzz=FuzzXxx -fuzztime=30s ./parser/
# 基准测试
go test -bench=. -benchmem -count=5 ./...
# 性能分析
go test -cpuprofile=cpu.prof -memprofile=mem.prof ./...
go tool pprof -http=:8080 cpu.prof
# 覆盖率报告
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
go tool cover -func=coverage.out | grep total
//go:generate protoc --go_out=. ./proto.proto
//go:generate stringer -type=Status
go generate ./...
go build ./...
go build -o bin/app ./cmd/main.go
# 交叉编译
GOOS=linux GOARCH=amd64 go build -o bin/app-linux ./cmd/main.go
| AI 可能的理性化解释 | 实际应该检查的内容 | 严重程度 |
|---|---|---|
| "gofmt 就够了" | 是否也运行了 goimports? | 中 |
| "go vet 够严格了" | 是否运行了 golangci-lint v2? | 高 |
| "依赖没有漏洞" | 是否运行了 govulncheck? | 高 |
| "print 调试够用" | 是否使用 delve 断点调试? | 中 |
| "手动管理 Go 版本" | 是否在 go.mod 中用 toolchain 指令? | 低 |
| "不需要 fuzz 测试" | 解析器是否添加了 fuzz 测试? | 中 |