skills/go-skills/gin-gonic/SKILL.md
Guides Go web development with the Gin-Gonic HTTP framework including routing, route groups, middleware, JSON binding, validation, error handling, and graceful shutdown. Use when the user needs to build REST APIs or HTTP services with Gin-Gonic (alias for the Gin framework).
npx skillsauth add teachingai/agent-skills gin-gonicInstall 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.
Use this skill whenever the user wants to:
gin.Default() includes Logger and Recovery middlewareShouldBindJSON or ShouldBindQuery with struct tagsc.JSON() for consistent API responsespackage main
import (
"net/http"
"github.com/gin-gonic/gin"
)
type CreateUserRequest struct {
Name string `json:"name" binding:"required,min=2"`
Email string `json:"email" binding:"required,email"`
}
func main() {
r := gin.Default()
// Route group with auth middleware
api := r.Group("/api/v1")
{
api.POST("/users", createUser)
api.GET("/users/:id", getUser)
}
r.Run(":8080")
}
func createUser(c *gin.Context) {
var req CreateUserRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
// ... create user logic
c.JSON(http.StatusCreated, gin.H{"name": req.Name, "email": req.Email})
}
func getUser(c *gin.Context) {
id := c.Param("id")
c.JSON(http.StatusOK, gin.H{"id": id})
}
/api/v1/users)binding:"required,email" for declarative validationhttp.Server with srv.Shutdown(ctx) for clean connection draininggin.New() and add only the middleware you needgin-gonic, gin, Go, web framework, REST API, routing, middleware, JSON binding, 路由, 中间件
development
Guidance for Next.js using the official docs at nextjs.org/docs. Use when the user needs Next.js concepts, configuration, routing, data fetching, or API reference details.
tools
Provides comprehensive guidance for Flask framework including routing, templates, forms, database integration, extensions, and deployment. Use when the user asks about Flask, needs to create web applications, implement routes, or build Python web services.
development
Provides comprehensive guidance for FastAPI framework including routing, request validation, dependency injection, async operations, OpenAPI documentation, and database integration. Use when the user asks about FastAPI, needs to create REST APIs, or build high-performance Python web services.
development
Provides comprehensive guidance for Django framework including models, views, templates, forms, admin, REST framework, and deployment. Use when the user asks about Django, needs to create web applications, implement models and views, or build Django REST APIs.