Skip to content
Back to skills

Prompt Regression Testing

ASecurity

Builds and runs regression tests for prompts, skills and agents so changes can be checked instead of guessed. Use whenever the user changes a prompt or SKILL.md and wants to know if it got better or worse, asks how to test or evaluate an LLM feature, wants a frozen test set, pass rates over repeated runs, a baseline comparison or CI checks for prompts, even if they only say "did my edit break anything". Model agnostic, deterministic checks, flags regressions.

  • 12 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 10, 2026
ai-agentspythonrustgobashtestingdebugging

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned November 10, 2026

npx -y skills add MehranQadirian/skills --skill prompt-regression-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Prompt Regression Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Prompt Regression Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mehranqadirian-prompt-regression-testing/badge)](https://www.skillsdirectory.com/skills/mehranqadirian-prompt-regression-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: prompt-regression-testing
description: Builds and runs regression tests for prompts, skills and agents so changes can be checked instead of guessed. Use whenever the user changes a prompt or SKILL.md and wants to know if it got better or worse, asks how to test or evaluate an LLM feature, wants a frozen test set, pass rates over repeated runs, a baseline comparison or CI checks for prompts, even if they only say "did my edit break anything". Model agnostic, deterministic checks, flags regressions.
---

# prompt-regression-testing

A change to a prompt, skill or agent can fix one case and silently break three. Freeze a small set of realistic cases, check them with deterministic rules, and compare every change to a saved baseline.

```
prompt-regression-testing/
├── SKILL.md
├── scripts/
│   └── run_cases.py          run cases via a command or recorded answers; checks, repeats, baseline diff
├── references/
│   └── case-design.md        coverage map, check types, non-determinism, subjective quality, CI
└── templates/
    └── cases.json            example suite with typical, format, safety and negative cases
```

## When to use

- Editing a prompt, SKILL.md or agent and needing proof it did not get worse
- Choosing between two prompt versions
- Setting up checks before shipping an LLM feature
- A bug was fixed and must never return

## Workflow

1. **Collect cases** from real requests. Cover typical, edge, format, safety, and at least one negative case that should not trigger the behavior (`references/case-design.md`). Start with about 20.
2. **Write checks** per case in `cases.json` (copy `templates/cases.json`). Prefer several loose checks over one strict check.
3. **Write a runner**: reads the input from stdin, prints the answer to stdout. Keep keys in environment variables.
4. **Freeze a baseline** on the version you trust:
   `python3 scripts/run_cases.py cases.json --cmd "python3 runner.py" --save baseline.json`
5. **Change the prompt, then compare**:
   `python3 scripts/run_cases.py cases.json --cmd "python3 runner.py" --baseline baseline.json`
   Any `[REGRESSION]` line means a case that passed before now fails.
6. **Handle variation** with `--repeat 10 --min-pass-rate 0.9` for non-deterministic outputs.
7. **Decide**: keep the change only if there are no regressions, or the trade is explicit and accepted. Save the new baseline and commit cases with the change.
8. **Add a case** for every bug you fix.

## Rules

- Never edit a frozen case to make it pass; add a new one
- Write cases before looking at the new output, or the test will bend to the answer
- One behavior per case, so failures point to a cause
- Do not lower the pass rate to hide flakiness; rewrite the prompt
- Use recorded answers (`--outputs`) in CI and run live checks on a schedule
- Deterministic checks cannot judge style; for that use a rubric with spot checks by hand

## Commands

```bash
python3 scripts/run_cases.py cases.json --cmd "python3 runner.py"
python3 scripts/run_cases.py cases.json --outputs answers.json
python3 scripts/run_cases.py cases.json --cmd "..." --repeat 10 --min-pass-rate 0.9 --save results.json
```

Exit code is 0 when every case meets the pass rate and nothing regressed, 1 otherwise.

## What to report back

| Field | Content |
|-------|---------|
| Suite | number of cases and kinds covered |
| Result | passed over total, per failing case with the reason |
| Comparison | regressions, fixes and new cases versus the baseline |
| Variation | repeats and pass rates for flaky cases |
| Decision | keep, revert or fix, with the evidence |

## Related skills

- `skill-authoring`: create or fix the skill that these tests protect
- `multi-agent-orchestration`: evaluate agent systems against a single-agent baseline
- `systematic-debugging`: trace a failing case to its cause

Files in this skill

  • README.md1.2 KB
  • SKILL.md3.8 KB
  • references/case-design.md3.3 KB
  • scripts/run_cases.py5.3 KB
  • templates/cases.json960 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.