| name | golang-microservice |
| description | Skill for creating and modifying Golang microservices using DDD, immutable models, functional composition, GORM entities, JSON:API transport, and Kafka messaging with context based multi tenancy. |
Golang Microservice Skill
Purpose
Provide a composable entry point that activates when working on any Golang service. This skill aligns development and AI generation with architecture patterns and conventions.
When to Use
Activate when working on:
- Any Go microservice
- Files:
model.go, entity.go, builder.go, processor.go, provider.go, producer.go, resource.go, rest.go, state.go, or cache.go
- Kafka producers/consumers
- Caching layers and singleton patterns
- REST JSON:API endpoints
- Multi-tenancy context logic
- Testing domain logic, providers, or emission paths
Quick Start Checklist
Key Principles
- Immutability — Models never mutate; all state changes yield new instances.
- Functional Composition — Use curried functions and providers for composition.
- Event-Driven Design — Kafka coordinates inter-service communication.
- Context Isolation — Tenant and trace always derived from context.
- Layer Separation — Each file type has a clear single responsibility.
- Pure Logic First — Business logic runs without side effects unless explicitly wrapped in
AndEmit.
File Responsibilities
| File |
Primary Responsibility |
Key Dependencies |
model.go |
Domain model definition |
None |
entity.go |
Database schema and migrations |
GORM |
builder.go |
Fluent construction of valid models |
Model |
processor.go |
Core business logic |
Model, Provider |
provider.go |
Lazy database access |
GORM, Entity |
producer.go |
Kafka event creation |
Kafka, Provider |
cache.go |
Singleton cache implementation |
sync.Once, sync.RWMutex |
resource.go |
Route registration and handlers |
REST, Processor |
rest.go |
JSON:API resource mappings |
Model |
state.go |
Domain states or enums |
Model |
Navigation Guide