SKILL41.1K installs3.7K

Golang Context

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.

Type
Skill
Author
samber
Category
Backend
GitHub stars
3.7K
Installs
41.1K
Last updated
November 1, 2026

Install

npx skills add https://github.com/samber/cc-skills-golang --skill golang-context

Use cases


Frequently Asked Questions

When should this skill be applied?

When designing context propagation across layers, debugging leaked or unexpired contexts, or choosing between Background, TODO, and WithoutCancel.

Does it cover storing values in context?

Yes, request-scoped values and storing values in context are covered.

Is it needed for code that just accepts ctx as a first parameter?

No, the description says code that merely accepts ctx as a first parameter doesn't need it.


About this skill

Covers idiomatic context.Context use in Go: propagation across API boundaries, cancellation, timeouts and deadlines, request-scoped values, and context.WithoutCancel for work that outlives a request. It applies when designing propagation across layers, debugging leaked or unexpired contexts, or deciding between Background, TODO, and WithoutCancel. Code that merely accepts ctx as a first parameter doesn't need it.

Summary written with AI assistance from the project's public description.


Categories


More from samber


Similar Skills