From go-patterns
Go design patterns, project layout, error handling, configuration lifecycle, CI/CD release workflows, and multi-module workspace coordination for the tau ecosystem. Apply this skill whenever you design a new Go package, define an interface, structure a config file, choose a constructor signature, write a test, set up release automation, or organize a workspace of related modules. Triggers: interface design, error handling, package structure, dependency hierarchy, configuration lifecycle, parameter encapsulation, Go idioms, black-box testing, registry/factory pattern, release workflow, CHANGELOG, multi-module workspace, go.work, doc.go, .claude settings, Makefile.
How this skill is triggered — by the user, by Claude, or both
Slash command
/go-patterns:go-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Architectural conventions for building Go libraries, CLIs, and web services in
references/ci-cd-release.mdreferences/concurrency.mdreferences/configuration.mdreferences/constructors.mdreferences/error-handling.mdreferences/modern-idioms.mdreferences/package-design.mdreferences/project-layout.mdreferences/registry-factory.mdreferences/testing.mdreferences/tooling-claude.mdreferences/workspace-multimodule.mdArchitectural conventions for building Go libraries, CLIs, and web services in
the tau ecosystem. Patterns are derived from real projects: tau/protocol,
tau/format, tau/provider, tau/agent, tau/orchestrate, agent-lab,
herald, go-agents, and go-agents-orchestration.
This skill covers three Go project archetypes:
tau/protocol, tau/agent, go-agents.herald, agent-lab.tau/ (root go.work),
tau/format + tau/format/openai + tau/format/converse.This skill explicitly does not cover TUI applications. None of the reference projects are TUIs and the patterns here have not been validated for that shape.
The eight principles below orient every other decision in this skill. Each principle has a one-line statement, a canonical illustration, and a pointer to the reference file that develops it in detail.
Configuration exists only during initialization. Load it, transform it into domain values, then discard it. Runtime structs hold values, not config.
cfg, _ := config.Load()
db, _ := database.New(&cfg.Database, logger) // values extracted now
// cfg goes out of scope; runtime never references it again
See: references/configuration.md.
Layers communicate through interfaces, not concrete types. The consumer defines the interface; the lower layer provides implementations.
// agent.go — agent (consumer) defines what it needs from a provider
func New(cfg *config.AgentConfig, p provider.Provider, f format.Format) Agent
See: references/package-design.md.
More than two parameters? Use a struct. The struct documents what the operation requires and serializes cleanly when needed.
// Instead of: Execute(ctx, capability, input, timeout, retries, headers)
// Use: Execute(ctx, request ExecuteRequest)
See: references/constructors.md.
Provide semantic accessors for nested or computed state. Do not require callers to traverse internal structure.
// Good — caller asks for what it wants
text := response.Text()
// Bad — caller knows the internal layout and panics on empty slices
text := response.Choices[0].Delta.Content
See: references/package-design.md.
Each package has one clear purpose. protocol/config holds configuration
types. protocol/response holds response types. agent/client holds the
HTTP client. Names like types, utils, common, or helpers violate this
rule and should not exist.
See: references/project-layout.md.
Lower layers do not import higher layers. Shared types belong in the lowest layer that needs them. Use dependency inversion (interface ownership in the consumer) when a lower layer needs behavior from a higher one.
protocol ← format, provider ← agent ← orchestrate
See: references/package-design.md.
Tests live in tests/ mirroring source structure, with package <pkg>_test.
Black-box tests verify the public contract; in-package tests are reserved for
unexported helpers that cannot be exercised through the public API.
// tests/agent_test.go
package agent_test
import "github.com/tailored-agentic-units/agent"
See: references/testing.md.
Use the language as it exists today. Baseline is Go 1.26.
wg.Go(func()) — Go 1.25 replaces Add/goroutine/Donemaps.Copy(dst, src) — Go 1.21 for map mergingmin(a, b) / max(a, b) — Go 1.21 builtinsfor range n — Go 1.22 integer rangeerrors.Join — Go 1.20, scoped to aggregation boundaries onlyslices.Contains etc. — Go 1.21 standard slice helpersSee: references/modern-idioms.md.
Reference files load on demand. Consult only the files relevant to the task.
Structure & Design
New() shapes, struct
configs, runtime options, composition rootRuntime Behavior
Default*Config/Merge/FinalizeUnwrap, retry classification, errors.Join boundariessync.WaitGroup.Go,
context propagation, lifecycle Coordinator, streaming channelsCode Style
httptest.NewServer, mock packages, atomic assertionsPatterns
go.work, sub-modules, replace directives, version coordinationProject Infrastructure
.claude/settings.json, CLAUDE.md, doc.go| If you are... | Read... |
|---|---|
| Creating a new package | project-layout.md, package-design.md |
| Defining an error type | error-handling.md |
| Designing a config struct | configuration.md |
Writing a New() constructor | constructors.md |
| Adding a test file | testing.md |
| Spawning a goroutine | concurrency.md |
| Building a plugin/extension system | registry-factory.md |
| Splitting a repo into multiple modules | workspace-multimodule.md |
| Setting up a release workflow | ci-cd-release.md |
Writing a Makefile or .claude/settings.json | tooling-claude.md |
| Reaching for a Go 1.20+ feature | modern-idioms.md |
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub tailored-agentic-units/tau-marketplace --plugin go-patterns