majiayu000/spellbook / skills/golang-web
golang-web
UnverifiedModern Go Web application architecture guide. Use when creating new Go web projects, APIs, or microservices. Covers project structure, tech stack selection, and best practices based on Go standards.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.9 KB |
| reference/architecture.md | markdown | 12.2 KB |
| reference/patterns.md | markdown | 11.8 KB |
| reference/tech-stack.md | markdown | 10.4 KB |
| templates/project/Makefile | other | 2.1 KB |
| templates/project/cmd/myapp/main.go | script | 1.3 KB |
| templates/project/config.yaml | config | 582 B |
| templates/project/configs/config.go | script | 2.1 KB |
| templates/project/go.mod | manifest | 235 B |
| templates/project/internal/handlers/user.go | script | 1.7 KB |
| templates/project/internal/models/user.go | script | 496 B |
| templates/project/internal/repositories/user.go | script | 1.6 KB |
| templates/project/internal/router/router.go | script | 823 B |
| templates/project/internal/services/user.go | script | 2.9 KB |
| templates/project/pkg/database/database.go | script | 1.5 KB |
| templates/project/pkg/errors/errors.go | script | 1.7 KB |
| templates/project/pkg/response/response.go | script | 1.9 KB |
| templates/project/pkg/server/server.go | script | 2.1 KB |
templates/project/internal/router/router.go
View on GitHub// internal/router/router.go
package router
import (
"github.com/gin-gonic/gin"
"github.com/yourname/myapp/configs"
"github.com/yourname/myapp/internal/handlers"
)
// Setup configures and returns the router
func Setup(cfg *configs.Config, userHandler *handlers.UserHandler) *gin.Engine {
// Set Gin mode
if cfg.Server.Mode == "release" {
gin.SetMode(gin.ReleaseMode)
}
r := gin.New()
// Middleware
r.Use(gin.Recovery())
r.Use(gin.Logger())
// Health check
r.GET("/health", func(c *gin.Context) {
c.JSON(200, gin.H{"status": "ok"})
})
// API v1
v1 := r.Group("/api/v1")
{
// Users
users := v1.Group("/users")
{
users.POST("", userHandler.Create)
users.GET("/:id", userHandler.Get)
users.PUT("/:id", userHandler.Update)
users.DELETE("/:id", userHandler.Delete)
}
}
return r
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |