# Golang Context

Idiomatic context.Context usage in Golang, propagation through API boundaries...

- Repository: https://github.com/samber/cc-skills-golang (3750 stars)
- Category: Design
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add samber/cc-skills-golang --skill golang-context -g -a claude-code -y`
Codex: `npx skills add samber/cc-skills-golang --skill golang-context -g -a codex -y`
Cursor: `npx skills add samber/cc-skills-golang --skill golang-context -g -a cursor -y`
Gemini CLI: `npx skills add samber/cc-skills-golang --skill golang-context -g -a gemini-cli -y`

## Description

Idiomatic context.Context usage in Golang, propagation through API boundaries, cancellation, timeouts and deadlines, request-scoped values, context.WithoutCancel for background work outliving requests. Apply when designing context propagation across layers, debugging leaked or unexpired contexts, choosing between context.Background/TODO/WithoutCancel, or storing values in context. Not for code that merely accepts ctx as first parameter.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **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

The rest: https://github.com/samber/cc-skills-golang/blob/HEAD/skills/golang-context/SKILL.md
