golang-pro by jeffallan/claude-skills
npx skills add https://github.com/jeffallan/claude-skills --skill golang-pro资深 Go 开发者,精通 Go 1.21+、并发编程和云原生微服务。专长于地道模式、性能优化和生产级系统。
go vet ./...golangci-lint run 并在继续之前修复所有报告的问题-race 标志进行表驱动测试、模糊测试,覆盖率 80% 以上;在提交前确认竞态检测器通过根据上下文加载详细指导:
| 主题 | 参考 | 加载时机 |
|---|---|---|
| 并发 | references/concurrency.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Goroutines、channels、select、sync 原语 |
| 接口 | references/interfaces.md | 接口设计、io.Reader/Writer、组合 |
| 泛型 | references/generics.md | 类型参数、约束、泛型模式 |
| 测试 | references/testing.md | 表驱动测试、基准测试、模糊测试 |
| 项目结构 | references/project-structure.md | 模块布局、internal 包、go.mod |
具有正确上下文取消和错误传播的 Goroutine:
// worker runs until ctx is cancelled or an error occurs.
// Errors are returned via the errCh channel; the caller must drain it.
func worker(ctx context.Context, jobs <-chan Job, errCh chan<- error) {
for {
select {
case <-ctx.Done():
errCh <- fmt.Errorf("worker cancelled: %w", ctx.Err())
return
case job, ok := <-jobs:
if !ok {
return // jobs channel closed; clean exit
}
if err := process(ctx, job); err != nil {
errCh <- fmt.Errorf("process job %v: %w", job.ID, err)
return
}
}
}
}
func runPipeline(ctx context.Context, jobs []Job) error {
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
jobCh := make(chan Job, len(jobs))
errCh := make(chan error, 1)
go worker(ctx, jobCh, errCh)
for _, j := range jobs {
jobCh <- j
}
close(jobCh)
select {
case err := <-errCh:
return err
case <-ctx.Done():
return fmt.Errorf("pipeline timed out: %w", ctx.Err())
}
}
展示的关键特性:通过 ctx 限制 goroutine 生命周期,使用 %w 传播错误,取消时无 goroutine 泄漏。
X | Y 联合约束(Go 1.18+)实现 Go 功能时,请提供:
Go 1.21+、goroutines、channels、select、sync 包、泛型、类型参数、约束、io.Reader/Writer、gRPC、context、错误包装、pprof 性能剖析、基准测试、表驱动测试、模糊测试、go.mod、internal 包、函数式选项
每周安装量
6.7K
代码仓库
GitHub Stars
7.2K
首次出现
Jan 20, 2026
安全审计
安装于
opencode5.5K
codex5.3K
gemini-cli5.2K
github-copilot5.1K
amp4.6K
kimi-cli4.5K
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.
go vet ./... before proceedinggolangci-lint run and fix all reported issues before proceeding-race flag, fuzzing, 80%+ coverage; confirm race detector passes before committingLoad 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 |
Goroutine with proper context cancellation and error propagation:
// worker runs until ctx is cancelled or an error occurs.
// Errors are returned via the errCh channel; the caller must drain it.
func worker(ctx context.Context, jobs <-chan Job, errCh chan<- error) {
for {
select {
case <-ctx.Done():
errCh <- fmt.Errorf("worker cancelled: %w", ctx.Err())
return
case job, ok := <-jobs:
if !ok {
return // jobs channel closed; clean exit
}
if err := process(ctx, job); err != nil {
errCh <- fmt.Errorf("process job %v: %w", job.ID, err)
return
}
}
}
}
func runPipeline(ctx context.Context, jobs []Job) error {
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
jobCh := make(chan Job, len(jobs))
errCh := make(chan error, 1)
go worker(ctx, jobCh, errCh)
for _, j := range jobs {
jobCh <- j
}
close(jobCh)
select {
case err := <-errCh:
return err
case <-ctx.Done():
return fmt.Errorf("pipeline timed out: %w", ctx.Err())
}
}
Key properties demonstrated: bounded goroutine lifetime via ctx, error propagation with %w, no goroutine leak on cancellation.
X | Y union constraints for generics (Go 1.18+)When implementing Go features, provide:
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
Weekly Installs
6.7K
Repository
GitHub Stars
7.2K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode5.5K
codex5.3K
gemini-cli5.2K
github-copilot5.1K
amp4.6K
kimi-cli4.5K
97,600 周安装