
Description
golang-context is an agent skill from the samber cc-skills-golang collection that sets out best practice for context.Context in Go. It treats context as the session of a request, tying together every operation that belongs to one unit of work, and it covers propagation through API boundaries, cancellation, timeouts and deadlines, and request-scoped values. Its rules include passing the same context through the whole request, from the handler to the service, the database and external APIs, taking ctx as the first parameter, and passing context through function parameters rather than storing it in a struct. It advises passing context.TODO rather than nil, calling cancel on every control-flow path unless ownership is transferred, creating context.Background only at top-level entry points, and declaring context value keys as unexported types. It says to carry only request-scoped metadata in context values, and to use context.WithoutCancel for background work that must outlive the request. The skill is listed on skills.sh, where the page shows install counts, GitHub stars and security audit results, all passing. Install it with npx skills add https://github.com/samber/cc-skills-golang --skill golang-context.…
Highlights
- Context propagation through API boundaries
- Cancellation, timeouts and deadlines
- Cancel on every control-flow path
- Unexported context key types
- WithoutCancel for background work
- Installs from skills.sh
Ratings & Reviews
No ratings yet
Be the first to rate golang-context.
People also visit
golang-context FAQ
What does this skill cover?
Idiomatic context.Context use in Go: propagation, cancellation, timeouts, deadlines and request-scoped values.
Should context be stored in structs?
No. The skill says to pass it through function parameters, because a struct can outlive the request that filled it.
When should I use context.WithoutCancel?
For background work that must outlive the parent request, such as an audit log write, so the handler returning does not cancel it.
How do I install it?
Run npx skills add https://github.com/samber/cc-skills-golang --skill golang-context.
What are the security audit results?
skills.sh lists three audits: Gen Agent Trust Hub Pass, Socket Pass and Snyk Pass.
How popular is it?
The page shows about 39.1K installs, and the cc-skills-golang repository has 3.5K GitHub stars.
What are the best golang-context alternatives?
Popular alternatives to golang-context include go-concurrency-patterns, golang-concurrency and async-python-patterns. See all golang-context alternatives




