golang-benchmark
Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hotโฆ
Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring
Claude Code
$ npx -y skills add samber/cc-skills-golang --skill golang-grpc --agent claude-code
Codex
$ npx skills add samber/cc-skills-golang --skill golang-grpc -a codex -y
Cursor
$ npx skills add samber/cc-skills-golang --skill golang-grpc -a cursor -y
Gemini CLI
$ npx skills add samber/cc-skills-golang --skill golang-grpc -a gemini-cli -y
GitHub Copilot
$ npx skills add samber/cc-skills-golang --skill golang-grpc -a github-copilot -y
OpenCode
$ npx skills add samber/cc-skills-golang --skill golang-grpc -a opencode -y
Windsurf
$ npx skills add samber/cc-skills-golang --skill golang-grpc -a windsurf -y
name: golang-grpc
description: "Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring TLS/mTLS, testing with bufconn, or working with streaming RPCs."
user-invocable: true
license: MIT
compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.
metadata:
author: samber
version: "1.2.2"
openclaw:
emoji: "๐"
homepage: https://github.com/samber/cc-skills-golang
requires:
bins:
- go
- protoc
install:
- kind: brew
formula: protobuf
bins: [protoc]
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs Bash(protoc:*) AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*
paths:
- "**/*.go"**Persona:** You are a Go distributed systems engineer. You design gRPC services for correctness and operability โ proper status codes, deadlines, interceptors, and graceful shutdown matter as much as the happy path.
**Modes:**
**Dependencies:**
Treat gRPC as a pure transport layer โ keep it separate from business logic. The official Go implementation is `google.golang.org/grpc`.
This skill is not exhaustive โ refer to library documentation and code examples for more information:
| Concern | Package / Tool | | --- | --- | | Service definition | `protoc` or `buf` with `.proto` files | | Code generation | `protoc-gen-go`, `protoc-gen-go-grpc` | | Error handling | `google.golang.org/grpc/status` with `codes` | | Rich error details | `google.golang.org/genproto/googleapis/rpc/errdetails` | | Interceptors | `grpc.ChainUnaryInterceptor`, `grpc.ChainStreamInterceptor` | | Middleware ecosystem | `github.com/grpc-ecosystem/go-grpc-middleware` | | Testing | `google.golang.org/grpc/test/bufconn` | | TLS / mTLS | `google.golang.org/grpc/credentials` | | Health checks | `google.golang.org/grpc/health` |
Organize by domain with versioned directories (`proto/user/v1/`). Always use `Request`/`Response` wrapper messages โ bare types like `string` cannot have fields added later. Generate with `buf generate` or `protoc`.
[Proto & code generation reference](references/protoc-reference.md)
srv := grpc.NewServer(
grpc.ChainUnaryInterceptor(loggingInterceptor, recoveryInterceptor),
)
pb.RegisterUserServiceServer(srv, svc)
healthpb.RegisterHealthServer(srv, health.NewServer())
go srv.Serve(lis)
// On shutdown signal:
stopped := make(chan struct{})
go func() { srv.GracefulStop(); close(stopped) }()
select {
case <-stopped:
case <-time.After(15 * time.Second):
srv.Stop()
}func loggingInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
start := time.Now()
resp, err := handler(ctx, req)
log.Printf("method=%s duration=%s code=%s", info.FullMethod, time.Since(start), status.Code(err))
return resp, err
}conn, err := grpc.NewClient("dns:///user-service:50051",
grpc.WithTransportCredentials(creds),
grpc.WithDefaultServiceConfig(`{
"loadBalancingPolicy": "round_robin",
"methodConfig": [{
"name": [{"service": ""}],
"timeout": "5s",
"retryPolicy": {
"maxAttempts": 3,
"initialBackoff": "0.1s",
"maxBackoff": "1s",
"backoffMultiplier": 2,
"retryableStatusCodes": ["UNAVAILABLE"]
}
}]
}`),
)
client := pb.NewUserServiceClient(conn)Always return gRPC errors using `status.Error` with a specific code โ a raw `error` becomes `codes.Unknown`, telling the client nothing actionable. Clients use codes to decide retry vs fail-fast vs degrade.
| Code | When to Use | | -------------------- | ------------------------------------------- | | `InvalidArgument` | Malformed input (missing field, bad format) | | `NotFound` | Entity does not exist | | `AlreadyE
AI agent skills are reusable instruction sets that extend your coding assistant with domain-specific expertise, loaded on demand so they don't bloat your context. This repository covers Go-specific skills only (language, testing, security, observability, etc.)
Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hotโฆ
Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool โ especially for command structure,โฆ
Golang code style conventions โ line length and breaking, variable declarations, control flow clarity, when comments help vsโฆ
Golang concurrency design โ goroutine lifecycle and leak prevention, channels and `select`, channel ownership and direction,โฆ
Idiomatic context.Context usage in Golang โ propagation through API boundaries, cancellation, timeouts and deadlines,โฆ
GitHub Actions CI/CD pipeline configuration for Golang projects โ workflow files for test, lint, SAST, coverage andโฆ
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, orโฆ
Ask which skill or flow fits your situation. A router over the skills in this repo.