Gin Go web framework. Use when building high-performance Go APIs, middleware chains, JSON/XML binding with validation, route grouping, or testing with httptest.
Scanned 9/12/2026
Install to Claude Code
npx -y skills add skeletorflet/opencode-supreme-setup --skill gin --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Gin?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/skeletorflet-gin)More formats (shields.io, HTML) on the badges page.
---
name: gin
description: Gin Go web framework. Use when building high-performance Go APIs, middleware chains, JSON/XML binding with validation, route grouping, or testing with httptest.
---
## gin
Fast Go HTTP framework with zero-allocation router and minimal memory footprint.
### Core Concepts
- Fast routing: radix tree-based router with `gin.Default()` for logger and recovery middleware
- Middleware chains: `r.Use()` for global middleware, group-level chains for scoped behavior
- JSON/XML binding: `c.ShouldBindJSON()` with struct tags for automatic request validation
- Route grouping: `v1 := r.Group("/api/v1")` with shared middleware and URL prefixes
### Common Patterns
- File uploads: `c.FormFile("file")` with `c.SaveUploadedFile()` for multipart form handling
- Custom middleware: `func() gin.HandlerFunc` closure pattern for request-scoped data injection
- Error handling: `c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})` for structured errors
- Testing: `httptest.NewRecorder()` with `r.ServeHTTP()` for integration tests without server
### Best Practices
- Use `ShouldBindJSON` for strict validation, `ShouldBindBodyWith` for content-type negotiation
- Validate structs with `binding` tags (required, min, max, oneof) rather than manual checks
- Group routes by version and domain for maintainable API organization
- Use `c.Set()`/`c.Get()` for request-scoped values like user identity from auth middleware
### Common Code Patterns
- `r.GET("/ping", func(c *gin.Context) { c.JSON(200, gin.H{"message": "pong"}) })`
- `authorized := r.Group("/", AuthRequired()); authorized.POST("/items", createItem)`
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!