Command Palette

Search for a command to run...

Назад к скиллам
скилл № 64278

go-api

Scaffold a new Go HTTP API service with its local development stack and observability. Use when the user asks to create a new Go API service or project.

БесплатноБез исполняемых скриптов
Integralistот Integralist★ 31 звезда на GitHub

Установить go-api в Claude Code и Claude Desktop

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

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

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

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

Go API Service

Scaffold a production-ready Go API service: the handlers → service → repository layout, config, structured logging, middleware, metrics, and tracing, plus a Makefile that runs it locally with MySQL, Redis, and a Grafana observability stack. All generated Go follows conventions-go and its service architecture; the templates here are the files to generate, not a second set of rules.

  1. Ask for the service name and module path: a kebab-case name such as user-service, and a module path such as github.com/myorg/myservice. Derive {SERVICE_NAME} (kebab-case), {SERVICE_NAME_SNAKE}, {SERVICE_NAME_PASCAL}, and {MODULE_PATH} from them. Done when all four placeholders have values.
  2. Generate the project in the layout below, resolving every placeholder. Use the templates where one exists; write the other packages to the contracts below, so they fit the templates that call them. Give every package a doc.go and a short README.md, as conventions-go requires. Done when every file in the layout exists and no {…} placeholder is left.
  3. Initialise and check it. Create go.mod as go-mod.md describes, then run make fmt, make lint-all, and make test. Done when all three pass.

Parallel scaffold. The placeholder map is fixed, so instantiating the templates is a verified-pattern fan-out: generate one representative package (internal/api) first and confirm the substitutions and layout with the user, then have subagents instantiate the rest in parallel, following the shared completion and retry protocol.

Layout

{SERVICE_NAME}/
├── cmd/api/main.go
├── internal/
│   ├── api/  config/  contextx/  deps/  env/  errorsx/  httpx/
│   └── logx/  metrics/  middleware/  mysql/  redis/  traces/
├── docs/
│   ├── projects/completed/
│   ├── projects/README.md
│   └── architecture.md
├── e2e/
├── local/
│   ├── config/  mysql/  observability/
├── scripts/
├── go.mod  go.sum  Makefile  AGENTS.md  README.md

Packages that shadow a standard-library name take an x suffix: logx, httpx, errorsx, contextx, timex.

Templates

Contracts for packages without a template

The templates call these, so write each package to match:

  • contextx: WithComponent(ctx, name) context.Context, RoutePatternContextKey, RoutePatternFromContext(ctx) (string, bool).
  • deps: Dependencies{MySQLFailed, RedisFailed bool}.
  • env: type Environment string, and All []Environment holding local, dev, stg, and prd.
  • errorsx: domain sentinels such as ErrNotFound, and NewProblem(title, detail) for RFC 7807 responses.
  • httpx: WriteJSON(ctx, logger, w, status, v).
  • metrics: New(registry, component, logger) *Metrics, StoreCreate(*Store), StartServer(ctx, logger, host, port) *http.Server, RegisterGauge, Count, RequestsTotal, RequestDuration, RequestSize, ResponseSize, and WithHealthCheckMetrics.
  • mysql: New(ctx, config.MySQL, logger) (*sql.DB, error), reading the password from MYSQL_PASSWORD so it stays out of the config file.
  • redis: NewClient(ctx, logger, *config.Config) (*redis.Client, error).
  • traces: New(ctx, serviceName) (shutdown func(context.Context) error, tracer, error), WithSpan(ctx, tracer, name, fn), AddAttributesToCurrentSpan, and GetTraceID(ctx) string.

Running locally

make tools-install     # first-time setup
make run               # API + MySQL + Redis + observability
make test              # unit tests
make test-integration  # end-to-end tests against the running stack
make lint-all          # every linter
Полный SKILL.md на GitHub

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

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

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

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

  • templates/config-local.md
  • templates/docker-compose-mysql.md
  • templates/docker-compose-obs.md
  • templates/go-mod.md
  • templates/internal-api.md
  • templates/internal-config.md
  • templates/internal-logx.md
  • templates/internal-middleware.md
  • templates/makefile.md

FAQ

Что делает скилл go-api?

Scaffold a new Go HTTP API service with its local development stack and observability. Use when the user asks to create a new Go API service or project.

Как установить скилл go-api?

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

Скилл go-api запускает скрипты?

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

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

Сравнить go-api с