skills/go-gin-handlers/SKILL.md
HTTP handler patterns with Gin framework: routing, middleware, validation, error handling, and API versioning. Trigger: When creating HTTP endpoints, adding middleware, handling request validation, or standardizing error responses.
npx skillsauth add 333-333-333/agents go-gin-handlersInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Pattern | Rule |
|---------|------|
| Handlers are thin | Handlers ONLY parse input, call application service, format output |
| No business logic | Zero domain logic in handlers — delegate to application layer |
| Standardized responses | ALL endpoints return the same JSON envelope |
| Validation at the edge | Validate request DTOs in the handler layer using binding tags |
| Context propagation | Always pass ctx from Gin to application service |
ALL API responses follow this structure:
Reference: assets/response.go
Reference: assets/handler.go
Reference: assets/errors.go
Reference: assets/router.go
Reference: assets/auth_middleware.go
# Install Gin
go get -u github.com/gin-gonic/gin
# Run server locally
go run cmd/server/main.go
# Test endpoint
curl -X POST http://localhost:8080/api/v1/bookings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"caregiver_id": "uuid", "service_type": "walk", ...}'
| ❌ Don't | ✅ Do |
|----------|-------|
| Business logic in handlers | Call application service, return result |
| Raw c.JSON(500, ...) scattered | Use server.Fail() / server.OK() |
| Validate in application layer | Use Gin binding tags + ShouldBindJSON |
| Return different JSON shapes | Always use Response envelope |
| Parse JWT in every handler | Use auth middleware, read from c.GetString("user_id") |
testing
Review Flutter components and screens for UX/UI compliance. Trigger: When user invokes /ux-review command or requests UX audit.
development
TypeScript strict patterns and best practices. Trigger: When implementing or refactoring TypeScript in .ts/.tsx (types, interfaces, generics, const maps, type guards, removing any, tightening unknown).
testing
Testing philosophy and strategy for every feature: test pyramid, mandatory levels per change type, completion checklist, and skill delegation. Trigger: When planning tests for a feature, reviewing test coverage, defining acceptance criteria, or asking what tests a change needs.
development
Terraform security practices: sensitive variables, secret management, state protection, .gitignore patterns, and CI/CD credential handling. Trigger: When handling secrets in Terraform, configuring state backends, reviewing .gitignore for Terraform, or setting up CI/CD pipelines for infrastructure.