Agent skill

AI Regression Testing

by affaan-m in affaan-m/ECC

AI辅助开发的回归测试策略。沙盒模式API测试,无需依赖数据库,自动化的缺陷检查工作流程,以及捕捉AI盲点的模式,其中同一模型编写和审查代码。

MITAuto-check passedTesting & QA

Install AI Regression Testing

skills CLI
$ npx skills add affaan-m/ECC --skill ai-regression-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC ai-regression-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/zh-CN/skills/ai-regression-testing .claude/skills/ai-regression-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ai-regression-testing
GitHub stars
277k
Used in
1 other repo
Token cost
~2.2k tokens
SKILL.md length
153 words
Files
1
Skills in repo
683
Repo updated
First seen
Licence
MIT

At a glance

AI辅助开发的回归测试策略。沙盒模式API测试,无需依赖数据库,自动化的缺陷检查工作流程,以及捕捉AI盲点的模式,其中同一模型编写和审查代码。

  • Works in 4 steps: AI 倾向于重复犯同一类错误 → Bug 集中在复杂区域(身份验证、多路径逻辑、状态管理) → 一旦经过测试,该特定回归问题就不会再次发生 → …
  • Tasks that involve QA and bug reports
  • SKILL.md covers 何时激活, 核心问题, 沙盒模式 API 测试 and 将测试集成到 Bug 检查工作流中, plus 4 more sections
  • Needs NEXT_PUBLIC_SUPABASE_ANON_KEY

What it does

AI Regression Testing is an agent skill from affaan-m/ECC. AI辅助开发的回归测试策略。沙盒模式API测试,无需依赖数据库,自动化的缺陷检查工作流程,以及捕捉AI盲点的模式,其中同一模型编写和审查代码。

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering QA and bug reports. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve QA and bug reports

Example prompts

  • “/ai-regression-testing”

Requirements

  • A credential in NEXT_PUBLIC_SUPABASE_ANON_KEY

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. AI 倾向于重复犯同一类错误
  2. Bug 集中在复杂区域(身份验证、多路径逻辑、状态管理)
  3. 一旦经过测试,该特定回归问题就不会再次发生
  4. 测试数量随着 Bug 修复而有机增长——没有浪费精力

What it can do on your machine

Read from SKILL.md and the folder at commit 2d515e4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • NEXT_PUBLIC_SUPABASE_ANON_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

AI Regression Testing loads about 2.2k tokens when it runs. Until then it costs about 23 tokens; SKILL.md has 153 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~23
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit 2d515e4, republished under its MIT licence (© affaan-m). 153 words, ~2,152 tokens.

Download SKILL.mdSave it as .claude/skills/ai-regression-testing/SKILL.md (or your agent's skills folder).
name
ai-regression-testing
description
AI辅助开发的回归测试策略。沙盒模式API测试,无需依赖数据库,自动化的缺陷检查工作流程,以及捕捉AI盲点的模式,其中同一模型编写和审查代码。
origin
ECC

AI 回归测试

专为 AI 辅助开发设计的测试模式,其中同一模型编写代码并审查代码——这会形成系统性的盲点,只有自动化测试才能发现。

何时激活

  • AI 代理(Claude Code、Cursor、Codex)已修改 API 路由或后端逻辑
  • 发现并修复了一个 bug——需要防止重新引入
  • 项目具有沙盒/模拟模式,可用于无需数据库的测试
  • 在代码更改后运行 /bug-check 或类似的审查命令
  • 存在多个代码路径(沙盒与生产环境、功能开关等)

核心问题

当 AI 编写代码然后审查其自身工作时,它会将相同的假设带入这两个步骤。这会形成一个可预测的失败模式:

AI 编写修复 → AI 审查修复 → AI 表示“看起来正确” → 漏洞依然存在

实际示例(在生产环境中观察到):

修复 1:向 API 响应添加了 notification_settings
  → 忘记将其添加到 SELECT 查询中
  → AI 审核时遗漏了(相同的盲点)

修复 2:将其添加到 SELECT 查询中
  → TypeScript 构建错误(列不在生成的类型中)
  → AI 审核了修复 1,但未发现 SELECT 问题

修复 3:改为 SELECT *
  → 修复了生产路径,忘记了沙箱路径
  → AI 审核时再次遗漏(第 4 次出现)

修复 4:测试在首次运行时立即捕获了问题 PASS:

模式:沙盒/生产环境路径不一致是 AI 引入的 #1 回归问题。

沙盒模式 API 测试

大多数具有 AI 友好架构的项目都有一个沙盒/模拟模式。这是实现快速、无需数据库的 API 测试的关键。

设置(Vitest + Next.js App Router)
typescript
// vitest.config.ts
import { defineConfig } from "vitest/config";
import path from "path";

export default defineConfig({
  test: {
    environment: "node",
    globals: true,
    include: ["__tests__/**/*.test.ts"],
    setupFiles: ["__tests__/setup.ts"],
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "."),
    },
  },
});
typescript
// __tests__/setup.ts
// Force sandbox mode — no database needed
process.env.SANDBOX_MODE = "true";
process.env.NEXT_PUBLIC_SUPABASE_URL = "";
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = "";
Next.js API 路由的测试辅助工具
typescript
// __tests__/helpers.ts
import { NextRequest } from "next/server";

