/qa-llm-evaluation:promptfoo-evaluationfrom qa-llm-evaluation
Adds prompt regression checks in CI using Promptfoo: configures providers, prompts, tests with deterministic, semantic, model-graded, latency, and cost assertions, then runs eval and view.
Ships in qa-llm-evaluation. 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.
A promptfooconfig.yaml declares providers (LLMs under test),
prompts (templates with {{var}} placeholders), tests
(input variables + assertions); promptfoo eval runs the
cross-product (per pf-config).
promptfooconfig.yaml or the user wants to
author one.Per github.com/promptfoo/promptfoo:
npm install -g promptfoo
# or
brew install promptfoo
# or one-off
npx promptfoo@latest
Per pf-gh: "Node.js 20.20+ or 22.22+ is required for npm and npx usage."
Initialize from a built-in example, then run:
promptfoo init --example getting-started
cd getting-started
promptfoo eval
promptfoo view # opens HTML report
(Commands per pf-gh.)
A minimal promptfooconfig.yaml per pf-config:
prompts:
- file://prompt1.txt
providers:
- openai:gpt-5-mini
- anthropic:claude-haiku-4-5
tests:
- vars:
language: French
input: Hello world
assert:
- type: contains-json
Provider syntax <vendor>:<model> works for OpenAI, Anthropic,
Vertex (vertex:gemini-2.0-flash-exp), Ollama (ollama:llama2), and
30+ others (per pf-config).
Vars interpolate into prompts using {{variable}}. Arrays create
combinations (per pf-config):
tests:
- vars:
language: [French, German, Spanish]
input: [Hello world, Good morning]
This generates 6 test rows (3 languages × 2 inputs). Vars can also load from files:
tests:
- vars:
var3: file://path/to/var3.txt
context: file://fetch_from_vector_database.py
Per promptfoo.dev/docs/configuration/expected-outputs/:
Deterministic (string + structure):
| Type | Example |
|---|---|
equals | value: 'expected string' |
contains / icontains | value: 'substring' (case-sensitive / insensitive) |
starts-with | value: 'prefix' |
contains-any / contains-all | value: ['a', 'b'] |
regex | value: '^pattern$' |
is-json / contains-json | (validates / locates JSON) |
is-sql / contains-sql | (SQL syntax) |
is-xml / is-html / contains-xml / contains-html | (markup) |
is-valid-openai-tools-call / is-valid-openai-function-call | (tool calls) |
Custom logic:
- type: javascript
value: 'output.length > 10'
- type: python
value: 'file://script.py'
Text-quality metrics (default thresholds per pf-asserts):
| Type | Default threshold |
|---|---|
rouge-n | 0.75 |
bleu | 0.5 |
gleu | 0.5 |
meteor | 0.5 |
levenshtein | 5 (edit distance max) |
Performance + cost:
- type: latency
threshold: 200 # milliseconds
- type: cost
threshold: 0.001 # dollars per response
Model-graded (LLM-as-judge):
| Type | Use |
|---|---|
llm-rubric | Free-form rubric: value: 'Is helpful and accurate' |
model-graded-closedqa | Closed-QA evaluation method |
factuality | Compares against reference facts |
g-eval | Chain-of-thought scoring |
answer-relevance | Checks output relates to query |
context-faithfulness / context-recall / context-relevance | RAG-specific |
Semantic similarity:
- type: similar
value: 'reference text'
threshold: 0.8 # cosine similarity via embeddings
Negation: all deterministic assertions support a not- prefix
(not-equals, not-contains, not-regex, etc.) per pf-asserts.
Shared assertions/vars across all tests:
defaultTest:
vars:
shared_var: 'shared content'
assert:
- type: llm-rubric
value: does not describe self as AI
options:
provider: openai:gpt-5-mini # in CI, pin a dated snapshot id from the provider's model page
tests:
- vars:
unique_var: value1
(Per pf-config.)
Modify LLM output before assertions execute (per pf-config):
tests:
- vars:
body: Hello world
options:
transform: output.toUpperCase()
Or load from a file:
options:
transform: file://transform.js:customTransform
Group assertions and require a threshold percentage to pass (per pf-asserts):
assert:
- type: assert-set
threshold: 0.5 # 50% of grouped asserts must pass
assert:
- type: cost
threshold: 0.001
- type: latency
threshold: 200
Provider API keys via env vars (per pf-gh: export OPENAI_API_KEY=sk-abc123).
GitHub Actions pattern (per promptfoo.dev/docs/integrations/github-action):
- uses: promptfoo/promptfoo-action@v2
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
config: 'promptfooconfig.yaml'
cache-path: '~/.cache/promptfoo'
use-config-prompts: false
no-share: true
promptfoo-version: 'latest'
The action posts a PR comment with regression diff vs the base branch. Caching reuses LLM responses for unchanged tests (per promptfoo.dev/docs/configuration/caching/).
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Only deterministic assertions on creative outputs | LLM responses vary; rigid asserts produce flake | Use llm-rubric or similar (Step 4) |
| Single provider in config | Misses cross-provider regression | At least 2 providers per eval (Step 2) |
| No cost / latency caps | Eval cost balloons per PR | cost + latency asserts (Step 4) |
assert-set with threshold: 0 | Effectively disables grouping | Pick a real threshold (Step 7) |
| Fresh provider model on every run without pinning | Output drifts when vendor updates model | Pin a dated snapshot id from the provider's model page (OpenAI's lists them per model), not a moving alias |
| Skip caching in CI | Re-runs every test on every PR | cache-path in GHA action (Step 8) |
evals/forty-row-answer-sheet-as-a-launch-gate/criteria.json (opens in a new tab)evals/forty-row-answer-sheet-as-a-launch-gate/task.md (opens in a new tab)evals/june-board-number-cannot-be-reproduced-in-september/criteria.json (opens in a new tab)evals/june-board-number-cannot-be-reproduced-in-september/task.md (opens in a new tab)evals/pr-eval-bill-went-from-nine-dollars-to-four-hundred/criteria.json (opens in a new tab)evals/pr-eval-bill-went-from-nine-dollars-to-four-hundred/task.md (opens in a new tab)evals/safety-gate-has-not-gone-red-since-march/criteria.json (opens in a new tab)evals/safety-gate-has-not-gone-red-since-march/task.md (opens in a new tab)evals/subject-line-suite-red-three-mornings-a-week/criteria.json (opens in a new tab)evals/subject-line-suite-red-three-mornings-a-week/task.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
prompt-testing, llm-evaluation, ci-gating, regression-testing
npx claudepluginhub testland/qa --plugin qa-llm-evaluation7 skills in this plugin
/deepeval-evaluationUse for any question or task about testing an LLM or RAG app with pytest, including hallucination checks in CI and answers that invent facts missing from the retrieved documents: DeepEval LLMTestCase, built-in metrics such as G-Eval, answer relevancy, faithfulness, contextual recall and precision, hallucination, bias and toxicity, deepeval test run with assert_test, and the Confident AI dashboard./giskard-llmUse for any question or task about red-teaming or adversarial testing of an LLM app or chatbot, including prompt injection, system-prompt or data leaks, and harmful output before release. Runs giskard.scan on any model wrapped as giskard.Model to probe hallucination, harmful content, prompt injection, sensitive data disclosure, stereotypes, robustness and sycophancy, with an HTML report./langfuse-tracingOther plugins' skills for the same job