agentleFS
yeaight7yeaight7/agent-powerups/skills/ai-regression-testing/SKILL.md

ai-regression-testing

Skill6 starsChanged 4 months agoApache-2.0View on GitHub

Use when an agent has modified logic, API routes, or data-transformation code, a bug was just fixed and must not be reintroduced, or behavior must stay identical across execution paths such as sandbox versus production.

22 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use nuxt4-patterns, dart-flutter-patterns and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • loulanyueSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 10 projects that use this

  • RojiosSkill

    dart-flutter-patterns

    Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.

    Also in 7 projects that use this

  • TironFoxSkill

    agent-payment-x402

    Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.

    Also in 6 projects that use this

  • TironFoxSkill

    openclaw-persona-forge

    为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。

    Also in 5 projects that use this

  • Yog-SothoSkill

    pytorch-patterns

    PyTorch deep learning patterns and best practices for building robust, efficient, and reproducible training pipelines, model architectures, and data loading. Always activate when the user is writing PyTorch models or training scripts, reviewing deep learning code, debugging training loops or data pipelines, optimizing GPU memory or training speed, setting up reproducible experiments, implementing transfer learning or fine-tuning, or asks anything about nn.Module, DataLoader, autograd, AMP, or torch.compile.

    Also in 13 projects that use this

  • loulanyueSkill

    santa-method

    Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.

    Also in 8 projects that use this

  • +1 more from TironFox

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 21 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When an agent writes code and then reviews it, it carries the same assumptions into both steps.

    line 8
  2. Distinctive:

    Run in order. Do not skip to agent review if automated steps fail.

    line 27
  3. Distinctive:

    Execution path parity: Do all code paths (sandbox, production, feature-flag on/off) return the same response shape?

    line 44
  4. Distinctive:

    Optimistic update rollback: If an API call fails, is the optimistic UI change reverted?

    line 47
  5. Distinctive:

    If you cannot write a test, document why:

    line 59
  6. Distinctive:

    Do not silently skip. Every real bug should either have a test or an explicit deferral note.

    line 65
  7. Distinctive:

    Test the contract, not the implementation:

    line 69
  8. Very specific:

    Do not aim for coverage percentage.

    line 102

“Common” is measured: kept by at least 6 in 10 of the 21 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AI Regression Testing

When an agent writes code and then reviews it, it carries the same assumptions into both steps. Automated tests break this cycle.

When to Use

  • An agent has modified logic, API routes, or data transformation code
  • A bug was found — need to prevent re-introduction
  • Running /bug-check after a change session
  • Multiple execution paths exist (feature flags, sandbox vs production, env variants)

The Core Problem

Agent writes fix → Agent reviews fix → Agent says "looks correct" → Bug still present

The most common blind spot: an agent fixes the production path but leaves the sandbox/mock path unchanged, or vice versa.

Workflow

Run in order. Do not skip to agent review if automated steps fail.

Step 1 — Run Tests (mandatory)

npm test      # or: pytest, cargo test, go test ./...
npm run build # TypeScript build / type check
  • Test fail → highest priority; fix before anything else
  • Build fail → report type errors as highest priority
  • Both pass → continue to Step 2

Step 2 — Agent Code Review

With tests passing, do a focused review for patterns agents commonly miss:

  1. Execution path parity: Do all code paths (sandbox, production, feature-flag on/off) return the same response shape?
  2. Query completeness: Are all fields used in the response present in the query or selection?
  3. Error state cleanup: On error, is stale state cleared before the error is surfaced?
  4. Optimistic update rollback: If an API call fails, is the optimistic UI change reverted?

Step 3 — Write a Regression Test for Each Bug Fixed

For every bug found and fixed, add a test immediately:

Bug: <description>
File: <path>
Regression test: <test name and what it asserts>

If you cannot write a test, document why:

Bug: <description>
Regression test: DEFERRED — <reason> (e.g., requires E2E harness not yet in place)

Do not silently skip. Every real bug should either have a test or an explicit deferral note.

Writing Effective Regression Tests

Test the contract, not the implementation:

// Test what the consumer receives, not how it's computed
const REQUIRED_RESPONSE_FIELDS = ["id", "email", "settings", "created_at"];

it("profile endpoint returns all required fields", async () => {
  const res = await GET(createRequest("/api/user/profile"));
  const json = await res.json();
  for (const field of REQUIRED_RESPONSE_FIELDS) {
    expect(json.data).toHaveProperty(field);
  }
});

Name tests after the bug category, not the fix:

it("sandbox path returns same field set as production path (BUG-CLASS: path-parity)")
it("notification_settings is not undefined after SELECT * removal (regression)")

Common AI Regression Patterns

PatternCheckPriority
Execution path paritySame response shape across all pathsHigh
Query field omissionAll response fields present in DB queryHigh
Error state leakageState cleared before error is returnedMedium
Missing rollbackPrevious state restored on API failureMedium

Strategy

Do not aim for coverage percentage. Write tests only for bugs that were found. Bug clusters naturally: if three bugs appeared in /api/user/profile, that endpoint needs tests. An endpoint that has never had a bug does not need tests yet.

Tests added this way grow organically with the bug history and cannot be gamed by coverage metrics.

Verification

  • Test suite and build/type check were run and pass — before any agent review started
  • The four review checks were applied: path parity, query completeness, error-state cleanup, optimistic-update rollback
  • Every bug fixed has a regression test, or an explicit DEFERRED note with the reason
  • New tests assert the contract (response shape, required fields), not the implementation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.