export function createTestRequest(
  url: string,
  options?: {
    method?: string;
    body?: Record<string, unknown>;
    headers?: Record<string, string>;
    sandboxUserId?: string;
  },
): NextRequest {
  const { method = "GET", body, headers = {}, sandboxUserId } = options || {};
  const fullUrl = url.startsWith("http") ? url : `http://localhost:3000${url}`;
  const reqHeaders: Record<string, string> = { ...headers };

  if (sandboxUserId) {
    reqHeaders["x-sandbox-user-id"] = sandboxUserId;
  }

  const init: { method: string; headers: Record<string, string>; body?: string } = {
    method,
    headers: reqHeaders,
  };

  if (body) {
    init.body = JSON.stringify(body);
    reqHeaders["content-type"] = "application/json";
  }

  return new NextRequest(fullUrl, init);
}

export async function parseResponse(response: Response) {
  const json = await response.json();
  return { status: response.status, json };
}
编写回归测试

关键原则:为已发现的 bug 编写测试,而不是为正常工作的代码编写测试。

typescript
// __tests__/api/user/profile.test.ts
import { describe, it, expect } from "vitest";
import { createTestRequest, parseResponse } from "../../helpers";
import { GET, PATCH } from "@/app/api/user/profile/route";

// Define the contract — what fields MUST be in the response
const REQUIRED_FIELDS = [
  "id",
  "email",
  "full_name",
  "phone",
  "role",
  "created_at",
  "avatar_url",
  "notification_settings",  // ← Added after bug found it missing
];

describe("GET /api/user/profile", () => {
  it("returns all required fields", async () => {
    const req = createTestRequest("/api/user/profile");
    const res = await GET(req);
    const { status, json } = await parseResponse(res);

    expect(status).toBe(200);
    for (const field of REQUIRED_FIELDS) {
      expect(json.data).toHaveProperty(field);
    }
  });

  // Regression test — this exact bug was introduced by AI 4 times
  it("notification_settings is not undefined (BUG-R1 regression)", async () => {
    const req = createTestRequest("/api/user/profile");
    const res = await GET(req);
    const { json } = await parseResponse(res);

    expect("notification_settings" in json.data).toBe(true);
    const ns = json.data.notification_settings;
    expect(ns === null || typeof ns === "object").toBe(true);
  });
});
测试沙盒/生产环境一致性

最常见的 AI 回归问题:修复了生产环境路径但忘记了沙盒路径(或反之)。

typescript
// Test that sandbox responses match the expected contract
describe("GET /api/user/messages (conversation list)", () => {
  it("includes partner_name in sandbox mode", async () => {
    const req = createTestRequest("/api/user/messages", {
      sandboxUserId: "user-001",
    });
    const res = await GET(req);
    const { json } = await parseResponse(res);

    // This caught a bug where partner_name was added
    // to production path but not sandbox path
    if (json.data.length > 0) {
      for (const conv of json.data) {
        expect("partner_name" in conv).toBe(true);
      }
    }
  });
});

将测试集成到 Bug 检查工作流中

自定义命令定义
markdown
<!-- .claude/commands/bug-check.md -->
# Bug 检查

## 步骤 1:自动化测试(强制,不可跳过)

在代码审查前**首先**运行以下命令:

    npm run test       # Vitest 测试套件
    npm run build      # TypeScript 类型检查 + 构建

- 如果测试失败 → 报告为最高优先级 Bug
- 如果构建失败 → 将类型错误报告为最高优先级
- 只有在两者都通过后,才能继续到步骤 2

## 步骤 2:代码审查(AI 审查)

1. 沙盒/生产环境路径一致性
2. API 响应结构是否符合前端预期
3. SELECT 子句的完整性
4. 包含回滚的错误处理
5. 乐观更新的竞态条件

## 步骤 3:对于每个修复的 Bug,提出回归测试方案
工作流程
User: "バグチェックして" (or "/bug-check")
  │
  ├─ Step 1: npm run test
  │   ├─ FAIL → 发现机械性错误(无需AI判断)
  │   └─ PASS → 继续
  │
  ├─ Step 2: npm run build
  │   ├─ FAIL → 发现类型错误
  │   └─ PASS → 继续
  │
  ├─ Step 3: AI代码审查(考虑已知盲点)
  │   └─ 报告发现的问题
  │
  └─ Step 4: 对每个修复编写回归测试
      └─ 下次bug-check时捕获修复是否破坏功能

