From gopilot
You are adding HTTP handlers for a domain. Handlers use the Huma framework which auto-generates OpenAPI from Go struct tags.
npx claudepluginhub bishwas-py/gopilot --plugin gopilotThis skill uses the workspace's default tool permissions.
You are adding HTTP handlers for a domain. Handlers use the Huma framework which auto-generates OpenAPI from Go struct tags.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides MCP server integration in Claude Code plugins via .mcp.json or plugin.json configs for stdio, SSE, HTTP types, enabling external services as tools.
You are adding HTTP handlers for a domain. Handlers use the Huma framework which auto-generates OpenAPI from Go struct tags.
skills/_shared/go-patterns.md for Huma conventionsbackend/internal/domain/[name]/[name].gobackend/internal/domain/[name]/service.gobackend/internal/api/router.go to see registration patternParse $ARGUMENTS as: [domain-name] [operation]
item, booking)list, get, create, update, delete, or a custom action nameCreate or update backend/internal/api/[name]_handlers.go:
Every endpoint needs input and output structs with Huma tags:
// List
type List[Name]sInput struct {
Page int `query:"page" default:"1" minimum:"1" doc:"Page number"`
PerPage int `query:"per_page" default:"20" minimum:"1" maximum:"100" doc:"Items per page"`
Search string `query:"search,omitempty" doc:"Search query"`
}
type List[Name]sOutput struct {
Body struct {
Items []domain.[Name] `json:"items" doc:"List of [name]s"`
Total int `json:"total" doc:"Total count"`
Page int `json:"page" doc:"Current page"`
}
}
// Get by ID
type Get[Name]Input struct {
ID string `path:"id" doc:"[Name] ID"`
}
type Get[Name]Output struct {
Body domain.[Name]
}
// Create
type Create[Name]Input struct {
Body struct {
// Fields with validation tags
Title string `json:"title" minLength:"3" maxLength:"200" doc:"Title"`
Description string `json:"description,omitempty" maxLength:"2000" doc:"Description"`
}
}
type Create[Name]Output struct {
Body domain.[Name]
}
// Update
type Update[Name]Input struct {
ID string `path:"id" doc:"[Name] ID"`
Body struct {
Title *string `json:"title,omitempty" minLength:"3" maxLength:"200" doc:"Title"`
Description *string `json:"description,omitempty" maxLength:"2000" doc:"Description"`
}
}
// Delete
type Delete[Name]Input struct {
ID string `path:"id" doc:"[Name] ID"`
}
func register[Name]Handlers(api huma.API, svc *domain.Service) {
huma.Register(api, huma.Operation{
OperationID: "list-[name]s",
Method: http.MethodGet,
Path: "/api/v1/[name]s",
Summary: "List [name]s",
Tags: []string{"[Name]s"},
}, func(ctx context.Context, input *List[Name]sInput) (*List[Name]sOutput, error) {
items, total, err := svc.List(ctx, input.Page, input.PerPage, input.Search)
if err != nil {
return nil, huma.Error500InternalServerError("failed to list [name]s")
}
return &List[Name]sOutput{Body: struct{ ... }{Items: items, Total: total, Page: input.Page}}, nil
})
// ... register get, create, update, delete similarly
}
| Tag | Purpose | Example |
|---|---|---|
doc: | OpenAPI description | doc:"User email address" |
format: | Format validation | format:"email" |
minLength: | Min string length | minLength:"3" |
maxLength: | Max string length | maxLength:"200" |
minimum: | Min number value | minimum:"0" |
maximum: | Max number value | maximum:"1000" |
pattern: | Regex validation | pattern:"^[a-z]+$" |
enum: | Allowed values | enum:"draft,published,archived" |
default: | Default value | default:"1" |
Add to backend/internal/api/router.go:
register[Name]Handlers(api, [name]Svc)
go vet ./...go build ./...http://localhost:8080/openapi.json includes the new endpoints/gopilot:sdk to generate the frontend SDK."GET /api/v1/[name]s → List (paginated)GET /api/v1/[name]s/{id} → Get onePOST /api/v1/[name]s → CreatePUT /api/v1/[name]s/{id} → Full updatePATCH /api/v1/[name]s/{id} → Partial updateDELETE /api/v1/[name]s/{id} → DeletePOST /api/v1/[name]s/{id}/[action] → Custom actionany or interface{} in input/output — always typed structs