zoglisted
Install: claude install-skill xobotyi/cc-foundry
Zog is a Zod-shaped API over Go semantics, and the two disagree in ways that still compile. Import as
`z "github.com/Oudwins/zog"`. Three biases decide most calls:
- **A remembered Zod default is a defect until checked.** Fields are optional by default, `z.Enum` does not exist, and a
schema key names a Go struct field rather than an input key.
- **`Parse` and `Validate` disagree about what missing means**, and that disagreement decides which tests in a chain run
at all.
- **Zog panics on a schema its author built wrong, and never on input data.** A panic is a defect in the schema
definition, fixed there.
## Schema Shape
- **A `z.Shape` key names a Go struct field, never an input key.** The first letter is case-corrected, so `"name"` and
`"Name"` both bind to `Name`. A key matching no field panics with
`Struct Schema Definition Error ... missing expected schema key`.
- **Struct tags map input keys and nothing else.** Resolution runs `json`, `form`, `query`, or `env` for the source in
use, then `zog`, then the schema key as written.
- **`z.Struct(...).Required()` and `.Optional()` compile and do nothing.** An optional nested struct needs
`z.Ptr(z.Struct(...)).NotNil()`.
- **Wrap the schema in `z.Ptr` wherever the destination field is a pointer.** A `z.Slice(...)` against a `*[]T` field
panics with a type-cast error.
- **`z.Ptr` carries only `.NotNil()`.** Put `Required`, `Default`, `Catch`, `Test`, and `Transform` on the inner schema.
- **Declare every schema