go-backend-microservices — Claude Code skill: setup and features
A microservices engineering skill for Go projects. It guides coding assistants to apply clean architecture, configure OpenTelemetry, and write table-driven tests.
npx skills add Mindrally/skills --skill go-backend-microservices -a claude-codeWhat go-backend-microservices does
The skill instructs your assistant on standard Go backend conventions. Code is separated into cmd/, internal/, pkg/, and api/ folders. It enforces interface-driven dependency injection across handlers, domain models, and repositories. Error handling relies on explicit checks and wrapping via fmt.Errorf("context: %w", err) to maintain trace stacks.
Operational patterns focus on OpenTelemetry. It adds spans to key routines, formats metrics for Prometheus, and attaches trace IDs to structured log entries. Context remains the first argument in functions, enforcing cancellation checks and external request timeouts. For background tasks, it directs the agent toward worker pools and sync primitives.
Test instructions mandate table-driven unit suites and testcontainers for external databases. The skill assumes golangci-lint runs in your pipeline, so generated code follows its strict checks.
What it helps with
- structure Go microservices using clean architecture patterns
- instrument services with OpenTelemetry tracing and Prometheus metrics
- generate table-driven unit tests and testcontainers integration suites
- manage concurrency safely using worker pools and graceful shutdowns
Example prompts for the agent
- Scaffold an authentication microservice separating handlers, services, and repositories using clean architecture.
- Add OpenTelemetry tracing and structured logging with trace IDs to the database repository queries.
- Write a table-driven test suite with parallel execution for JWT verification routines.
How to install go-backend-microservices
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill go-backend-microservices -a claude-code2Manually: put the files in place
~/.claude/skills/go-backend-microservices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/go-backend-microservices/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill go-backend-microservices -a codex2Manually: put the files in place
.agents/skills/go-backend-microservices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill go-backend-microservices -a cursor2Manually: put the files in place
.cursor/skills/go-backend-microservices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills go-backend-microservices2Manually: put the files in place
.github/skills/go-backend-microservices/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill go-backend-microservices -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path go-backend-microservicesManually: put the files in place
.devin/skills/go-backend-microservices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill go-backend-microservices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about go-backend-microservices
How to install go-backend-microservices in Claude Code?
Run npx skills add Mindrally/skills --skill go-backend-microservices -a claude-code. The file will be saved to ~/.claude/skills/go-backend-microservices/SKILL.md.
What does go-backend-microservices enforce?
It defines guidelines for Go microservices, including directory layout, interface-driven design, OpenTelemetry instrumentation, and context handling.
Which testing patterns does the skill recommend?
It requires table-driven unit tests with interface mocks and uses testcontainers to verify external database calls during integration testing.
Source text
SKILL.md · Apache-2.0
---
name: go-backend-microservices
description: Go backend development best practices for microservices with clean architecture, observability, and production-ready patterns
metadata:
maintainer: Mindrally
source: https://github.com/Mindrally/skills
---
# Go Backend Development for Microservices
## Core Principles
- Apply Clean Architecture with clear separation into handlers, services, repositories, and domain models
- Prioritize interface-driven development with explicit dependency injection
- Write short, focused functions with a single responsibility
- Ensure safe use of goroutines, and guard shared state with channels or sync primitives
## Project Structure
Maintain modular project structure with clear directories:
```
project/
├── cmd/ # Application entry points
├── internal/ # Private application code
├── pkg/ # Public library code
├── api/ # API definitions (OpenAPI, protobuf)
├── configs/ # Configuration files
└── test/ # Additional test utilities
```
## Error Handling
- Always check and handle errors explicitly
- Use wrapped errors for traceability: `fmt.Errorf("context: %w", err)`
- Create custom error types for domain-specific errors
- Return errors up the call stack with appropriate context
- Log errors at the appropriate level with sufficient context
## Context Propagation
- Use context propagation for request-scoped values, deadlines, and cancellations
- Pass context as the first parameter to functions
- Respect context cancellation in long-running operations
- Set appropriate timeouts for external calls
## Observability
Implement OpenTelemetry for comprehensive observability:
### Distributed Tracing
- Add spans for significant operations
- Propagate trace context across service boundaries
- Include relevant attributes in spans
### Metrics
- Implement custom metrics for business operations
- Use standard metric types (counters, gauges, histograms)
- Export metrics in Prometheus format
### Structured Logging
- Use structured logging with consistent field names
- Include trace IDs in log entries
- Log at appropriate levels (debug, info, warn, error)
## Security
- Apply input validation rigorously on all external inputs
- Use secure defaults for JWT tokens and cookies
- Implement proper authentication and authorization
- Sanitize data before logging to avoid leaking sensitive information
- Use prepared statements for database queries
## Testing
### Unit Tests
- Write table-driven unit tests with adequate coverage
- Use parallel test execution where safe
- Mock external dependencies using interfaces
- Focus on testing business logic
### Integration Tests
- Separate integration tests from unit tests
- Use test containers for database and service dependencies
- Test actual API endpoints and responses
## Concurrency
- Use goroutines appropriately for concurrent operations
- Guard shared state with channels or sync primitives
- Implement proper graceful shutdown
- Use worker pools for bounded concurrency
## Documentation
- Document with GoDoc-style comments
- Keep comments up to date with code changes
- Document public APIs thoroughly
- Include examples in documentation where helpful
## CI/CD Integration
- Maintain CI integration for linting and testing
- Use golangci-lint for comprehensive linting
- Run tests on every pull request
- Include code coverage reporting
© Mindrally · Apache-2.0 · Mindrally/skills