Go API Service

VerifiedSafe

Generates a production-ready Go API service with a full project structure, including clean architecture patterns, structured logging, tracing, and metrics. Includes local development setup with Docker Compose for MySQL, Redis, and an observability stack. Ideal when starting a new Go microservice or API project.

Sby Skills Guide Bot
DevelopmentIntermediate
506/2/2026
Claude Code
#go-api#microservice#boilerplate#observability#docker

Recommended for

Our review

Generates a complete Go project structure for a production-ready API service, including local development setup, observability stack, and testing infrastructure.

Strengths

  • Comprehensive project structure with clear separation of concerns (API, config, database, logging, metrics).
  • Built-in observability (traces, structured logs, metrics) with Docker Compose integration.
  • Ready-to-use boilerplate with templates for Makefile, middleware, error handling, and more.

Limitations

  • Requires basic Go knowledge and familiarity with microservices architecture.
  • Generated structure may be overkill for very simple projects.
  • Templates are static and may need customization for specific requirements.
When to use it

Best when starting a new Go service that requires production readiness, observability, and clean architecture.

When not to use it

Avoid for simple Go scripts, quick prototypes, or projects where the initial setup overhead is not justified.

Security analysis

Safe
Quality score85/100

The skill only generates project boilerplate and instructions; it does not execute any commands that could cause harm, exfiltrate data, or disable security measures. All local commands (make, docker-compose) are standard development practices.

No concerns found

Examples

Create user service
Create a new Go API service called user-service with module path github.com/myorg/user-service
Order management microservice
Generate a Go microservice for order management named order-service, module path github.com/company/order-service
Config manager API
Start a new Go API project named config-manager with module github.com/team/config-manager

name: go-api description: Create a new Go API service. Use when starting a new Go service, API project, or microservice. Generates complete boilerplate with local development and observability.

Go API Service

Create a production-ready Go API service.

Instructions

When asked to create a new Go API service:

  1. Ask for the service name (kebab-case, e.g., user-service, config-manager)
  2. Ask for the module path (e.g., github.com/myorg/myservice)
  3. Generate the complete project structure using the templates below
  4. Replace placeholders ({SERVICE_NAME}, {SERVICE_NAME_SNAKE}, {SERVICE_NAME_PASCAL}, {MODULE_PATH}) with appropriate values

Project Structure

Generate the following structure:

{SERVICE_NAME}/
├── cmd/
│   └── api/
│       └── main.go
├── internal/
│   ├── api/
│   │   ├── api.go
│   │   └── README.md
│   ├── config/
│   │   ├── config.go
│   │   └── README.md
│   ├── contextx/
│   │   ├── contextx.go
│   │   └── README.md
│   ├── deps/
│   │   ├── deps.go
│   │   └── README.md
│   ├── env/
│   │   ├── env.go
│   │   └── README.md
│   ├── errorsx/
│   │   ├── errorsx.go
│   │   └── README.md
│   ├── httpx/
│   │   ├── httpx.go
│   │   └── README.md
│   ├── logx/
│   │   ├── logx.go
│   │   └── README.md
│   ├── metrics/
│   │   ├── metrics.go
│   │   └── README.md
│   ├── middleware/
│   │   ├── middleware.go
│   │   └── README.md
│   ├── mysql/
│   │   ├── mysql.go
│   │   └── README.md
│   ├── redis/
│   │   ├── redis.go
│   │   └── README.md
│   └── traces/
│       ├── traces.go
│       └── README.md
├── docs/
│   ├── projects/
│   │   ├── completed/
│   │   └── README.md
│   └── architecture.md
├── e2e/
│   ├── doc.go
│   └── helpers_test.go
├── local/
│   ├── config/
│   │   └── api.json
│   ├── mysql/
│   │   ├── docker-compose.yml
│   │   └── initdb.d/
│   │       └── 01-schema.sql
│   └── observability/
│       └── docker-compose.yaml
├── scripts/
│   └── .gitkeep
├── go.mod
├── go.sum
├── Makefile
├── CLAUDE.md
└── README.md

Key Patterns

Clean Architecture

handlers (HTTP) → service (business logic) → repository (data) → model (entities)

Package Naming

Use x suffix for packages that shadow stdlib: logx, httpx, timex, errorsx, contextx

Error Handling

return nil, fmt.Errorf("service: failed to create config: %w", err)

Structured Logging

logger.LogAttrs(ctx, slog.LevelError, "create_config",
    slog.String("config_id", configID),
    slog.Any("err", err),
)

Tracing

spanFunc := func(ctx context.Context) error {
    traces.AddAttributesToCurrentSpan(ctx,
        attribute.String("config_id", configID),
    )
    // ... operation
    return nil
}
err := traces.WithSpan(ctx, s.tracer, "service.CreateConfig", spanFunc)

Templates

When generating files, use the templates in the templates/ directory:

Running Locally

After generation:

# First-time setup
make tools-install

# Start full stack (API + MySQL + Redis + Observability)
make run

# Run tests
make test

# Run integration tests
make test-integration

# Run all linters
make lint-all

Documentation

  • Place all documentation in docs/
  • Project plans go in docs/projects/
  • Move completed plans to docs/projects/completed/
  • Each internal package MUST have a README.md explaining its purpose and usage
Related skills