Skip to content

Guide · Agent skill

How to use the AI Regression Testing agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The ai-regression-testing skill is a set of instructions for an AI coding agent such as Claude Code or Cursor. It tells the agent to test its own changes with automated tests and a fixed bug-check routine, rather than relying only on its own review. This guide explains what the skill changes, how to install it, how to trigger it, and what your project needs before it is useful.

AI Regression Testingaffaan-m/ECC · MIT

Quick start

  1. 1Download the skill. Download the ai-regression-testing ZIP from this page. It contains SKILL.md.
  2. 2Install it. Unzip it into ~/.claude/skills/ for all projects, or into your project's .claude/skills/ for one project. Alternatively, upload it in the Claude apps under Settings, Capabilities, Skills.
  3. 3Check your project setup. Confirm you have Node.js, npm, Vitest and a TypeScript build, and note whether your project has a sandbox or mock mode.
  4. 4Ask for a fix with tests. Describe the API change or bug in plain words and ask the agent to add a regression test.
  5. 5Run the bug check. Ask for a bug check, or use the /bug-check command if you created .claude/commands/bug-check.md. Tests and build run before AI review.
  6. 6Keep the regression tests. Leave the tests for each fixed bug in the repository so later changes that reintroduce it fail the suite.

What does the skill make the agent do?

The skill is built on one observation: when the same model writes a fix and then reviews it, it tends to repeat the same blind spots. The source gives an example where an API response gained a new field, the SELECT query that fetched it was not updated, and the AI review missed the gap. The skill's answer is to rely on automated tests and builds to catch these problems first, then run AI review.

  • Write database-free API tests that run against a sandbox or mock mode.
  • Run the test suite and a build before any AI code review, and report failures as the highest-priority bugs.
  • Add a regression test for each bug that gets fixed, so the same bug is caught if it returns.
  • Watch for common patterns, especially a mismatch between sandbox and production code paths.

How do you install the ai-regression-testing skill?

Download the ZIP for this skill from the page, then use one of the two options below. The skill package contains a single file, SKILL.md.

Option A: unzip it into your personal skills folder at ~/.claude/skills/, or into a project's .claude/skills/ folder to make it available only in that project.

Option B: in the Claude apps, open Settings, go to Capabilities, and upload the skill under Skills.

How do you trigger the skill with a natural request?

You do not need a special command to start the skill. The source lists situations where it applies: the agent has just changed an API route or backend logic, a bug was found and fixed and must not return, the project has a sandbox or mock mode, you are about to run a bug check after changes, or the code has several paths such as sandbox versus production or feature flags.

The source also describes a bug-check command, /bug-check, which is defined in your project as a markdown file at .claude/commands/bug-check.md. If you create that file, you can type /bug-check or ask in plain words to run a bug check.

  • "Fix the profile endpoint and make sure the tests cover it."
  • "I found a bug in the messages API. Fix it and add a regression test."
  • "Run a bug check on my recent changes."
  • "Check that the sandbox and production responses for this route have the same fields."

What does the bug-check routine look like?

The source's example command file runs automated checks first and only moves to AI review if both pass. Its order is: run the tests, run the build, do the AI code review, then write a regression test for each fix. Failing tests and type errors are reported as top priority because they can be verified without judgement.

  • Step 1: run the test suite, which is required and cannot be skipped.
  • Step 2: run the build, which includes TypeScript type checking.
  • Step 3: AI code review, checking sandbox and production consistency, response shape, SELECT completeness, error handling with rollback, and race conditions in optimistic updates.
  • Step 4: propose a regression test for each fixed bug.
npm run test # Vitest テストスイート npm run build # TypeScript 型チェック + ビルド

How do you set up sandbox-mode API tests?

The examples assume Vitest with a Next.js App Router project. The Vitest config includes test files from __tests__/**/*.test.ts and a setup file that forces sandbox mode on, so tests run without a database. A helper builds Next.js requests with an optional x-sandbox-user-id header and parses the JSON response.

