Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add codeready-toolchain/tarsy --skill golang-context-patternsgit clone --depth 1 https://github.com/codeready-toolchain/tarsyWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/codeready-toolchain/tarsy/golang-context-patterns)<a href="https://agentmods.dev/skills/codeready-toolchain/tarsy/golang-context-patterns"><img src="https://agentmods.dev/badge/skills/codeready-toolchain/tarsy/golang-context-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/codeready-toolchain/tarsy/golang-context-patterns"><img src="https://agentmods.dev/badge/skills/codeready-toolchain/tarsy/golang-context-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00039 | $0.02262 |
| Opus 5.5 | $0.00016 | $0.00905 |
| Sonnet 5.5 | $0.00008 | $0.00452 |
| Haiku 4.5 | $0.00004 | $0.00226 |
Grade A, and why
golang-context-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 380 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Go Context Patterns
Context usage patterns for Go following 2025-2026 best practices.
Context Basics
Context carries:
- Cancellation signals
- Deadlines and timeouts
- Request-scoped values
Golden rule: Always pass context as first parameter.
func DoWork(ctx context.Context, data string) error {
// Pass ctx to all downstream operations
}
HTTP Handler Context
Extract from request:
func (s *Server) HandleRequest(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() // Get request context
// Context is cancelled if:
// - Client disconnects
// - Server timeout reached
result, err := s.service.ProcessData(ctx, data)
if err != nil {
if errors.Is(err, context.Canceled) {
// Client disconnected
return
}
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
json.NewEncoder(w).Encode(result)
}
Database Transaction Context Pattern
Critical pattern for TARSy:
func (s *SessionService) CreateSession(ctx context.Context, req CreateSessionRequest) (*ent.AlertSession, error) {
writeCtx, cancel := context.WithTimeoutCause(
context.Background(), 5*time.Second,
fmt.Errorf("create session %s: db write timed out", req.SessionID),
)
defer cancel()
tx, err := s.client.Tx(writeCtx)
if err != nil {
return nil, fmt.Errorf("failed to start transaction: %w", err)
}
defer func() { _ = tx.Rollback() }()
session, err := tx.AlertSession.Create().
SetID(req.SessionID).
Save(writeCtx)
if err != nil {
return nil, fmt.Errorf("failed to create session: %w", err)
}
if err := tx.Commit(); err != nil {
return nil, fmt.Errorf("failed to commit: %w", err)
}
return session, nil
}
Why background context for database operations:
- HTTP request context might be cancelled if client disconnects
- Database writes should complete even if client disconnects
- Use separate timeout to prevent hanging forever
Context Timeout Patterns
WithTimeoutCause for operations with deadline:
func FetchData(ctx context.Context, url string) ([]byte, error) {
ctx, cancel := context.WithTimeoutCause(ctx, 10*time.Second,
fmt.Errorf("fetch %s timed out", url),
)
defer cancel()
req, _ := http.NewRequestWithContext(ctx, "GET", url, nil)
resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
return io.ReadAll(resp.Body)
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 380 lines · 39 tokens per session scan A 63e8fb825c4c
golang-context-patterns is a skill published in the GitHub repository codeready-toolchain/tarsy (10 stars, last pushed today), licensed Apache-2.0. It adds 39 tokens to every session and 2,262 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
go
Use when writing, reviewing, testing, or shipping Go code and HTTP services: idioms, %w error wrapping, goroutine/context/errgroup concurrency, net/http 1.22 routing, log/slog, project layout, table-driven tests, Go hardening. NOT language-agnostic threat modeling (that is secure-coding), NOT Dockerfile/CI shipping…
go-services
Build and upgrade Go services, workers and CLI applications with context propagation and explicit ownership. Use when implementing Go HTTP/data/concurrency paths; preserve module and deployment constraints and verify race-sensitive behavior deterministically.
agent-go-expert
Specialist subagent: Go concurrency, error handling, stdlib patterns, Chi/Echo web frameworks specialist. Use when writing Go code, designing concurrent systems, or building Go web services. Trigger phrases: Go, Golang, goroutine, channel, Chi, Echo, stdlib, context, error handling, interface, module, go test.
fiber-rest-api
Use when adding or changing a Go HTTP endpoint — Fiber v2 or v3 (detect which), thin handlers, central error mapping, boundary validation; the same rules apply to net/http, chi, echo or gin.
go-hexagonal-architecture
Use when adding a use case, port, repository or adapter in a Go service — where each piece goes, how errors and transactions cross layers, and how to check the import direction.
zerolog-observability
Use when adding logging to Go code - the repository's logger with structured fields, request-scoped correlation, correct levels, no secrets or double-logging.