Golang Patterns

Use when the user asks about goroutines, channels, Go context cancellation, worker pools, errgroup, sync.Mutex, Go error wrapping, net/http middleware or go test -race. Produces idiomatic Go concurrency and error-handling code. Not for package layout (use golang-architecture).

45 stars 6 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add j4flmao/agent-skills --skill golang-patterns
Manual install
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/agent-skills/skills/backend/go/patterns ~/.claude/skills/golang-patterns

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Golang Patterns

## Purpose
Implement Go concurrency, error handling, and HTTP server patterns correctly. Every goroutine has a stop condition. Every error is wrapped. Every server shuts down gracefully.

## Agent Protocol

### Trigger
Exact user phrases: "Go goroutine", "Go concurrency", "Go channel", "Go error handling", "Go HTTP", "Go middleware", "Go context", "Go worker pool", "Go mutex", "Go select", "Go graceful shutdown".

### Input Context
Before activating, verify:
- The pattern being implemented is known (worker pool, graceful shutdown, fan-out, etc.).
- go.mod exists.

### Output Artifact
No file output. Produces code examples as text.

### Response Format
```
Pattern: {name}
Problem: {what this solves}
Code:
{implementation}
```

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.

### Completion Criteria
- [ ] Every goroutine has a context-based stop condition.
- [ ] errgroup used for parallel work with error propagation.
- [ ] Errors wrapped with context using fmt.Errorf("...%w").
- [ ] HTTP handlers receive dependencies via struct or closure.
- [ ] Graceful shutdown implemented with signal.NotifyContext.
- [ ] Channels have clear ownership (creator closes, receiver reads).
- [ ] No time.Sleep() for synchronization.

### Max Response Length
Per pattern: 20 lines of code + 2 lines explanation.

## Architecture Decision Trees

### Concurrency Pattern Selection
Read the full skill on GitHub

Details

Skill name
golang-patterns
Path
skills/backend/go/patterns/SKILL.md
License
MIT
Repo updated
17 November 2026

FAQ

What does the Golang Patterns skill do?

Use when the user asks about goroutines, channels, Go context cancellation, worker pools, errgroup, sync.Mutex, Go error wrapping, net/http middleware or go test -race. Produces idiomatic Go concurrency and error-handling code. Not for package layout (use golang-architecture).

How do I install the Golang Patterns skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add j4flmao/agent-skills --skill golang-patterns. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Golang Patterns popular?

It lives in j4flmao/agent-skills, which has 45 GitHub stars and 6 forks.

Related skills

Agent Observability

45

j4flmao/agent-skills

Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop, OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).

DevOps & Cloud

AI Agent Architectures

45

j4flmao/agent-skills

Use when the user asks to build an AI agent, design an agent that calls tools and keeps memory, write an agent system prompt or pick an agent framework (Claude Agent SDK, OpenAI Agents SDK, LangGraph). Produces an architecture brief covering loop, tools, memory, guardrails and evals, routing depth to child skills. Not for workflow patterns (use ai-agentic-workflows).

AI, LLMs & Agents

AI Agent Core Loop

45

j4flmao/agent-skills

Use when the user asks about the agent loop, ReAct vs plan-and-solve, re-planning, Reflexion, an agent stuck in a loop, max iterations or termination conditions. Produces a loop spec or patch with state, success predicate, caps and no-progress detection. Not for overall agent design (use ai-agent-architectures) or tool schemas (use tool-calling-principles).

AI, LLMs & Agents

Job System

45

j4flmao/agent-skills

Use when the user asks about a game engine job system, work stealing, task scheduler, fibers, parallel for, job graph dependencies or engine threading. Produces job system design that fits the frame budget. Not for backend service concurrency (use backend-concurrency-mechanics) or GPU async compute (use render-graph).

Software Development

Golang Architecture

45

j4flmao/agent-skills

Use when the user asks about Go project structure, organizing a Go service with clean package boundaries, cmd/internal/pkg layout, consumer-defined interfaces, Go module design or wiring dependencies in main. Produces a Go service layout. Not for goroutines, channels or error-handling idioms (use golang-patterns).

Software Development

Lang Assembly

45

j4flmao/agent-skills

Use when the user asks about assembly, x86-64 or AArch64 code, calling conventions, System V or Windows x64 ABI, reading disassembly, objdump, Compiler Explorer, inline asm or stack frames. Produces annotated assembly and small hand-written routines. Not for microarchitecture tuning (use cpu-architecture) or compiler implementation (use compiler-design).

Software Development

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.