Generate your first schema
Pin the Go tool, register a type, generate, validate, and commit the outputs.
Agent quickstart
npx skills add tylergannon/polytypeGenerate your first schema
Pin the Go tool, register a type, generate, validate, and commit the outputs.
Model missing and null
Choose ordinary fields, Optional[T], or Nullable[T] without guessing.
Enums and interfaces
Teach tool schemas named values and discriminated implementations.
Validate and prevent drift
Validate LLM output and make CI reject stale generated schemas.
Ship a Go ↔ JavaScript transport
Generate strict Go codecs for the devalue wire format SvelteKit speaks.
Build your own projection
Lower any Go types into the shared type grammar and emit a new target.
polytype lowers Go types, statically at go generate time, into one closed
type grammar and projects it into whatever the boundary needs:
| Projection | How |
|---|---|
| JSON Schema, embedded in Go, for LLM tool calls and structured output | go tool polytype (always on) |
ValidateJSON methods |
--validate |
| Go JSON codecs: membership-checked enums and discriminated sealed unions | Inferred from the types; no flag |
| Structural TypeScript declarations | --typescript DIR, or the typescript package |
| devalue transport: Go runtime port plus generated typed codecs | devalue, devalue/codegen packages |
| Your own backend | grammar, typegrammar packages |
additionalProperties: false in schemas, strict decoders elsewhere.Optional[T] removes a property from required.any.Need exact exported signatures? The generated Go API reference is available, but most integrations should begin with Getting started.