JSON Schema Generator skill for Claude and Codex
A strict, valid JSON Schema inferred from one sample payload: correct types and nesting, required and additionalProperties set the way you want, formats and…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a sample JSON payload or API response needs a strict JSON Schema for request validation, with required fields, formats, and enums inferred and the guesses flagged. Do not use for TypeScript type generation, OpenAPI documents, or GraphQL schemas. Related topics: coding, api, utility.
What it will ask you for
- Sample JSON (longer free text)
- Schema draft (choose one: Draft-07, Draft 2019-09, Draft 2020-12)
- What the payload is (free text, e.g. "an order webhook body or a user profile response")
- Mark all fields required (choose one: Yes, No)
- Allow additional or unknown properties (choose one: Yes, No)
- Constraints to infer (choose any: Min/Max length for strings, Minimum/Maximum for numbers, Enums based on values, Date/Time formats, Email and URI formats, Array item limits)
- Add titles and descriptions (choose one: Yes, No)
How it works
- Walk the sample recursively and assign each value its precise type, distinguishing integer from number, null from absent, and arrays from tuples.
- Merge multiple samples so inconsistent fields become optional, mixed types become type lists, and repeated values become enum candidates.
- Apply the required and additionalProperties toggles at every object level and factor repeated objects into definitions for the chosen draft.
- Infer only the selected constraint kinds and only where the sample justifies them, keeping every keyword valid for the draft.
- Output the schema and list each inferred constraint or enum that rests on limited evidence.
What you get
One fenced json block with the complete schema for the chosen draft, followed by a bullet list of inferred constraints and enums to review.
What it watches out for
- Turning the three values seen in one sample into a closed enum, which rejects the fourth legitimate value in production.
- Setting minLength and maxLength from a single string, which makes the schema fail on any other valid input.
- Using $defs and unevaluatedProperties in a Draft-07 schema, which the validator ignores or rejects.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.