# Schema To Go

> A skill that converts JSON Schema to Go struct definitions.

- Skill: `kilianpaquier/schema-to-go` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kilianpaquier/schema-to-go`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kilianpaquier/schema-to-go/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: kilianpaquier (https://skillmd.com/u/kilianpaquier)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kilianpaquier/schema-to-go

---


Generate inside `$package-path` in the file `$package-name.go` the Golang structures according to the local JSON Schema `$schema-path`.
The generation must follow the coding structure provided below.

## Code structure

```go
// Code generated by AI ({ModelVersion}).

package $package-name

// ObjectName <object description>.
type ObjectName struct {
  // PropertyName <the property description>.
  PropertyName <the property type> `json:"propertyName,omitempty" yaml:"property_name,omitempty"`

  // EnumName <the enum description>.
  //
  // Enums:
  //  - <value>
  //  - <value>
  //
  // Examples:
  //  - <value>
  //  - <value>
  EnumName <the enum type> `json:"enumName,omitempty" yaml:"enum_name,omitempty"`

  // ChildObject <object description>.
  ChildObject *ChildObject `json:"childObject,omitempty" yaml:"child_object,omitempty"`

  // ArrayName <array description>.
  ArrayName []<the array type> `json:"arrayName,omitempty" yaml:"array_name,omitempty"`
}

// ChildObject <object description>.
type ChildObject struct {
  ...
}
```

- In case of `allOf` with `$ref`, merge both objects into the same `struct` (fields must be sorted alphabetically).
- Respect the GoDoc format: A GoDoc comment always start with the property name, field name, struct name and ends with a dot.
- Respect the GoDoc format: Adapt the first word(s) of descriptions to avoid repetitions or non-conjugated (third singular person) sentences.
- Struct fields must be sorted exactly as ordered in the schema.
- Add newlines between `struct` fields.
- Add newlines when a description has newlines (same places).
- No need to create method for 'default' or 'enum' to verify the validity of fields.
- No need to parse conditions 'if', 'else'.
- Replace `{ModelVersion}` by the current AI model and version used to generate the files (*e.g.* 'Claude Sonnet 4.6', etc.).

## Constants

For all 'enums' values, the available values must be created as `const` inside `constants.go` with below code structure.

```go
// Code generated by AI ({ModelVersion}).

package $package-name

const (
  EnumName<Option Name> = <value>
)

const (
  AnotherEnumName<Option Name> = <value>
)
```

- All constants must be sorted alphabetically within a `const (...)` section.
- Never add unnecessary prefixes (*e.g.* 'CI...').
- Replace `{ModelVersion}` by the current AI model and version used to generate the files (*e.g.* 'GPT-5-Codex', 'Claude Sonnet 4.0', etc.).

