Improve Go business code with explicit models, safe enums, deliberate duplication, cohesive decorators, low framework coupling, and small library choices. Use for Go refactors involving DRY decisions, shared DTOs, primitive obsession, overengineering, web-app anti-patterns, command decorators, or package cohesion.
Model Go business rules with aggregates, unexported fields, business-named state-transition methods, and sentinel errors. Use for refactoring procedural handlers into domain types whose methods keep state valid.
Design Go error handling with wrapped errors, sentinel and typed error contracts, stable slug errors, boundary classification, and HTTP error mapping. Use for Go tasks involving public API errors, wrapping with %w, errors.Is/errors.As, or avoiding duplicate logs.
Build Go event-driven workflows with Watermill, Pub/Sub, CQRS command/event buses, routers, middleware, outbox/forwarder patterns, idempotent consumers, and component tests. Use for Go tasks involving domain events, async handlers, message routing, Ack/Nack, retries, dead letters, event contracts, transactional event publishing, or replacing synchronous cross-service calls with events.
Implement Go persistence with aggregate repositories, repository-owned transactions, UpdateFn methods, row locking, migrations, tenant scoping, idempotency, and reliable outbox publishing. Use for Go tasks involving database adapters, sqlc, database/sql, pgx, Ent, GORM, Firestore, repository design, transactional application services, consistency boundaries, or reliable event publishing.
Structure Go services with clear package boundaries, dependency direction, ports, application use cases, adapters, direct ports, events, and dependency injection. Use for Go backend architecture, Clean Architecture, Hexagonal Architecture, DDD service layout, CQRS command/query surfaces, refactoring tangled packages, introducing ports/adapters, or deciding where HTTP, gRPC, CLI, queues, config, domain, app, adapter, and service wiring code belong.
Build and review Go service delivery foundations with Docker Compose local dev, generated OpenAPI/gRPC contracts, Cloud Run-style container deployment, Terraform infrastructure, Firebase-style auth boundaries, and CI integration tests. Use for Go tasks involving service startup, local environments, generated API clients, Cloud Run, Terraform, Cloud Build, docker-compose tests, auth middleware, or deployment wiring.
Split Go business systems with strategic DDD boundaries, ubiquitous language, context maps, Event Storming outputs, direct ports, events, shared kernels, and anti-corruption adapters. Use for Go architecture tasks involving bounded contexts, modular monoliths, microservices, context coupling, service boundaries, or domain-driven decomposition.