/prompt2jev:prompt2jevfrom prompt2jev
Converts LLM prompts, prompt templates, or prompt-and-parse code into TypeSafe Jev typed decisions. Handles classifiers, routers, judges, graders, extractors, and guardrails.
Ships in prompt2jev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Jev is TypeSafe's System One model. It evaluates typed questions against a state
and returns probabilities, not prose. Code owns control flow. The input is one of
three things: a requirement in natural language with no prompt yet, an LLM prompt
(system prompt, template, or prompt-and-parse step), or the code that runs one today,
with its parser and the branches on its output. Converting any of them means moving
each judgment into its own question, moving every rule code can compute into code,
and leaving generation with a generative model. The bundled references distill the
TypeSafe docs; when live docs are reachable, https://docs.typesafe.ai/llms.txt is the
source of truth for the API contract.
Produce the conversion package. It has five parts, in this order, every time:
choice, noul, score, code, keep-llm, or drop, with the question id or
the code rule it became. Nothing in the prompt goes unaccounted for.{"model", "state", "questions"}, saved to
a file and validated with prompt2jev validate --strict before it is shown.prompt2jev code request.json --lang <lang> --output <file>, then replace the
return in decide() with the branching from part 1. The file has imports, the
constants block (every threshold, weight, and hard rule), the questions, one call
that sends the request, decide(), and an entry point; it compiles, and it runs
on the example state. Language rule: Python gets the official typesafe_sdk
(--lang python); JavaScript and TypeScript projects get @typesafe-ai/sdk
(--lang javascript, an ES module saved as .mjs; the SDK ships its own
types); any other language, or a Python environment that cannot
install packages, sends the HTTP request directly, with --lang python-stdlib
or --lang curl as the reference (see api.md). When the
user asks only for the request, part 3 is the deliverable and this part is one
line on how to send it.When the user asks for a script, a module, a program, or "code I can run", the
answer is the path of the file from part 4 plus the output of running it: the real
output when a key is present and the user approved a paid call, otherwise the
--dry-run request and the exact command to run once a key exists.
Collect before designing: the prompt text, every placeholder and where its value comes from, the parser or schema that reads the output, the code that branches on each output field, existing enums or label lists, and any tests or labeled examples. In a codebase, grep for the prompt string, the output field names, and the API call that sends it.
Ask the user only when a gap changes the shape of a question: the label set, what the code does with an answer, or the stakes of a wrong answer. Ask one question at a time. A gap that does not change the shape becomes a stated assumption in part 5. Never stop with nothing delivered; a validated draft with assumptions beats a question.
Read the prompt sentence by sentence and classify each instruction:
| Instruction in the prompt | Becomes | Why |
|---|---|---|
| "X must be one of: a, b, c" | choice with those options plus a fallback | One option from a known set |
| "Set flag if the message ..." | noul | One yes/no proposition |
| "Rate ... from 1 to 5", "how severe" | score with described levels | A position on a spectrum |
| "If A and B then ..." | one question per condition, combined in code | Compound conditions hide judgments |
| Arithmetic, comparisons, dates, counting, thresholds | code | Jev is not a calculator |
| "Extract the invoice number" | candidates found in code, then choice over them | Select, never generate |
| "Summarize", "write a reply", "explain" | keep-llm | Generation stays with a generative model |
| "Return JSON only", output format rules | drop | The answer is already typed |
| Policy text, reference material, examples | state fields or structured criteria | Evidence and boundaries, not questions |
"Escalate if a refund is requested and the amount is over 100 and the purchase is
older than 30 days" becomes one noul (refund requested) plus two comparisons in
code. "Priority is p0 when the plan is enterprise and urgency is at least 4" is
entirely code once urgency is a score.
state is a JSON object with a named field for each input the questions need and
nothing else. Placeholders in the prompt become fields. Reference material the
prompt inlined (a refund policy, a rubric the model compares against) becomes a
field. Values the code already knows (plan, amount, dates) go in only if a question
needs them; otherwise they stay in code. Keep untrusted content (tickets, pages,
pasted text) in fields separate from trusted policy. Jev does not see the
conversation, so each request must be self-contained.
Mind the size: the state plus the longest question must stay under 32k tokens, and everything together under 64k. Filter in code first; unrelated detail lowers accuracy.
Rules for every question:
instructions.ticket.text ask for a refund?"criteria, and keep criteria aligned with instructions.instructions when the question needs data or focus:
{"question": "...", "focus": "Classify the primary request only."}.Per type:
other or not_stated when the list may not cover every input.
Use {"what", "not_for", "examples"} objects for options that get confused.criteria.true and criteria.false when the boundary is subtle. A Noul near 0.5
means unsure, not "medium".A Choice is relative (which option is best); a Noul is absolute (does this hold). Use both when "best candidate" and "any acceptable candidate" are different questions.
Put every independent question in one request, including speculative ones whose answers only matter on some branches (bug severity when the category might not be bug). Questions run in parallel and cannot see one another's answers. Make a second request only when its state depends on a first answer: fetching more evidence, building new state, or choosing the next options.
Start from the generated file (part 4). Its constants block holds MODEL, the
confidence floor, and the Noul thresholds; its read_choice, read_score, and
read_noul helpers turn each answer into a value plus a band. Keep every new
threshold or weight in that block so a reviewer can read the whole decision in one
place. Then, in decide():
noul values in code; a Noul has no separate confidence. Do not reuse
a Choice confidence threshold for a Noul.model field. Pin a versioned id once thresholds are tuned.See composition.md for the generated file's anatomy, the SDK call shapes, the HTTP shape for other languages, and a full routing example.
python3 <skill-dir>/scripts/prompt2jev.py validate request.json --strict
python3 <skill-dir>/scripts/prompt2jev.py code request.json --lang python --output decide.py
python3 -m py_compile decide.py # after editing decide()
python3 <skill-dir>/scripts/prompt2jev.py run request.json --dry-run
python3 decide.py # live: TYPESAFE_API_KEY in the environment
validate checks the contract and lints against the rules above (fallback option,
numeric levels, compound or negated Nouls, math in a question, unreferenced state
fields, oversized state). The lint is heuristic: fix every warning, or when a
question is right as written (a closed set such as months needs no fallback; "terms
and conditions" is one phrase), suppress that code with --allow CODE and say why
in part 5. code writes the runnable file for the language (python,
python-stdlib, javascript, curl). It checks the contract and prints lint
findings first, so a request that breaks the contract never becomes code; run it
after validate --strict so lint warnings are already gone. With a key present and
the user's approval, run
the file once on the example state and paste its real output, then run a small
labeled sample, tune thresholds on it, and evaluate on held-out cases. Write
fixtures for each branch, including inputs where the model should abstain.
Resolve <skill-dir> to the folder containing this file. The script needs only
Python 3.10+. After uv tool install or pipx install of the repository,
prompt2jev is on PATH and replaces python3 <skill-dir>/scripts/prompt2jev.py.
prompt2jev setup # which keys are present; prints no values
prompt2jev template classify-route > request.json # start from an archetype
prompt2jev validate request.json --strict
prompt2jev code request.json --lang python --output decide.py # or --lang javascript --output decide.mjs, python-stdlib, curl
prompt2jev run request.json --dry-run
prompt2jev run request.json # live call: TYPESAFE_API_KEY, model jev-latest
prompt2jev run request.json --provider openrouter # OPENROUTER_API_KEY, model typesafe/jev-1.13
Keys come from the process environment only; never paste one into chat, a request file, a generated script, or a repository. A live call costs money and sends the state to the provider, so confirm before the first one. Without a key, stop at a validated request plus the generated file and point the user to https://console.typesafe.ai/keys. Do not simulate Jev output: an output shown to the user is the output of a command that ran.
Archetypes: classify-route, checklist-guardrail, rubric-composite,
extract-select, verify-claim. Each is a validated request to copy and edit.
| Need | Read |
|---|---|
| Worked conversion, start to finish | playbook.md |
| Rules and anti-patterns per primitive, known failure modes | question-design.md |
| Request and response fields, endpoints, models, limits, errors, HTTP from any language | api.md |
| The generated file's anatomy, confidence bands, weights, fan-out, SDK code in Python and JS | composition.md |
| Before and after pairs for common prompt shapes | examples.md |
Stop and rework if you notice any of these:
["1", "2", "3"] or "low / medium / high".assets/checklist-guardrail.json (opens in a new tab)assets/classify-route.json (opens in a new tab)assets/extract-select.json (opens in a new tab)assets/rubric-composite.json (opens in a new tab)assets/verify-claim.json (opens in a new tab)references/api.md (opens in a new tab)references/composition.md (opens in a new tab)references/examples.md (opens in a new tab)references/playbook.md (opens in a new tab)references/question-design.md (opens in a new tab)scripts/prompt2jev.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub sumleo/prompt2jev --plugin prompt2jev