
Go context
Guides an agent to use Go's context.Context correctly for cancellation and timeouts
Go context is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 90
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Go context
This skill covers the correct handling of Go's context.Context type: where it belongs in function signatures, how to propagate it, and how to attach cancellation, deadlines and timeouts. It warns against common mistakes such as storing contexts in structs, passing nil, and ignoring cancellation inside loops, and it includes a verification checklist the agent can run through after making changes.
The skill also explains how to divide a parent's remaining time budget among child calls, when to read the deadline before starting uninterruptible work, and how to use request-scoped values with unexported key types and accessor functions. Guidance for HTTP handlers, middleware and tests is included, along with newer APIs such as cancel causes, WithoutCancel and AfterFunc, each tied to the Go version that introduced it.
The skill expects a Go project and the Go toolchain. It is allowed to read and edit files, search the codebase, and run go and gofmt commands. Its reference files are loaded on demand for deeper examples on timeouts, values, HTTP testing and cause handling.
When your agent uses it
Correct usage of context.Context in Go: propagation, cancellation, timeouts, deadlines, values, and common anti-patterns. Use when: "context usage", "context.Context", "context cancellation", "timeout", "context.WithTimeout", "context.WithCancel", "context values", "context propagation". Not for: concurrency beyond context (go-concurrency-review), HTTP middleware (go-api-design), error handling (go-error-handling).
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
- Instructions only, no scripts(see the files on GitHub)
- Asks for: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(gofmt:*)(see the files on GitHub)
- License: MIT(see the files on GitHub)
From a static check of its 5 files (15 KB) on GitHub on 2 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
Download the skill folder from https://github.com/eduardo-sl/go-agent-skills and copy it into your agent's skills folder.
What it does
- Context parameter placement
- Rules for putting context.Context first and avoiding storing it in structs or passing nil.
- Cancellation handling
- Patterns for deferring cancel, using errgroup and checking ctx.Err() inside loops.
- Timeout budgeting
- Guidance on nesting timeouts and reading ctx.Deadline() so child calls fit within the parent's budget.
- Context values rules
- Limits on what to store in context values, with unexported key types and accessor functions.
- HTTP and test context
- Handling r.Context() in handlers and middleware, and writing cancellation tests with t.Context().
- Cause and detach APIs
- Reference for WithCancelCause, WithoutCancel and AfterFunc with their Go version requirements.
Good for
- Review a Go service for misused context.Context parameters
- Add timeouts to an HTTP client call in Go
- Make a long processing loop stop when its context is cancelled
- Write a test that proves a Go function honours cancellation
- Propagate request context to background work safely
Go context FAQ
What does the skill need to run?
It requires the Go toolchain and works on Go projects. It is allowed to use go and gofmt commands along with file reading, editing and searching tools.
When does Go context apply?
It applies to context usage questions such as context.Context, cancellation, timeouts, deadlines, context values and propagation. Concurrency beyond context, HTTP middleware and error handling are handled by other skills.
Does Go context run any scripts?
No, the skill has no scripts. It relies on written guidance and reference files that are loaded when needed.
Does Go context run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Go context?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Go context?
The closest alternatives to Go context are Go concurrency review, Principle guard the context window, Go test quality, Go backend and Go database.
Where this comes from
- Description: from the skill's own SKILL.md.
More from eduardo-sl/go-agent-skills

Guides Go agents in designing HTTP REST APIs, handlers, middleware and shutdown
- Open source
- 90 GitHub stars
- Developer tools

Reviews Go project structure, dependency direction and module boundaries
- Open source
- 90 GitHub stars
- Developer tools

Guides an AI agent to build Go command-line tools with clean flags, streams and exit codes
- Open source
- 90 GitHub stars
- Developer tools

Guides Go code toward constructor injection, explicit wiring and no global state
- Open source
- 90 GitHub stars
- Developer tools

Guides Go code toward idiomatic design patterns like functional options and factories
- Open source
- 90 GitHub stars
- Developer tools

Guides building Go GraphQL servers with gqlgen, covering N+1 batching and query limits
- Open source
- 90 GitHub stars
- Developer tools



