go/api-design

Design idiomatic Go HTTP APIs with chi router, middleware, and JSON helpers.

3|1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/deandum/claude-resources --skill go-api-design-deandum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go/api-design
Source: https://github.com/deandum/claude-resources/tree/main/skills/go/api-design
Command: npx skills add https://github.com/deandum/claude-resources --skill go-api-design-deandum

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Go HTTP API patterns with chi router, handler structures, and reusable middleware reduce boilerplate and increase reliability in server apps.

Core Features & Use Cases

  • Structured HTTP handlers: Handlers as methods with dependencies and a clean Routes() wiring using chi.
  • Middleware & helpers: Standardized request IDs, logging, error handling, and JSON helpers for consistent responses.
  • Server configuration patterns: Centralized timeouts and graceful shutdown for robust Go services.
  • Use Case: Build a REST API with /api/v1/users endpoints, including GET and POST, with proper validation and responses.

Quick Start

Create a Go API service using chi by wiring routes with a Handler, applying middleware, and exposing a /api/v1 router.

Frequently Asked Questions about go/api-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Go HTTP handlers using chi router for a production API?

Structure Go HTTP handlers using chi router by defining handlers as methods with injected dependencies and wiring routes through a clean Routes() function. This modular approach reduces boilerplate and increases reliability in server apps.

What is the best way to implement middleware for request IDs and logging in a Go API?

The best way to implement middleware in a Go API is using standardized chi router middleware for request IDs, logging, and error handling. This ensures consistent JSON responses and reduces boilerplate across server endpoints.

How do I configure graceful shutdown and timeouts for a Go HTTP server?

Configure graceful shutdown and timeouts for a Go HTTP server by applying centralized server configuration patterns. This involves setting explicit timeout values and handling shutdown signals to ensure robust Go services.

Can I build a REST API with /api/v1/users endpoints using chi patterns in Go?

Yes, you can build a REST API with /api/v1/users endpoints using chi patterns in Go. The approach supports GET and POST methods with proper request decoding, validation, and consistent JSON helper responses.

Do I need external dependencies to handle JSON request decoding and error handling in Go?

You do not need external dependencies beyond the chi router to handle JSON request decoding and error handling in Go. The design utilizes built-in JSON helpers and standardized middleware for consistent API responses.