agentsclimarketplace

Go backend microservices

Skill VRIL-LABS/skill-jam/skills/ai-ml/skills-main-2/skills-main/go-backend-microservices

Go backend development best practices for microservices with clean architecture, observability, and production-ready patternsFrom its SKILL.md

Install
npx -y skills add VRIL-LABS/skill-jam --skill go-backend-microservices

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.3 KB, 613 tokens by cl100k_base, as published. Nobody here has run it

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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,758. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.