常见的 AI 回归模式

模式 1:沙盒/生产环境路径不匹配

频率:最常见(在 4 个回归问题中观察到 3 个)

typescript
// FAIL: AI adds field to production path only
if (isSandboxMode()) {
  return { data: { id, email, name } };  // Missing new field
}
// Production path
return { data: { id, email, name, notification_settings } };

// PASS: Both paths must return the same shape
if (isSandboxMode()) {
  return { data: { id, email, name, notification_settings: null } };
}
return { data: { id, email, name, notification_settings } };

用于捕获它的测试:

typescript
it("sandbox and production return same fields", async () => {
  // In test env, sandbox mode is forced ON
  const res = await GET(createTestRequest("/api/user/profile"));
  const { json } = await parseResponse(res);

  for (const field of REQUIRED_FIELDS) {
    expect(json.data).toHaveProperty(field);
  }
});
模式 2:SELECT 子句遗漏

频率:在使用 Supabase/Prisma 添加新列时常见

typescript
// FAIL: New column added to response but not to SELECT
const { data } = await supabase
  .from("users")
  .select("id, email, name")  // notification_settings not here
  .single();

return { data: { ...data, notification_settings: data.notification_settings } };
// → notification_settings is always undefined

// PASS: Use SELECT * or explicitly include new columns
const { data } = await supabase
  .from("users")
  .select("*")
  .single();
模式 3:错误状态泄漏

频率:中等——当向现有组件添加错误处理时

typescript
// FAIL: Error state set but old data not cleared
catch (err) {
  setError("Failed to load");
  // reservations still shows data from previous tab!
}

// PASS: Clear related state on error
catch (err) {
  setReservations([]);  // Clear stale data
  setError("Failed to load");
}
模式 4:乐观更新未正确回滚
typescript
// FAIL: No rollback on failure
const handleRemove = async (id: string) => {
  setItems(prev => prev.filter(i => i.id !== id));
  await fetch(`/api/items/${id}`, { method: "DELETE" });
  // If API fails, item is gone from UI but still in DB
};

// PASS: Capture previous state and rollback on failure
const handleRemove = async (id: string) => {
  const prevItems = [...items];
  setItems(prev => prev.filter(i => i.id !== id));
  try {
    const res = await fetch(`/api/items/${id}`, { method: "DELETE" });
    if (!res.ok) throw new Error("API error");
  } catch {
    setItems(prevItems);  // Rollback
    alert("削除に失敗しました");
  }
};

策略:在发现 Bug 的地方进行测试

不要追求 100% 的覆盖率。相反:

在 /api/user/profile 发现 bug → 为 profile API 编写测试
在 /api/user/messages 发现 bug → 为 messages API 编写测试
在 /api/user/favorites 发现 bug → 为 favorites API 编写测试
在 /api/user/notifications 没有发现 bug → 暂时不编写测试

为什么这在 AI 开发中有效:

  1. AI 倾向于重复犯同一类错误
  2. Bug 集中在复杂区域(身份验证、多路径逻辑、状态管理)
  3. 一旦经过测试,该特定回归问题就不会再次发生
  4. 测试数量随着 Bug 修复而有机增长——没有浪费精力

快速参考

AI 回归模式测试策略优先级
沙盒/生产环境不匹配断言沙盒模式下响应结构相同高
SELECT 子句遗漏断言响应中包含所有必需字段高
错误状态泄漏断言出错时状态已清理中
缺少回滚断言 API 失败时状态已恢复中
类型转换掩盖 null断言字段不为 undefined中

要 / 不要

要:

  • 发现 bug 后立即编写测试(如果可能,在修复之前)
  • 测试 API 响应结构,而不是实现细节
  • 将运行测试作为每次 bug 检查的第一步
  • 保持测试快速(在沙盒模式下总计 < 1 秒)
  • 以测试所预防的 bug 来命名测试(例如,"BUG-R1 regression")

不要:

  • 为从未出现过 bug 的代码编写测试
  • 相信 AI 自我审查可以作为自动化测试的替代品
  • 因为“只是模拟数据”而跳过沙盒路径测试
  • 在单元测试足够时编写集成测试
  • 追求覆盖率百分比——追求回归预防

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/zh-CN/skills/ai-regression-testing of affaan-m/ECC.

Open the folder on GitHubat commit 2d515e4

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in affaan-m/ECC, which our catalogue first saw on October 7, 2026.

Compare with similar skills

AI Regression Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

