/pmstack:pmstack-build-judgefrom pmstack: Eval Studio for product managers
Builds an AI judge prompt for one failure mode from labeled traces, validates prerequisites, writes Pass/Fail rules with examples, and saves it as a check in the pmstack project.
Ships in pmstack: Eval Studio for product managers. 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.
None: SKILL.md is the whole skill.
An AI judge is a prompt that reads one trace and answers Pass or Fail for exactly one failure mode, writing its critique before its result. This skill writes the judge, saves it as a check, and runs it on the tuning set. pmstack-test-judge then reads the disagreements and runs the final test. Work through the phases in order and tell the user in one line what each phase did.
Words used here:
experience.userLabel (patient, customer, employee).Examples use the Maple Dental booking assistant (patients book, move, or cancel appointments by text, web chat, or phone; tools include find_slots, book_appointment, and transfer_to_staff).
Locate the pmstack command line. Replace <skill-dir> with this skill's base directory (Claude Code shows it as "Base directory for this skill") and keep the quotes:
PMSTACK=""
for p in "<skill-dir>/../../../.pmstack/bin/pmstack.mjs" "<skill-dir>/../../bin/pmstack.mjs" "$HOME/.pmstack/bin/pmstack.mjs"; do
[ -f "$p" ] && PMSTACK="$p" && break
done
If none is found, the reviewer builds the judge in Eval Studio in the browser (https://ryanalberts.github.io/pmstack/studio/, Checks tab), which copies judge prompts in batches of 10 for any AI assistant and reads the pasted answers; guide them through the same phases. Never install npm packages.
Set PROJECT to the project file (<folder>/pmstack/project.json). Save the helper at the end of this file as pmstack-judge-helper.mjs in a temporary directory outside the project folder, and set HELPER to its path.
Studio running means <folder>/pmstack/.studio.json names a live process:
node -e 'try{const s=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8"));process.kill(s.pid,0);console.log("running "+s.url)}catch(e){console.log(e.code==="EPERM"?"running":"stopped")}' "$(dirname "$PROJECT")/.studio.json"
While it runs, build the judge in Eval Studio and leave project.json to the studio. pmstack judge is safe at any time: it saves through the project lock, and the studio merges its results.
Questions: when the user must choose, give 2 to 5 lettered options in plain words. When one option is better, put it first, marked "(recommended)" with its reason. Accept a single letter. When the files already answer a question, state what you found and continue.
Candidates are failure modes with decision check and no check yet, highest priority first (traces x severity weight: Blocks 3, Hurts 2, Annoys 1). Ask:
Which failure mode gets a check next? A. Ignores requests for a person (recommended: highest priority, 7 traces, blocks the patient, no check yet) B. Offers a time that is taken (5 traces, blocks the patient) C. Books before the patient confirms (6 traces, hurts the patient)
| Prerequisite | How to check | When it is missing |
|---|---|---|
| The failure mode came from error discovery and has a "Fails when" definition | modes in project.json, kind failure | Load pmstack-find-failures |
| The product's instructions ask for this behavior | The mode's instructed is yes; otherwise read the system instructions and quote the line | Fix the instructions first. Build a judge only if it keeps failing after the fix, or the failure is critical |
| No simple rule can decide it | The table below | Build a code check in the Checks tab instead |
| At least 20 Problem and 20 Good labels | node "$HELPER" "$PROJECT" "$PMSTACK" labels <modeId> | Label more in the Checks tab ("Label more traces for this failure mode"); aim for about 50 of each |
A code check is a rule a computer can test: faster, free to run, and it never drifts. Use one whenever a visible pattern decides the failure:
| Maple Dental failure mode | Check | Why |
|---|---|---|
| Stray ** symbols in texts | Code check: "Text matches a pattern" (formatting symbols) on everything the AI said, only for traces where channel is sms | The symbols are characters on the screen |
| Answers billing questions itself | Code check first: "Text contains any of" insurance, copay, bill, balance on the AI's last message; move to a judge if its false alarms stay high | A word list catches most cases |
| Ignores requests for a person | AI judge | It must read what the patient meant ("can someone just call me") and whether the assistant transferred |
| Books before the patient confirms | AI judge | It must decide whether the patient agreed to one specific time before book_appointment ran |
Done when all four prerequisites hold. Otherwise route as the first table says and stop. With fewer than 60 labels in total the agreement numbers swing widely, so say so whenever you report them.
transfer_to_staff."modes while no studio runs) so the judge and the labels share one definition.The inputs are customer (what the {userLabel} and the AI said), tools (tool calls and results), retrieval (documents found), metadata (the details listed in filters, such as channel), and context (what the AI was given). Give the judge only what it needs to decide: extra text costs more and distracts it.
| Failure mode | Inputs | Why |
|---|---|---|
| Ignores requests for a person (Maple Dental) | customer, tools, metadata | The request, whether transfer_to_staff ran, and the channel |
| Books before the patient confirms (Maple Dental) | customer, tools | The patient's agreement and the book_appointment call |
| Cites a source that does not support the claim (policy answer bot) | customer, retrieval | The answer and the documents it cites |
| Wrong tone for the persona (sales email writer) | customer, metadata, context | The email, the prospect's role, and the brief |
Use an exact, dated model version, such as claude-haiku-4-5-20251001. An alias that moves (a "latest" name, a bare family name) lets a provider update change the judge's answers silently. Start with a model strong enough to agree with the reviewer; try a cheaper one only after validation, and validate again after any switch.
Use a check id of ck- plus a short slug, such as ck-person-judge.
checks in project.json to confirm the saved prompt and model.node "$HELPER" "$PROJECT" "$PMSTACK" save <modeId> <checkId> "<name>" <model> <inputs> (inputs comma-separated). It assigns splits for new labels, builds the prompt with pmstack's own engine, saves the check through the project lock, and prints the split counts and the prompt. Running it again with the same check id rebuilds the prompt and keeps results.Read the prompt and confirm it has:
{"critique": "...", "result": "Pass"} or "Fail", and nothing else.{{trace}} placeholder where each trace goes.When examples or critiques are missing, add "Why?" lines in the labeling drawer, then regenerate ("Reset to generated" in the studio, or the save command again). A hand-edited prompt keeps items 4 and 5 exactly.
Tell the user how many traces will be judged and with which model, then run:
node "$PMSTACK" judge "$PROJECT" --check ck-person-judge --split tuning --cmd "claude -p --model {model}" --batch 10
node "$PMSTACK" agreement "$PROJECT" --check ck-person-judge --split tuning
--cmd is any command that reads the prompt on standard input and prints the answer; {model} becomes the check's pinned model. --batch 10 judges 10 traces per call. The examples split is never sent. Results save as they arrive and appear in the studio.
Report both numbers in plain words: "Catches real failures: 89% (8 of 9). Agrees on good traces: 95% (21 of 22)." The target is both above 90%, with 80% as the minimum. Always give both: a judge that always says Good scores 100% on the second and 0% on the first.
Then load pmstack-test-judge to read every disagreement, improve the prompt on the tuning set, and run the final test once.
--split test: the final test belongs to pmstack-test-judge and runs once.project.json while the studio runs.Save as pmstack-judge-helper.mjs outside the project folder. It needs Node 20 and the pmstack command line.
// pmstack-judge-helper.mjs: label counts and saving a judge check with pmstack's engine.
// node pmstack-judge-helper.mjs <project.json> <pmstack.mjs> labels <modeId>
// node pmstack-judge-helper.mjs <project.json> <pmstack.mjs> save <modeId> <checkId> "<name>" <model> [inputs]
import { pathToFileURL } from "node:url";
const [projectPath, cliPath, command, modeId, checkId, name, model, inputList = "customer,tools,metadata,context"] = process.argv.slice(2);
const { loadProjectFile, saveProjectFile } = await import(pathToFileURL(cliPath).href);
const lib = await import(new URL("../docs/studio/lib/index.mjs", pathToFileURL(cliPath)).href);
let p = await loadProjectFile(projectPath);
const labels = lib.labeledSet(p, modeId);
const problems = labels.filter((l) => l.label === "fail").length;
console.log(`Labels for ${modeId}: ${problems} Problem, ${labels.length - problems} Good.`);
if (command === "save") {
const existing = (p.checks ?? []).find((c) => c.id === checkId);
if (existing?.promptEdited) throw new Error(`${checkId} has a hand-edited prompt. Change it in Eval Studio or use a new check id.`);
p = lib.assignSplits(p, modeId); // keeps existing assignments; places new labels
const inputs = inputList.split(",");
const check = {
results: {}, unreadable: [], test: null, runs: [], ci: false, runMode: "batch", ...existing,
id: checkId, modeId, type: "judge", name, model, inputs, promptEdited: false,
prompt: lib.buildJudgePrompt(p, modeId, { inputs }),
};
const checks = existing ? p.checks.map((c) => (c.id === checkId ? check : c)) : [...(p.checks ?? []), check];
p = { ...p, checks, updatedAt: new Date().toISOString() };
await saveProjectFile(projectPath, p);
console.log("Splits:", JSON.stringify(lib.splitCounts(p, modeId)));
console.log(check.prompt);
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ai-judge, failure-mode, trace-evaluation, prompt-engineering
npx claudepluginhub ryanalberts/pmstack --plugin pmstack12 skills in this plugin
/pmstack-check-sourcesChecks an answer bot that searches documents by testing the search and the answer separately. Reviews full traces first, has the reviewer mark the sources each answer needed, measures the search with Recall@k and mean reciprocal rank, fixes search before the answer step, then builds one judge for answers backed by their sources and another for answers that address the question. Use when a product answers questions from a document collection, knowledge base, help center, or search results, when its answers cite sources, or when someone mentions RAG./pmstack-custom-viewMakes Eval Studio draw each trace the way the user saw it when no built-in view fits. Chooses between a panel layout in the product setup and a custom view file in pmstack/renderers/, writes it, and confirms it renders in the studio. Use when traces look like raw fields in Review traces, or when the product's output is not a chat, text message, phone call, email, document, answer with sources, agent steps, code review, form fields, or ranked list./pmstack-evals-checkupGives an existing AI eval setup a checkup and returns findings ordered by product impact, each with evidence and a fix. Looks at six areas: where the failure modes came from, how checks are designed, whether judges were measured against human labels, who reviews and what they see, how many labels exist, and whether checks stay current. Use when inheriting evals, when a team reports AI quality scores nobody has verified, or before a release decision rests on eval numbers./pmstack-find-failuresFinds how an AI product fails, with a person reviewing real traces in Eval Studio. Finds or creates a trace file, sets up a pmstack project (how traces look, the product's stages, filters), starts the local studio, watches reviews as they come in, and suggests likely problems, groupings, and the next traces to read for the reviewer to accept or dismiss. Reports coverage and when new failure modes stop appearing, and helps rank failure modes by stage and severity. Use when someone has traces, logs, or conversation exports from an AI feature and wants to know how it fails, asks for an error analysis, wants help reviewing traces, or needs to start saving traces from an app./pmstack-make-tracesMakes realistic test traces for an AI product that has few or no real ones: writes test requests, runs them through the product, and saves the results as traces ready to review in Eval Studio. Starts from three ways the product is likely to fail, checks 20 combinations with the user, writes one request per combination with a separate model call, drops unrealistic ones, confirms each scenario can happen in the test setup, and tags every trace with its values so Eval Studio can filter by them. Use when a product has not launched, real traces are too few to review, or someone wants to probe a known rare failure before users hit it./pmstack-regression-checksKeeps known failures from coming back and keeps watching for new ones. Builds a regression set from a pmstack project, replays it through the product on every code change and runs code checks with pmstack check, samples production traces for a tested judge's likely true failure rate, and schedules a fresh round of trace review after big changes. Includes a GitHub Actions example. Use when a failure mode is fixed or has a check, when adding AI checks to a build pipeline, or when monitoring AI quality in production.Other plugins' skills for the same job