From promptfoo
Writes, refines, runs, and QA non-redteam promptfoo eval suites: prompts, vars, test cases, assertions, model-graded rubrics, transforms, datasets, output exports, filters, and CI gates.
How this skill is triggered — by the user, by Claude, or both
Slash command
/promptfoo:promptfoo-evalsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Build a small eval that answers one product question clearly, run it with fresh
Build a small eval that answers one product question clearly, run it with fresh results, then inspect the exported artifact before expanding.
Read references/eval-patterns.md when you need concrete YAML patterns,
assertion examples, or CI snippets.
For deep promptfoo feature questions that are not covered here, consult
https://www.promptfoo.dev/llms-full.txt.
Infer these from the repo or user prompt:
promptfoo-provider-setup is
needed first.If the provider does not work yet, switch to promptfoo-provider-setup. If the
task is adversarial security scanning, switch to promptfoo-redteam-setup or
promptfoo-redteam-run.
Search for existing configs first: promptfooconfig.yaml,
promptfooconfig.yml, or repo evals/promptfoo directories. Extend an
existing suite when possible.
Write one sentence for the behavior under test, then choose 3-10 starter cases. Include both ordinary success cases and edge cases that have broken before.
For new suites, prefer this layout unless the repo already has a convention:
evals/<suite-name>/
promptfooconfig.yaml
prompts/
tests/
Prefer deterministic assertions first:
equals, contains, icontains, regexis-json, contains-json, javascriptjavascript returning a boolean or scorellm-rubric with an explicit grader provider when possibleUse model-graded assertions sparingly for qualities that deterministic checks cannot capture. Configure a local or explicit grader for reproducible QA.
Include:
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.jsondescriptiondescription, env, prompts, providers, defaultTest,
scenarios, testsprompts via file://prompts/*.txt or file://prompts/*.json when prompts
are more than a one-line smoke testtests: file://tests/*.yaml for suites that will grow beyond a few casesdefaultTest only for shared assertions/optionsoptions.transform when parsing JSON once makes assertions cleanerKeep secrets as {{env.VAR}}; do not commit .env values.
When checking faithfulness or hallucination with llm-rubric, inline the source
material in the rubric via {{variable}} so the grader can actually compare.
From the promptfoo repo:
source ~/.nvm/nvm.sh && nvm use
npm run local -- validate config -c path/to/promptfooconfig.yaml
npm run local -- eval -c path/to/promptfooconfig.yaml -o /tmp/eval-results.json --no-cache --no-share
Outside the repo:
npx promptfoo@latest validate config -c path/to/promptfooconfig.yaml
npx promptfoo@latest eval -c path/to/promptfooconfig.yaml -o /tmp/eval-results.json --no-cache --no-share
Inspect the output JSON for results.stats, response.output, score,
gradingResult.reason, and error.
--filter-pattern, --filter-metadata, or --filter-failing for focused
reruns.--no-cache while developing so you are not validating stale outputs.--no-share unless the user asks for a shareable URL.# WRONG: vague rubric with no examples or grader control
- type: llm-rubric
value: Is this good?
# BETTER: concrete success criteria
- type: llm-rubric
value: >-
The answer must cite the requested invoice id, state approved/denied, and
avoid inventing fields not present in the tool result.
# WRONG: unquoted JS expression that starts with [ or { is parsed as YAML flow
- type: javascript
value: ['billing', 'technical'].includes(output.category)
# BETTER: quote any assertion value that begins with [, {, *, &, or !
- type: javascript
value: "['billing', 'technical'].includes(output.category)"
# WRONG: inline prompts that contain JSON-like braces are misread as file paths
prompts:
- 'Classify: {{text}}. Return {"category": "..."} JSON.'
# BETTER: move non-trivial prompts (JSON examples, multi-line, quotes) to a file
prompts:
- file://./prompts/classify.txt
# WRONG: reparsing JSON in every assertion
assert:
- type: javascript
value: JSON.parse(output).status === 'approved'
# BETTER: parse once for the test
options:
transform: JSON.parse(output)
assert:
- type: javascript
value: output.status === 'approved'
When done, state:
npx claudepluginhub p/promptfoo-promptfoo-plugins-promptfooCreates or updates promptfoo evaluation suites with configs, prompts, tests, assertions, and providers. Use when adding eval coverage, debugging regressions, or scaffolding a new eval matrix.
Runs LLM evaluations with Promptfoo: configures prompt testing, custom Python assertions, and llm-rubric (LLM-as-judge). Activates on 'promptfoo', 'eval', 'LLM evaluation'.
Builds structured evaluation suites for LLM and AI system performance using reproducible metrics. Use when testing model quality, prompt changes, or regression detection.