schema_implementation_guide

schema_implementation_guide is a cursor rule for Cursor from kaptinlin/gozod. It costs 5,523 tokens per session, scanned A, original, MIT.

An implementation guide for adding schema types to GoZod, a Go library that checks and parses data against defined structures. It explains strict type handling, shared parsing engines, immutable modifiers, file organization, and required helper packages.

In plain words
What is it for?
Use it when building or reviewing GoZod schema types, implementing Parse and StrictParse methods, adding modifiers, writing tests, and connecting code to the library’s parsing engine.
Why use it?
It helps new schema code behave consistently, remain type-safe, and avoid duplicated parsing or validation logic. It also gives coding agents and contributors patterns to follow.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when building or reviewing GoZod schema types, implementing Parse and StrictParse methods, adding modifiers, writing tests, and connecting code to the library’s parsing engine.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kaptinlin/gozod/schema_implementation_guide
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/kaptinlin/gozod

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for schema_implementation_guide

README.md
[![agentmods](https://agentmods.dev/badge/rules/kaptinlin/gozod/schema_implementation_guide/github.svg)](https://agentmods.dev/rules/kaptinlin/gozod/schema_implementation_guide)
Your own site
<a href="https://agentmods.dev/rules/kaptinlin/gozod/schema_implementation_guide"><img src="https://agentmods.dev/badge/rules/kaptinlin/gozod/schema_implementation_guide/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for schema_implementation_guide

Your own site · 80×15
<a href="https://agentmods.dev/rules/kaptinlin/gozod/schema_implementation_guide"><img src="https://agentmods.dev/badge/rules/kaptinlin/gozod/schema_implementation_guide.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,523 This file is loaded in full into every session.
When invoked 5,523 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.05523 $0.05523
Opus 5.5 $0.02209 $0.02209
Sonnet 5.5 $0.01105 $0.01105
Haiku 4.5 $0.00552 $0.00552

Measured 1mo ago against content hash ef80d12e7634, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

schema_implementation_guide scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/rules/schema_implementation_guide.mdc · 645 lines

How it starts

The opening of the file, as written. The whole thing — 645 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GoZod Schema Implementation Guide

A practical reference for building new schema types inside the GoZod code-base.
It targets Cursor AI and human contributors alike: every rule here exists to keep implementations consistent, type-safe and performant.

This guide is based on the latest patterns from string.go, object.go, and their test counterparts.


1 Core Principles

  1. Complete Strict Type Semantics – All methods require exact input types, zero automatic conversions. Both Parse(any) and StrictParse(T) must be implemented.
  2. Zero-overhead abstractions – primitives allocate nothing, composites allocate lazily.
  3. Unified architecture – every file follows the same 8-section layout so Cursor can pattern-match and extend it.
  4. Copy-on-Write modifiers – modifiers clone internals; the original instance is immutable.
  5. Engine-first architecture – All parsing must go through engine.ParsePrimitive or engine.ParseComplex.
  6. Mandatory helper packages – never roll your own validation, parsing, coercion or error logic.

2 Type Classification Cheat-Sheet

Scenario Architecture Generic pattern Example
Native Go value (string / int…) Single generic + constraint ZodType[T Constraint] Constraint: T | *T Bool, String, Float
Requires value comparison (==) Comparable + dual generic ZodType[T comparable, R any] Enum, Literal
Composite / user struct / slice Dual generic ZodType[T any, R any] Struct, Slice, Map

Decision flow ▶ Native? → Comparable? → Composite.


3 Mandatory 5-Section File Layout

Every schema file must keep sections in this exact order for consistency:

  1. TYPE DEFINITIONS – Constraints, ZodTypeDef, ZodTypeInternals, public ZodType[T]
  2. CORE METHODS – GetInternals, IsOptional, IsNilable, Parse, StrictParse, MustParse, MustStrictParse, Coerce
  3. MODIFIER METHODS – Optional, Nilable, Default, Prefault, Overwrite, Transform, Pipe
  4. VALIDATION & REFINEMENT – Type-specific validations (Min, Max, Email, etc.), Refine, RefineAny, Check
  5. CONSTRUCTORS – Type(), TypePtr(), CoercedType(), constructor helpers

Read the full file on GitHub · 645 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 645 lines · 5,523 tokens per session scan A ef80d12e7634

Subscribe to this mod's changes

schema_implementation_guide is a cursor rule published in the GitHub repository kaptinlin/gozod (25 stars, last pushed 2mo ago), licensed MIT. It adds 5,523 tokens to every session, about $0.0221 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.