mohammadhadijavidi

Prompt Regression — Testing skill for Claude Code

Testing community

Snapshot & regression testing for LLM prompts in CI: YAML cases, pytest plugin + CLI, exact/regex/JSON-Schema/semantic/LLM-judge assertions, HTML diff report.

How to install Prompt Regression

This entry records only its repository, not the path inside it, so there is no exact command to give. Open mohammadhadijavidi/prompt-regression and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Prompt Regression does

Snapshot & regression testing for LLM prompts in CI: YAML cases, pytest plugin + CLI, exact/regex/JSON-Schema/semantic/LLM-judge assertions, HTML diff report. OpenAI, Anthropic, Ollama, OpenRouter, Groq, mock.

Alternatives in Testing

  • Gstack — 15,000+ Garry Tan's exact Claude Code setup: 6 opinionated tools that serve as CEO, Eng Manager, Release Manag 33.9k ★
  • Claude Codepro — by Max Ritter - Professional development environment for Claude Code with spec-driven workflow, TDD enforcemen 1.6k ★
  • Mda — MDA Open Spec — a Markdown superset for agent-facing documents 615 ★

README

prompt-regression

**Snapshot and regression testing for LLM prompts, built to run in CI.** Write test cases in YAML. Run them with `pytest` or the CLI. Compare outputs with exact, regex, JSON Schema, semantic-similarity and LLM-as-judge checks. Get an HTML diff report showing exactly what changed when a prompt or model update breaks something.

[![CI](https://github.com/mohammadhadijavidi/prompt-regression/actions/workflows/ci.yml/badge.svg)](https://github.com/mohammadhadijavidi/prompt-regression/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Python 3.10+](https://img.shields.io/badge/python-3.10%20%7C%203.12%20%7C%203.13-blue.svg)](pyproject.toml) [![pytest plugin](https://img.shields.io/badge/pytest-plugin-0a9edc.svg)](#pytest-plugin)

![HTML diff report from prompt-regression showing a regressed support-bot prompt](assets/hero.png)

The image above is a real screenshot of the HTML report from `examples/regression_demo.py`. The outputs come from the offline **mock** provider, which returns hand-written sample responses, not answers from a real model.

Why

Changing one line of a prompt, or switching `gpt-4o` to a cheaper model, can quietly break things that worked yesterday. A classifier starts answering `Billing` instead of `billing`. An extraction step invents a new enum value. A support bot starts promising refunds. Unit tests usually miss these failures, because LLM output is text with no fixed shape.

prompt-regression handles this the way snapshot testing does for UI code:

  1. Record a known-good output for each case (a snapshot, stored as JSON next to your suite and reviewed in PRs).
  2. Assert the things that must always hold, such as format, schema, forbidden phrases and tone.
  3. Compare each new output with its snapshot, using a tolerance that fits the case: byte-exact for labels, parsed-JSON equality for structured output, and a similarity threshold for free text.