Skip to main content
AIDiveForge AIDiveForge
🧬

JSON Schema Builder

Data Extraction & Parsing · by AIDiveForge · Apr 17, 2026 · Intermediate · ✓ 1 verified compat

Infer a conservative JSON Schema from examples and explain uncertain constraints.

Get a draft-2020-12 schema and validation cases.

Free · 2 KB · SKILL.md, instructions and example files. Provide examples and any explicit business constraints; jsonschema is optional for local validation.

A worked example

A small example to try before using your own data.

Input

{
  "examples": [
    {
      "id": 1,
      "note": null
    },
    {
      "id": 2,
      "note": "ok"
    }
  ],
  "contract": "id is required; note is optional; no additional keys"
}

Expected result

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id"
  ],
  "additionalProperties": false
}

What to check: Both examples validate; an object without id and an object with an extra key are rejected.

Limits: Examples cannot reveal every valid future value. The schema is a proposal until the contract owner confirms it.

Worked example included. Model-specific performance and vendor compatibility have not been benchmarked.

Installation options and other formats

Install this skill

An agent skill starts with SKILL.md. The ZIP also includes its examples and any helper scripts. Drop the file into your tool of choice — or pick a different format if you use Cursor, Windsurf, Copilot, or something else.

Download SKILL.md
python3 - <<'ADF_SKILL_INSTALL'
import hashlib, io, os, stat, tempfile, urllib.request, zipfile
from pathlib import Path, PurePosixPath
folder = "json-schema-builder"
root = Path(os.environ.get('ADF_SKILL_ROOT', str(Path.home() / '.claude' / 'skills'))).expanduser()
destination = root / folder
if destination.exists() or destination.is_symlink():
    raise SystemExit('An installation already exists. Back it up and merge the ZIP deliberately.')
root.mkdir(parents=True, exist_ok=True)
request = urllib.request.Request("https://aidiveforge.com/skill/json-schema-builder.zip", headers={'User-Agent': 'AIDiveForge-Resource-Installer/1.0 (+https://aidiveforge.com/skills/)'})
with urllib.request.urlopen(request, timeout=30) as response:
    data = response.read(8 * 1024 * 1024 + 1)
if len(data) > 8 * 1024 * 1024 or hashlib.sha256(data).hexdigest() != "8645f76c6c78b63abf8f0ff04d194d9500f6cbabdcae54942c0d745345509b74":
    raise SystemExit('The download did not match this reviewed bundle. No files were installed.')
with zipfile.ZipFile(io.BytesIO(data)) as archive, tempfile.TemporaryDirectory(prefix='.adf-skill-', dir=root) as temporary:
    members = archive.infolist()
    if len(members) > 100 or sum(m.file_size for m in members) > 16 * 1024 * 1024:
        raise SystemExit('Unexpected archive size')
    for member in members:
        name = PurePosixPath(member.filename)
        if name.is_absolute() or '..' in name.parts or not name.parts or name.parts[0] != folder or '\\' in member.filename or stat.S_ISLNK(member.external_attr >> 16):
            raise SystemExit('Unsafe archive entry; nothing was installed')
        target = Path(temporary).joinpath(*name.parts)
        if member.is_dir():
            target.mkdir(parents=True, exist_ok=True)
        else:
            target.parent.mkdir(parents=True, exist_ok=True)
            with target.open('xb') as stream:
                stream.write(archive.read(member))
    staged = Path(temporary) / folder
    if not (staged / 'SKILL.md').is_file() or destination.exists() or destination.is_symlink():
        raise SystemExit('The skill could not be installed without replacing existing data')
    os.rename(staged, destination)
print('Installed the complete skill folder:', destination)
ADF_SKILL_INSTALL

Claude Code: ~/.claude/skills/json-schema-builder/SKILL.md. Codex: ~/.codex/skills/json-schema-builder/SKILL.md. Keep the complete ZIP folder when helper scripts are included.

🧠 Why it works

Both examples validate; an object without id and an object with an extra key are rejected.

⚙️ How it works

  1. Inventory every observed property and type across all examples, including absent keys and null values.
  1. Require a property only when the supplied contract says it is required; presence in a small sample is not sufficient evidence.
  1. Use explicit types and item schemas. Do not infer enums, numeric limits or formats from incidental sample values.
  1. Validate each supplied example and at least one intended rejection case using an available validator.
  1. List choices that need confirmation, including additional properties and missing versus nullable values.

Description

Get a draft-2020-12 schema and validation cases.

Provide examples and any explicit business constraints; jsonschema is optional for local validation.

Limits: Examples cannot reveal every valid future value. The schema is a proposal until the contract owner confirms it.

Recommended Use

Tools and workflow packs this skill pairs well with. Forge picks are auto-generated from category + capability signals; Community picks are added by people who've used the pairing.