---
name: "gin-gonic-http-web-framework"
description: "Build fast, modular REST services with Martini-like API and 40x faster httprouter in Go."
metadata:
  author: "Gin"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write gin api handler"
  - "gin custom middleware"
  - "shouldbindjson validation gin"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Gin Web Framework High-Throughput REST APIs in Go

Develops REST APIs with Gin: structuring route groups (r.Group), custom middleware (c.Next, c.Abort), request binding with ShouldBindJSON, input validation tags (binding:'required'), and JSON responses.

## When to Invoke
Invoke this skill whenever you need to:
- write gin api handler
- gin custom middleware
- shouldbindjson validation gin

## Execution SOP & Rules
1. Initialize engine: r := gin.New(); r.Use(gin.Logger(), gin.Recovery()).
2. Create route groups: v1 := r.Group('/api/v1'); v1.Use(AuthMiddleware()).
3. Bind and validate JSON: if err := c.ShouldBindJSON(&req); err != nil { c.JSON(400, gin.H{'error': err.Error()}); return }.
4. Emit response: c.JSON(http.StatusOK, gin.H{'data': result}).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