Write each regression test for the bug you found, not for code that already works. The source's profile example defines the required fields as a contract and adds a dedicated test for a field that was previously missing.

  • Set SANDBOX_MODE to true in the test setup file.
  • Clear the Supabase URL and anon key variables so no real database is reached.
  • Keep a list of required response fields per endpoint and assert each one exists.
  • Add a test for each bug, and name it after the bug so its purpose is clear.
// __tests__/setup.ts // サンドボックスモードを強制 — データベース不要 process.env.SANDBOX_MODE = "true"; process.env.NEXT_PUBLIC_SUPABASE_URL = ""; process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = "";

Which common regressions should the tests catch?

The source lists four recurring patterns. The most common is a sandbox and production path that return different shapes: a field is added to the production return but not to the sandbox return, or the reverse. The source also covers a Supabase or Prisma SELECT that omits a newly added column, error handling that leaves stale data on screen, and optimistic updates that do not roll back when the request fails.

For the sandbox mismatch, the source suggests a test that checks the sandbox response contains every required field.

  • Sandbox and production paths returning different fields (the most common, seen in three of four regressions in the source).
  • A SELECT clause that leaves out a new column, so the field is always undefined.
  • Error states that show old data after a failed load; clear related state in the catch block.
  • Optimistic UI updates with no rollback when the API call fails.

What do you need before using it?

The skill assumes a working JavaScript or TypeScript project. The source lists Node.js and npm, the Vitest test framework for the examples, TypeScript build tooling, and an existing sandbox or mock mode for the sandbox examples. Without a sandbox mode, the database-free tests in the guide do not apply, though the bug-check routine and regression-test advice still do.

The skill runs no scripts and makes no network requests itself. Any commands it suggests, such as npm run test, run in your own project on your machine.

  • Node.js and npm installed.
  • Vitest configured in the project (the examples use it).
  • TypeScript build set up so npm run build performs type checking.
  • A sandbox or mock mode if you want the database-free API tests.

What people use it for

  • Catching a field that a production API route returns but the sandbox route forgets.
  • Adding a regression test after a bug in a profile or messages endpoint, so it cannot silently return.
  • Running a bug check before merging AI-written changes to a Next.js API route.
  • Checking that an optimistic delete in the UI rolls back when the API call fails.

Frequently asked questions

Is the ai-regression-testing skill free to use?

The source page lists the licence as MIT, which allows you to use the skill under its terms. Check the licence text in the repository for the full conditions. The page does not list a price.

How do I install the ai-regression-testing skill in Claude Code?

Download the ZIP from the page and unzip it into ~/.claude/skills/ for all your projects, or into a project's .claude/skills/ folder for one project. The package contains SKILL.md. You can also upload it in the Claude apps under Settings, Capabilities, Skills.

What do I need to run the examples?

You need Node.js and npm, the Vitest test framework, TypeScript build tooling, and an existing sandbox or mock mode for the sandbox examples. The examples are written for Vitest with Next.js App Router, and use Supabase or Prisma.

Does this skill work with stacks other than Next.js and Vitest?

The source is written for Vitest with Next.js App Router and Supabase or Prisma. The skill's general ideas, such as running tests before AI review and adding a test per bug, can apply elsewhere, but the code examples would need substantial rewriting for other stacks.

Does the skill run scripts or access the network?

According to the source, the skill runs no scripts and uses no network. Commands it recommends, such as npm run test and npm run build, run in your own project.

What if my project has no sandbox or mock mode?

The sandbox-mode API tests depend on that setup, so they will not apply directly. The bug-check routine and the advice to write a regression test for each fixed bug can still be used with your existing test suite.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill suits developers building web apps with AI coding agents who already have a test suite and a sandbox or mock mode, especially on Vitest with Next.js. It is less useful for projects without automated tests, for non-developers, or for teams on other stacks, where the examples would need major rewriting.

Download the skill