Teaches Claude how to handle context.Context idiomatically in Go: propagation through call chains, cancellation patterns, timeouts, and context values. The core principle is simple but easy to mess up: pass the same context through your entire request lifecycle, never create a fresh context.Background() mid-chain, and always defer cancel(). Covers the gotchas like when to use TODO() versus Background(), why you shouldn't store contexts in structs, and how to use context values without namespace collisions. Includes patterns for HTTP handlers, database calls, and cross-service tracing. Most useful when you're building services that need proper cancellation propagation or you keep getting context usage wrong in code reviews.

skills.sh installs
42.7K
GitHub stars
3.8K
last updated
Aug 21, 2026

Install

$ npx -y skills add samber/cc-skills-golang --skill golang-context --agent claude-code

Installs into .claude/skills of the current project.

Files

Community default. A company skill that explicitly supersedes samber/cc-skills-golang@golang-context skill takes precedence.

Go context.Context Best Practices

context.Context is Go's mechanism for propagating cancellation signals, deadlines, and request-scoped values across API boundaries and between goroutines. Think of it as the "session" of a request — it ties together every operation that belongs to the same unit of work.

Best Practices Summary

Sponsors

Details

Repository
github.com/samber/cc-skills-golang
Categories
Backend & APIs, Debugging, Go
First seen
Apr 16, 2026

More from samber/cc-skills-golang

All 47
1antfu avatarviteantfu/skillsVite build tool configuration, plugin API, SSR, and Vite 8 Rolldown migration. Use when working with Vite projects, vite.config.ts, Vite plugins, or building li41.7Kskills.sh installs
2convex avatarconvex-agentconvex/agent-skillsAdd an AI agent / RAG backend (@convex-dev/agent) to the Convex app.41.1Kskills.sh installs
3pexoai avatarpexo-agentpexoai/pexo-skillsAI video generation skill with auto model selection across Seedance 2, Kling 3.0, HappyHorse, and 10+ models. Produces finished multi-shot videos (5–120s) from 40.6Kskills.sh installs
4expo avatarexpo-deploymentexpo/skillsDeploy Expo apps to production with EAS — build and submit to the iOS App Store, Google Play Store, and TestFlight, configure eas.json build and submit profiles40.2Kskills.sh installs
5samber avatargolang-swaggersamber/cc-skills-golangGolang OpenAPI/Swagger documentation with swaggo/swag — annotation comments (@Summary, @Param, @Success, @Router, @Security), swag init code generation, framewo38.6Kskills.sh installs
6mcp-use avatarmcp-apps-buildermcp-use/mcp-useBuild, modify, debug, migrate, or review TypeScript MCP servers and interactive MCP Apps using mcp-use v2. Use for tools, resources, prompts, Views, React host 33.1Kskills.sh installs