petrkindlmann/qa-skillsMIT7 files

AI System Testing

>-

Specification
Skill ID
petrkindlmann/qa-skills/ai-system-testing
Publisher
petrkindlmann
Repository
qa-skills
Installs
0
Files
7
License
MIT
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

petrkindlmann/qa-skills/ai-system-testingInstalls these files
  • SKILL.md
  • references/eval-framework.md
  • references/injection-detector.md
  • references/prompt-regression.md
  • references/test-patterns.md
  • references/tooling-evals.md
  • scripts/detect_injection.py

What this skill tells the agent

<objective> AI features fail differently from deterministic software. The same input produces different outputs, correctness is subjective, and failure modes include hallucination, prompt injection, and silent quality decay. A chatbot that confidently cites a fabricated URL passes every toBeDefined() check. This skill covers how to test AI features rigorously despite nondeterminism: versioned prompts, eval suites scored against golden datasets, statistical and property-based assertions, tool-call validation, grounding checks, and red-team safety scans. </objective>


Quick Route

SituationGo to
Prompt changed, need to catch quality regressionsPrompt Regression Testing → references/prompt-regression.md
Run the same prompt across providers/models and compareCross-Provider Regression → references/tooling-evals.md
Score open-ended output (relevance/completeness/safety)Response Quality Evaluation → references/eval-framework.md
Agent calls tools/functions — verify selection and argsTool-Call Validation → references/tooling-evals.md
Output is nondeterministic and exact-match keeps flakingNondeterminism Strategies
AI states facts / cites sources / runs over RAGHallucination & Grounding
Pre-launch jailbreak, injection, PII, system-prompt leakAI Safety Testing → references/tooling-evals.md
An AGENT (test harness, coding agent) reads tool output / RAG / scan reports / logsAgent-as-Target Injection → references/injection-detector.md

Discovery Questions

Check .agents/qa-project-context.md first. If it exists, use it as context and skip questions already answered there.

AI features under test:

  • What AI features exist? (Chat, summarization, classification, code gen, recommendations, search) — determinism expectations differ per type.
  • Which provider/model? (Anthropic, OpenAI, Google, open-source) — drives the eval harness and red-team backend.
  • Are prompts hardcoded, template-based, or dynamically constructed? — only versioned prompts are regression-testable.
  • Is RAG involved, and what is the knowledge source? — RAG needs grounding tests, not just output checks.

Determinism requirements:

  • Which outputs must be deterministic (classification, extraction) vs. creative (chat)? — decides exact-match vs. property vs. statistical assertions.
  • What temperature runs in production? — test there, not at 0 "to make tests pass."
  • Can the output be constrained to a JSON schema? — schema-constrained extraction is testable with a plain validator, no LLM judge.

Quality requirements:

  • How is quality defined? (Accuracy, relevance, completeness, safety, tone) — these become eval metrics with weights and thresholds.
  • Is there a golden dataset of inputs and acceptable outputs? — the anchor for every regression check.
  • Who evaluates quality today? (Humans, metrics, nobody) — if an LLM judges, it must be calibrated against humans.

Safety requirements:

  • Does the AI process user-generated input? — prompt-injection surface.
  • Are there content-policy or PII constraints, or a regulated domain? — drives the red-team probe set.

Core Principles

  1. Nondeterminism is inherent, not a bug. LLMs are stochastic; the same prompt yields different outputs across runs. Assert on properties and boundaries, never exact strings. expect(output).toBe("The answer is 42") breaks the next run when the model says "42 is the answer."
  1. Test properties, not exact outputs. A good assertion asks: does the response contain the required information, stay in the length range, exclude prohibited content, match the expected format? When you can constrain output to a JSON schema, do that and validate with a plain schema validator — it converts a statistical check into a deterministic one.
  1. Evals are the test suite for AI. An eval defines inputs, runs them through the system, and scores outputs against quality criteria. Invest in evals the way you invest in test infrastructure: version them, run them in CI, gate merges on them.
  1. Safety testing is non-negotiable. AI can produce harmful content, leak the system prompt, echo PII, or be steered by adversarial input. Safety tests are the security tests of AI features — run them on every prompt change, and red-team before launch.
  1. A judge you have not calibrated proves nothing. LLM-as-judge scales evaluation, but a judge that disagrees with humans just launders a wrong answer. Measure judge-vs-human agreement on a labeled held-out set and set a minimum bar before trusting it (see Response Quality Evaluation).

Tooling

Pick the layer that fits the job. Don't reach for hand-rolled TS unless none of these match.

ToolBest forNotes
PromptfooPrompt regression, A/B + cross-provider tests, redteam scansOSS Apache-2.0 CLI; YAML-defined suites; MCP target support. Acquired by OpenAI (Mar 2026) but stays open-source under its current license + public repo; de-facto default for production LLM teams. https://github.com/promptfoo/promptfoo
DeepEvalPytest-style LLM + agent evals; tool-call metricsCurrent 4.x ships an agent-native workflow (run eval → see metric failures inline → patch → retry) that fits Claude Code / Cursor loops. ToolCorrectnessMetric, ArgumentCorrectnessMetric, TaskCompletionMetric cover the tool-call patterns this skill teaches. https://github.com/confident-ai/deepeval
RagasRAG-specific eval (faithfulness, context precision/recall, answer relevance)Use faithfulness for the grounding/hallucination check below. https://github.com/explodinggradients/ragas
TruLensProduction tracing + RAG triad + non-LLM feedbackHas deterministic, non-LLM feedback functions (e.g. schema/regex checks) that are cheaper than an LLM judge for structured outputs. https://github.com/truera/trulens
Inspect AIGovernment-backed agent eval harness; large pre-built eval catalogUK AI Security Institute. Date-based releases (release/2025-11-28). https://inspect.aisi.org.uk
GarakAdversarial prompt scanner / red-team probesNVIDIA, Apache-2.0. v0.15.0 current (May 2026): added multi-turn GOAT, Agent Breaker (tool-aware), system-prompt-extraction, ModernBERT refusal detector. Probe modules: encoding, dan, promptinject, latentinjection, leakreplay. Run garak --list_probes for the live set. https://github.com/NVIDIA/garak
PyRITMicrosoft AI Red Team's orchestration frameworkOrchestrated multi-turn attacks; complements Garak. https://github.com/Azure/PyRIT
BraintrustCommercial evals + prompt playgroundHosted, paid; SDK works alongside any of the above.

Public benchmarks (HELM, LMSYS Chatbot Arena, Inspect AI's catalog) are for model selection, not app regression — they don't know your domain. Use them when picking a base model; use the tools above for everything after.

For runnable entry points — DeepEval tool-call validation, the Promptfoo cross-provider YAML suite, and the Garak red-team command — see references/tooling-evals.md.


Prompt Regression Testing

Version prompts like code

Prompts drive your application's behavior; version, review, and test them like code. A versioned prompt object carries its version, template, typed parameters, and a changelog. See references/prompt-regression.md for the SUMMARIZE_PROMPT object.

Baseline response quality

Establish a quality baseline per prompt and detect regressions when the prompt, model, or parameters change. Each eval case pairs an input with criteria (maxLength, mustContain, mustNotContain, sentenceCount, formatCheck); the test asserts every applicable criterion. See references/prompt-regression.md for the baseline eval suite.

A/B test prompts

Use this skill in a project

Open any RiverX project, search the Skills panel for petrkindlmann/qa-skills/ai-system-testing, and install it in one click.

Use this skill