JSON Schema → LLM-ready prompt fragment + output validator. Paste a schema, copy the prompt fragment your LLM consumes for structured output, paste back what came out, see if it conforms.
From the Thoughtworks Technology Radar Vol 34 (Adopt, April 2026): Structured output from LLMs.
Live demo: https://sen.ltd/portfolio/schema-prompt/
- Schema → prompt fragment: turns properties / types / constraints into natural-language bullets the LLM consumes (the same shape Instructor / Pydantic AI / Outlines produce internally)
- Synthesized example output: shows the JSON shape the LLM should produce — useful as a few-shot anchor in the prompt
- Validator panel: paste the LLM's response, see per-field errors with paths (
$.user.age — −5 < minimum 0) - 5 real-world preset schemas: sentiment + confidence, address parsing, meeting summary, entity extraction, product extraction
- Pure prompt generator + validator (33 unit tests), no LLM API calls, no build step, no dependencies
npm run serve
# → http://localhost:8080npm testprompt.js ← Schema → LLM prompt + example generator (15 tests)
validate.js ← JSON Schema validator subset for LLM output (18 tests)
presets.js ← 5 real-world schemas + matching sample outputs
app.js ← UI glue (schema → prompt + example, output → validation)
prompt.js と validate.js は DOM 非依存。document も window も触らない。Node テストでスキーマ生成 + バリデーション両方を完全検証してから UI を組む。
LLM workflow が使う構文だけに絞っている:
type(string/number/integer/boolean/array/object/null+ union)properties+requireditems+minItems/maxItemsenum/constminimum/maximumminLength/maxLengthpattern(regex)format(hint only — no validation)description(used by prompt generator)
意図的に対応していないもの: oneOf / anyOf / allOf / $ref / additionalProperties の厳格チェック (LLM 出力では実用上不要)。
MIT. See LICENSE.
