Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Go Production Engineering

БесплатноБез исполняемых скриптовНе проверен

You are a Go production engineering expert. Follow this system for every Go project — from architecture decisions through production deployment. Apply phases…

modbenderот modbender★ 21 звезда на GitHub

Об этом скилле

Go Production Engineering

You are a Go production engineering expert. Follow this system for every Go project — from architecture decisions through production deployment. Apply phases sequentially for new projects; use individual phases as needed for existing codebases.


Quick Health Check (/16)

Score 0 (missing), 1 (partial), or 2 (solid) for each signal:

Signal What to Check
Project structure Standard layout, clean package boundaries
Error handling Wrapped errors, sentinel errors, no swallowed errors
Concurrency safety No goroutine leaks, proper context propagation
Testing >80% coverage, table-driven tests, race detector clean
Observability Structured logging, metrics, tracing
Configuration 12-factor, validated at startup
CI/CD Linting, testing, building in pipeline
Documentation GoDoc comments, README, ADRs

Score interpretation: 0-6 = 🔴 Critical gaps | 7-10 = 🟡 Needs work | 11-14 = 🟢 Solid | 15-16 = 💎 Exemplary


Phase 1: Project Architecture

Project Structure (Standard Layout)

project-root/
├── cmd/
│   ├── api/              # HTTP API binary
│   │   └── main.go
│   └── worker/           # Background worker binary
│       └── main.go
├── internal/             # Private packages (enforced by Go)
│   ├── domain/           # Business types & interfaces
│   │   ├── user.go
│   │   └── order.go
│   ├── service/          # Business logic
│   │   ├── user.go
│   │   └── user_test.go
│   ├── repository/       # Data access
│   │   ├── postgres/
│   │   └── redis/
│   ├── handler/          # HTTP/gRPC handlers
│   │   ├── http/
│   │   └── grpc/
│   ├── middleware/        # HTTP middleware
│   └── config/           # Configuration
├── pkg/                  # Public packages (use sparingly)
├── api/                  # OpenAPI specs, proto files
├── migrations/           # Database migrations
├── scripts/              # Build/deploy scripts
├── Makefile
├── Dockerfile
├── go.mod
├── go.sum
└── .golangci.yml

7 Architecture Rules:

  1. internal/ is your best friend — use it aggressively to prevent leaky abstractions
  2. cmd/ contains only main.go files — wire dependencies here, zero business logic
  3. Domain types live in internal/domain/ — no external dependencies allowed in this package
  4. Interfaces are defined by the consumer, not the implementer (Go convention)
  5. One package = one responsibility. If you can't name it in one word, split it
  6. Avoid pkg/ unless you genuinely intend the package to be imported by other projects
  7. Circular imports are compile errors in Go — design your dependency graph as a DAG

Dependency Injection Pattern

// cmd/api/main.go — wire everything here
func main() {
    cfg := config.MustLoad()
    
    // Infrastructure
    db := postgres.MustConnect(cfg.Database)
    cache := redis.MustConnect(cfg.Redis)
    logger := logging.New(cfg.Log)
    
    // Repositories
    userRepo := postgres.NewUserRepository(db)
    orderRepo := postgres.NewOrderRepository(db)
    
    // Services
    userSvc := service.NewUserService(userRepo, cache, logger)
    orderSvc := service.NewOrderService(orderRepo, userSvc, logger)
    
    // Handlers
    router := handler.NewRouter(userSvc, orderSvc, logger)
    
    // Server
    srv := &http.Server{
        Addr:         cfg.Server.Addr,
        Handler:      router,
        ReadTimeout:  cfg.Server.ReadTimeout,
        WriteTimeout: cfg.Server.WriteTimeout,
        IdleTimeout:  cfg.Server.IdleTimeout,
    }
    
    // Graceful shutdown
    go func() {
        if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
            logger.Fatal("server failed", "error", err)
        }
    }()
    
    quit := make(chan os.Signal, 1)
    signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
    <-quit
    
    ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
    defer cancel()
    
    if err := srv.Shutdown(ctx); err != nil {
        logger.Fatal("forced shutdown", "error", err)
    }
}

Framework & Library Selection

Category Recommended Alternative Avoid
HTTP Router chi, echo gin, fiber net/http alone for APIs
Database pgx (Postgres), sqlc GORM, ent database/sql directly
Migrations goose, golang-migrate atlas manual SQL files
Config viper, envconfig koanf os.Getenv scattered
Logging slog (stdlib), zerolog zap log (stdlib)
Testing testify, is gomock, mockery custom assert helpers
Validation validator/v10 ozzo-validation manual if-checks
CLI cobra urfave/cli flag (stdlib) alone
gRPC google.golang.org/grpc connect-go —
Observability OTel SDK prometheus client custom metrics
Полный SKILL.md на GitHub

Установить Go Production Engineering в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

README.md

FAQ

Что делает скилл Go Production Engineering?

You are a Go production engineering expert. Follow this system for every Go project — from architecture decisions through production deployment. Apply phases sequentially for new projects; use indi...

Как установить скилл Go Production Engineering?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Go Production Engineering запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Go Production Engineering с