schema-go

Defines Go request and response structs with validate, from, and JSON tags for OpenAPI emission.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill schema-go-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: schema-go
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/schema/go
Command: npx skills add https://github.com/gabriellst/codm --skill schema-go-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/go-playground/validator/v10.

What problem does it solve? Go services in this codebase have no standalone schema artifact, so developers need consistent conventions for defining request/response structs, binding HTTP sources, and feeding the reflection-based OpenAPI emitter without duplicating shapes across layers. ## Core Features & Use Cases - Input struct conventions: Every field carries validate:"..." tags consumed by go-playground/validator/v10, with from:"body|param|query|header|cookie" tags controlling how httputil.DecodeRequest binds values. - Output struct conventions: Standard json tags plus example and format tags drive the build-time OpenAPI 3.1 emitter, with pointer fields becoming nullable schemas. - OpenAPI metadata wiring: Controller Metadata() methods reference zero values of request and response structs so the emitter discovers schemas, and swaggerignore:"true" hides infrastructure fields like owner IDs. - Use Case: When adding a new endpoint such as a transcoder callback webhook, define the request struct with from/validate tags in the controller file, reuse the use case output struct as the response, and list domain error codes in Metadata so the generated OpenAPI spec stays accurate. ## Quick Start Ask the agent to define the input and output structs for a new Go endpoint following the schema-go conventions, including validate tags, from tags, and Metadata wiring.

Frequently Asked Questions about schema-go

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate Go HTTP request structs with go-playground validator?

Add a validate tag to every field, such as validate:"required,uuid" or validate:"omitempty,min=1,max=100" for optional fields. The validator runs after httputil.DecodeRequest populates the struct, and failures return an AppError with code CodeValidationFailed and HTTP 422.

How do I bind query params and headers to Go structs?

Use from tags on controller request structs: from:"query", from:"header", from:"param", from:"body", or from:"cookie". httputil.DecodeRequest reads these tags and coerces string values to int, bool, or float64 as needed before validation.

How do I hide internal fields from an OpenAPI schema in Go?

Add swaggerignore:"true" to fields that consumers should not see, such as an owner ID read from a session header. The reflection-based emitter in packages/api/go/core/pkg/openapi excludes these fields from the generated OpenAPI 3.1 schema.

Should I create a separate schema folder for Go request and response types?

No. Define input and output structs in the same file as the use case or controller that owns them. Reuse the use case output struct directly as the controller response in Metadata to avoid duplication and keep the emitter contract consistent.

Why is my Go field missing from the generated OpenAPI spec?

The field likely carries swaggerignore:"true", or the controller Metadata does not reference the struct as a zero value in Request or Response. The emitter only discovers schemas through Metadata and skips swaggerignore fields by design.