ai-regression-testing

Writes regression tests for AI-generated code using sandbox-mode API testing with Vitest and Next.js.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Femad-6/my-skills --skill ai-regression-testing-femad-6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-regression-testing
Source: https://github.com/Femad-6/my-skills/tree/main/.github/skills/ai-regression-testing
Command: npx skills add https://github.com/Femad-6/my-skills --skill ai-regression-testing-femad-6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When an AI writes code and then reviews its own work, it carries the same assumptions into both steps, creating systematic blind spots where bugs survive multiple review rounds. This Skill provides testing patterns that mechanically catch AI-introduced regressions—especially sandbox/production path mismatches, SELECT clause omissions, and missing error rollbacks—without requiring a database. ## Core Features & Use Cases - Sandbox-Mode API Testing: Configure Vitest with Next.js App Router to test API routes against mock data with zero database dependencies, using a reusable NextRequest test helper. - Bug-Driven Regression Tests: Write tests only for bugs that were actually found, asserting API response contracts (required fields) rather than implementation details. - Bug-Check Workflow Integration: A structured command workflow that runs tests and builds before any AI code review, then proposes a regression test for every fix. - Use Case: After an AI assistant fixes a missing notification_settings field in a profile API, you add a regression test asserting the field exists in the response—so the same bug can never be reintroduced by a future AI edit. ## Quick Start Ask the AI to write a sandbox-mode regression test for the API route where the last bug was found, then run the test suite before any further code review.

Frequently Asked Questions about ai-regression-testing

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

FAQPage Schema
How do I test Next.js API routes without a database?

Force sandbox mode in the Vitest setup file by setting environment variables like SANDBOX_MODE=true, then call route handlers directly with a constructed NextRequest. The sandbox path returns mock data, so tests run in under a second with no database connection.

How to write regression tests for AI-generated code?

Write tests only for bugs that were actually found, asserting the API response contract rather than implementation details. Name each test after the bug it prevents, and run the suite as the mandatory first step of every code review before trusting AI self-review.

What is the most common regression in AI-assisted development?

Sandbox/production path mismatch is the most frequent pattern, where a fix is applied to the production code path but the sandbox mock path is forgotten. Tests that assert both paths return the same response shape catch this immediately.

Does Vitest work with Next.js App Router route handlers?

Yes, Vitest can import and invoke GET, POST, and other route handlers directly as functions in a node environment. Configure path aliases in vitest.config.ts and pass a NextRequest instance built with the full URL and headers.

Should I aim for high test coverage with AI-written code?

No, the recommended strategy is bug-driven testing rather than coverage targets. Bugs cluster in complex areas like auth and multi-path logic, so tests written where bugs were found prevent repeat regressions without wasted effort on stable code.