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.svg" alt="Measured on agentmods" 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 | $0.00019 | $0.01131 |
| Sonnet 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 8d 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.
- 8d 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 4d ago), licensed Apache-2.0. It adds 39 tokens to every session and 2,262 once invoked, about $0.0002 per session on Opus 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
fastapi-templates
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
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…
vigilante-issue-implementation-on-go
Implement a GitHub issue end-to-end when Vigilante dispatches work for a Go repository with idiomatic tooling and security guidance.
goroutine-patterns
Implement Go concurrency patterns using goroutines, channels, and synchronization primitives. Use when building concurrent systems, implementing parallelism, or managing goroutine lifecycles. Trigger words include "goroutine", "channel", "concurrent", "parallel", "sync", "context".
pn-go-scaffolding
Scaffolds new Go API projects (Gin, Fiber, Echo, Chi) or handlers. Use when adding a new route/module; covers idiomatic project layout, env/secrets, error handling, and Go-specific conventions.
golang-samber-do
Dependency injection in Golang using samber/do — service containers, lifecycle management, scopes, health checks, graceful shutdown, and module organization. Apply when using or adopting samber/do, when the codebase imports github.com/samber/do or github.com/samber/do/v2, or when refactoring manual constructor…