gin-architectlisted
Install: claude install-skill ralvarez-ai/ralvaskills
# Gin Architecture
Targets **Gin 1.12** on **Go 1.27.3**. Companion to [go-architect](../../languages/go-architect/SKILL.md), [rest-api-architect](../../protocols/rest-api-architect/SKILL.md), and [sql-architect](../../databases/sql-architect/SKILL.md). Implementation skeletons in [RECIPES.md](RECIPES.md); pinned deps in [STACK.md](STACK.md).
## 1. Project structure — feature-based
One folder per bounded context. Each feature owns its routes, service, repo, DTOs, and SQL files. Mirrors [fastapi-architect](../fastapi-architect/SKILL.md) so polyglot teams can navigate either side. Full tree in [RECIPES.md](RECIPES.md).
- **`handlers.go`** depends on `service.go`; never reaches into `repo.go` directly.
- **`service.go`** is pure Go — no `gin` imports. Easy to unit-test without a fake `*gin.Context`.
- **`dto.go`** holds wire types with `json:` and `binding:` (validator) tags. **Never reuse domain structs as DTOs** — that's how internal fields leak into the API.
- **Keep the feature folder scannable, not minimal.** Split on a real responsibility seam, not a file count — a subfolder here is a new package (import path + exported surface). See [code-design-refactor §4](../../refactoring/code-design-refactor/SKILL.md#4-extract).
## 2. Routing & versioning
URL-prefix versioning via route groups. One group per version, one sub-group per feature. Registration skeleton in [RECIPES.md](RECIPES.md).
- **One `Register(rg, deps)` function per feature** — keeps `main.go` thin.
- **Path