Claude-skill-registry API Server
Standards for building HTTP services, REST APIs, and middleware in Golang.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/api-server" ~/.claude/skills/majiayu000-claude-skill-registry-api-server && rm -rf "$T"
manifest:
skills/data/api-server/SKILL.mdsource content
Golang API Server Standards
Priority: P0 (CRITICAL)
Router Selection
- Standard Lib (
): Use for simple services or when zero deps is required. Usenet/http
(Go 1.22+ has decent routing).http.ServeMux - Echo (
): Recommended for production REST APIs. Excellent middleware support, binding, and error handling.labstack/echo - Gin (
): High performance alternative.gin-gonic/gin
Guidelines
- Graceful Shutdown: MUST implement graceful shutdown to handle in-flight requests on termination (SIGINT/SIGTERM).
- DTOs: Separate Domain structs from API Request/Response structs. Map between them.
- Middleware: Use middleware for cross-cutting concerns (Logging, Recovery, CORS, Auth, Tracing).
- Health Checks: Always include
and/health
endpoints./ready - Content-Type: Enforce
for REST APIs.application/json
Middleware Pattern
- Standard:
func(next http.Handler) http.Handler - Echo implementation:
func(next echo.HandlerFunc) echo.HandlerFunc
Anti-Patterns
- Business Logic in Handlers: Handlers should only parse request -> call service -> format response.
- Global Router: Don't use global router variables. Pass router instance.