ai-vcr-test

Cache AI/LLM calls into file-based cassettes for deterministic integration tests.

1|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/jamesaphoenix/tx-agent-kit --skill ai-vcr-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-vcr-test
Source: https://github.com/jamesaphoenix/tx-agent-kit/tree/main/.claude/skills/ai-vcr-test
Command: npx skills add https://github.com/jamesaphoenix/tx-agent-kit --skill ai-vcr-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache expensive AI/LLM calls to deliver deterministic integration tests by persisting responses as cassettes, enabling fast, offline CI runs and reliable local development.

Core Features & Use Cases

  • Custom VCR for operation-level caching of AI calls (wraps the function directly)
  • MSW-based HTTP interception for precise error scenarios and streaming edge cases
  • Deterministic cache keys via stable input hashing and cassette naming conventions
  • Scrubbing and redaction of secrets to keep credentials safe in recorded data
  • Flexible replay/record modes with per-suite cassette management and local development workflows

Quick Start

Run your integration tests once to record cassettes, then run again to replay deterministically.

Frequently Asked Questions about ai-vcr-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache AI model calls for deterministic integration tests?

To cache AI model calls for deterministic integration tests, you wrap the function directly with a custom VCR that records responses into file-based cassettes. Subsequent test runs replay these cassettes, ensuring fast, offline CI execution and reliable local development.

What is the best way to test AI streaming edge cases and HTTP errors?

Testing AI streaming edge cases and HTTP errors is handled through MSW-based HTTP interception. This allows you to simulate precise error scenarios and streaming edge cases deterministically without relying on live network requests.

How do you keep secrets and credentials safe when recording AI test cassettes?

Keeping secrets safe when recording AI test cassettes is achieved by applying scrub rules and redaction. This automatically redacts sensitive credentials from the recorded data before it is persisted to the file-based cassette store.

Can I use VCR modes for per-suite cassette management in local development?

You can use flexible replay and record VCR modes for per-suite cassette management in local development. This allows you to deterministically replay cached AI calls or record new ones as needed for each specific test suite.

Does VCR caching work for AI embeddings and evaluations during tests?

VCR caching works for AI embeddings and evaluations during tests by applying operation-level caching directly to the function calls. It generates deterministic cache keys via stable input hashing, capturing these interactions within the recorded cassettes.