Testing & Regression
PromptGuard includes built-in tools for snapshot testing and regression detection of LLM prompts.
Why test prompts?
LLM outputs change when:
- You update the prompt text
- The provider updates the model
- You switch models
- Temperature or parameters change
Without testing, these changes break silently. PromptGuard makes prompt behavior testable.
Setup
This creates a .promptguard/ directory in your project to store snapshots and history.
Running tests
This replays your registered prompts against their schemas, compares outputs to stored snapshots, and reports any drift.
Snapshot workflow
- Define prompts with schemas
- Run
promptguard testto generate baseline snapshots - On subsequent runs, PromptGuard compares new outputs to baselines
- Review and accept changes with
promptguard historyandpromptguard diff
Versioning
Every prompt execution is versioned. View history:
This lets you track how outputs change over time and catch regressions before they reach production.
Statistics
View success rates, repair frequency, and drift metrics across your prompts.