AI Regression Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
AI Regression Testing this skillaffaan-m/ECC277k1 repos~2.2kAutomated safety check: PassMIT
Reproduce Chat Statesdifferent-ai/openwork24k—~673Automated safety check: PassCustom licence
Dynamo Jira TicketDynamoDS/Dynamo2k—~1.1kAutomated safety check: PassApache-2.0
Moav E2EMotherofallVPNs/MoaV449—~1.9kAutomated safety check: NotesMIT
Creating A Coral TaskHuman-Agent-Society/CORAL1.1k—~2.2kAutomated safety check: PassApache-2.0
Launch Rlmarin-community/marin3.9k—~894Automated safety check: PassApache-2.0

Similar skills

  • Reproduce Chat States

    different-ai/openwork

    Fires known chat states in the running OpenWork desktop app, such as provider errors, retries and tool steps, so you can check how each renders.

    24k GitHub stars~673 tokensUpdated today
    Testing & QAAuto-check passed
  • Dynamo Jira Ticket

    DynamoDS/Dynamo

    Create structured Jira tickets for Dynamo from bug reports, failing tests, or feature requests.

    2k GitHub stars~1.1k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Moav E2E

    MotherofallVPNs/MoaV

    Run and debug MoaV's end-to-end tests — real protocol connectivity (client-test.sh) and the moav CLI smoke test — against a LIVE server, via the self-hosted e2e workflow or a local test VPS.

    449 GitHub stars~1.9k tokensUpdated 3 days ago
    Testing & QAAuto-check: notes
  • Creating A Coral Task

    Human-Agent-Society/CORAL

    Author a new CORAL task — the three pieces that must line up (task.yaml, seed/, a packaged grader/), the coral init → coral validate → smoke-test loop, and how to pick a grader pattern (stdout…

    1.1k GitHub stars~2.2k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Launch Rl

    marin-community/marin

    Define, validate, submit, or restart a Marin SkyRL experiment through its artifact main.

    3.9k GitHub stars~894 tokensUpdated today
    Testing & QAAuto-check passed
  • Actionbook Web Test

    actionbook/actionbook

    Run browser-based web tests against websites using Actionbook CLI.

    1.6k GitHub stars~9.7k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed

More from affaan-m/ECC

All 682 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    277k GitHub starsUsed in 5 repos~3.1k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    277k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Docs Governance

    affaan-m/ECC

    Route broad documentation-governance requests to existing ECC skills and run an opt-in, read-only audit of mapped documentation roles, links, ADR indexes, and evidence references.

    277k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    277k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    277k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Set an ECC-specific frontend design direction for production UI work.

    277k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Categories

Questions about AI Regression Testing

What does AI Regression Testing do?

AI辅助开发的回归测试策略。沙盒模式API测试,无需依赖数据库,自动化的缺陷检查工作流程,以及捕捉AI盲点的模式,其中同一模型编写和审查代码。. AI Regression Testing is an agent skill from affaan-m/ECC.

When should I use AI Regression Testing?

AI Regression Testing fits situations like: tasks that involve QA and bug reports.

How do I install AI Regression Testing in Claude Code?

Run `npx skills add affaan-m/ECC --skill ai-regression-testing -a claude-code`. Or copy the skill folder (docs/zh-CN/skills/ai-regression-testing in affaan-m/ECC) into .claude/skills/ai-regression-testing in your project. Claude Code loads it when a task matches its description.

How do I install AI Regression Testing in Codex?

Run `npx skills add affaan-m/ECC --skill ai-regression-testing -a codex`. Or copy the skill folder (docs/zh-CN/skills/ai-regression-testing in affaan-m/ECC) into .agents/skills/ai-regression-testing in your project. Codex loads it when a task matches its description.

Can I use AI Regression Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill ai-regression-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ai-regression-testing, .gemini/skills/ai-regression-testing, .github/skills/ai-regression-testing and .opencode/skills/ai-regression-testing in your project.

What does AI Regression Testing need to run?

Going by SKILL.md and its folder, AI Regression Testing needs credentials named NEXT_PUBLIC_SUPABASE_ANON_KEY. Our summary lists: A credential in NEXT_PUBLIC_SUPABASE_ANON_KEY.

Does AI Regression Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is AI Regression Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does AI Regression Testing use?

AI Regression Testing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does AI Regression Testing use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to AI Regression Testing?

Skills that share tags, products or a category with AI Regression Testing: Reproduce Chat States (different-ai/openwork, 24k stars), Dynamo Jira Ticket (DynamoDS/Dynamo, 2k stars), Moav E2E (MotherofallVPNs/MoaV, 449 stars) and Creating A Coral Task (Human-Agent-Society/CORAL, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains AI Regression Testing?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 276,673 GitHub stars. The repository holds 683 skills in this directory. The repository was last updated on October 11, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.