[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EWJD4YCQBKC57RKW71FSER":3,"skill-same:01M7EWJD4YCQBKC57RKW71FSER":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M7EWJD4YCQBKC57RKW71FSER","ai-regression-testing",null,"Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.","TanNhatCMS\u002Fjarvis","TanNhatCMS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113796420?v=4","01M753MV17KG5CD3152G3WQEQY","KietNT","01M7EKEDYVYQ6PWVJJMZ911VMX",0,"MIT","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fecc-ai-regression-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: ai-regression-testing\ndescription: Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.\nmetadata:\n  origin: ECC\n---\n\n# AI Regression Testing\n\nTesting patterns specifically designed for AI-assisted development, where the same model writes code and reviews it — creating systematic blind spots that only automated tests can catch.\n\n## When to Activate\n\n- AI agent (Claude Code, Cursor, Codex) has modified API routes or backend logic\n- A bug was found and fixed — need to prevent re-introduction\n- Project has a sandbox\u002Fmock mode that can be leveraged for DB-free testing\n- Running `\u002Fbug-check` or similar review commands after code changes\n- Multiple code paths exist (sandbox vs production, feature flags, etc.)\n\n## The Core Problem\n\nWhen an AI writes code and then reviews its own work, it carries the same assumptions into both steps. This creates a predictable failure pattern:\n\n```\nAI writes fix → AI reviews fix → AI says \"looks correct\" → Bug still exists\n```\n\n**Real-world example** (observed in production):\n\n```\nFix 1: Added notification_settings to API response\n  → Forgot to add it to the SELECT query\n  → AI reviewed and missed it (same blind spot)\n\nFix 2: Added it to SELECT query\n  → TypeScript build error (column not in generated types)\n  → AI reviewed Fix 1 but didn't catch the SELECT issue\n\nFix 3: Changed to SELECT *\n  → Fixed production path, forgot sandbox path\n  → AI reviewed and missed it AGAIN (4th occurrence)\n\nFix 4: Test caught it instantly on first run PASS:\n```\n\nThe pattern: **sandbox\u002Fproduction path inconsistency** is the #1 AI-introduced regression.\n\n## Sandbox-Mode API Testing\n\nMost projects with AI-friendly architecture have a sandbox\u002Fmock mode. This is the key to fast, DB-free API testing.\n\n### Setup (Vitest + Next.js App Router)\n\n```typescript\n\u002F\u002F vitest.config.ts\nimport { defineConfig } from \"vitest\u002Fconfig\";\nimport path from \"path\";\n\nexport default defineConfig({\n  test: {\n    environment: \"node\",\n    globals: true,\n    include: [\"__tests__\u002F**\u002F*.test.ts\"],\n    setupFiles: [\"__tests__\u002Fsetup.ts\"],\n  },\n  resolve: {\n    alias: {\n      \"@\": path.resolve(__dirname, \".\"),\n    },\n  },\n});\n```\n\n```typescript\n\u002F\u002F __tests__\u002Fsetup.ts\n\u002F\u002F Force sandbox mode — no database needed\nprocess.env.SANDBOX_MODE = \"true\";\nprocess.env.NEXT_PUBLIC_SUPABASE_URL = \"\";\nprocess.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = \"\";\n```\n\n### Test Helper for Next.js API Routes\n\n```typescript\n\u002F\u002F __tests__\u002Fhelpers.ts\nimport { NextRequest } from \"next\u002Fserver\";\n\nexport function createTestRequest(\n  url: string,\n  options?: {\n    method?: string;\n    body?: Record\u003Cstring, unknown>;\n    headers?: Record\u003Cstring, string>;\n    sandboxUserId?: string;\n  },\n): NextRequest {\n  const { method = \"GET\", body, headers = {}, sandboxUserId } = options || {};\n  const fullUrl = url.startsWith(\"http\") ? url : `http:\u002F\u002Flocalhost:3000${url}`;\n  const reqHeaders: Record\u003Cstring, string> = { ...headers };\n\n  if (sandboxUserId) {\n    reqHeaders[\"x-sandbox-user-id\"] = sandboxUserId;\n  }\n\n  const init: { method: string; headers: Record\u003Cstring, string>; body?: string } = {\n    method,\n    headers: reqHeaders,\n  };\n\n  if (body) {\n    init.body = JSON.stringify(body);\n    reqHeaders[\"content-type\"] = \"application\u002Fjson\";\n  }\n\n  return new NextRequest(fullUrl, init);\n}\n\nexport async function parseResponse(response: Response) {\n  const json = await response.json();\n  return { status: response.status, json };\n}\n```\n\n### Writing Regression Tests\n\nThe key principle: **write tests for bugs that were found, not for code that works**.\n\n```typescript\n\u002F\u002F __tests__\u002Fapi\u002Fuser\u002Fprofile.test.ts\nimport { describe, it, expect } from \"vitest\";\nimport { createTestRequest, parseResponse } from \"..\u002F..\u002Fhelpers\";\nimport { GET, PATCH } from \"@\u002Fapp\u002Fapi\u002Fuser\u002Fprofile\u002Froute\";\n\n\u002F\u002F Define the contract — what fields MUST be in the response\nconst REQUIRED_FIELDS = [\n  \"id\",\n  \"email\",\n  \"full_name\",\n  \"phone\",\n  \"role\",\n  \"created_at\",\n  \"avatar_url\",\n  \"notification_settings\",  \u002F\u002F ← Added after bug found it missing\n];\n\ndescribe(\"GET \u002Fapi\u002Fuser\u002Fprofile\", () => {\n  it(\"returns all required fields\", async () => {\n    const req = createTestRequest(\"\u002Fapi\u002Fuser\u002Fprofile\");\n    const res = await GET(req);\n    const { status, json } = await parseResponse(res);\n\n    expect(status).toBe(200);\n    for (const field of REQUIRED_FIELDS) {\n      expect(json.data).toHaveProperty(field);\n    }\n  });\n\n  \u002F\u002F Regression test — this exact bug was introduced by AI 4 times\n  it(\"notification_settings is not undefined (BUG-R1 regression)\", async () => {\n    const req = createTestRequest(\"\u002Fapi\u002Fuser\u002Fprofile\");\n    const res = await GET(req);\n    const { json } = await parseResponse(res);\n\n    expect(\"notification_settings\" in json.data).toBe(true);\n    const ns = json.data.notification_settings;\n    expect(ns === null || typeof ns === \"object\").toBe(true);\n  });\n});\n```\n\n### Testing Sandbox\u002FProduction Parity\n\nThe most common AI regression: fixing production path but forgetting sandbox path (or vice versa).\n\n```typescript\n\u002F\u002F Test that sandbox responses match the expected contract\ndescribe(\"GET \u002Fapi\u002Fuser\u002Fmessages (conversation list)\", () => {\n  it(\"includes partner_name in sandbox mode\", async () => {\n    const req = createTestRequest(\"\u002Fapi\u002Fuser\u002Fmessages\", {\n      sandboxUserId: \"user-001\",\n    });\n    const res = await GET(req);\n    const { json } = await parseResponse(res);\n\n    \u002F\u002F This caught a bug where partner_name was added\n    \u002F\u002F to production path but not sandbox path\n    if (json.data.length > 0) {\n      for (const conv of json.data) {\n        expect(\"partner_name\" in conv).toBe(true);\n      }\n    }\n  });\n});\n```\n\n## Integrating Tests into Bug-Check Workflow\n\n### Custom Command Definition\n\n```markdown\n\u003C!-- .claude\u002Fcommands\u002Fbug-check.md -->\n# Bug Check\n\n## Step 1: Automated Tests (mandatory, cannot skip)\n\nRun these commands FIRST before any code review:\n\n    npm run test       # Vitest test suite\n    npm run build      # TypeScript type check + build\n\n- If tests fail → report as highest priority bug\n- If build fails → report type errors as highest priority\n- Only proceed to Step 2 if both pass\n\n## Step 2: Code Review (AI review)\n\n1. Sandbox \u002F production path consistency\n2. API response shape matches frontend expectations\n3. SELECT clause completeness\n4. Error handling with rollback\n5. Optimistic update race conditions\n\n## Step 3: For each bug fixed, propose a regression test\n```\n\n### The Workflow\n\n```\nUser: \"バグチェックして\" (or \"\u002Fbug-check\")\n  │\n  ├─ Step 1: npm run test\n  │   ├─ FAIL → Bug found mechanically (no AI judgment needed)\n  │   └─ PASS → Continue\n  │\n  ├─ Step 2: npm run build\n  │   ├─ FAIL → Type error found mechanically\n  │   └─ PASS → Continue\n  │\n  ├─ Step 3: AI code review (with known blind spots in mind)\n  │   └─ Findings reported\n  │\n  └─ Step 4: For each fix, write a regression test\n      └─ Next bug-check catches if fix breaks\n```\n\n## Common AI Regression Patterns\n\n### Pattern 1: Sandbox\u002FProduction Path Mismatch\n\n**Frequency**: Most common (observed in 3 out of 4 regressions)\n\n```typescript\n\u002F\u002F FAIL: AI adds field to production path only\nif (isSandboxMode()) {\n  return { data: { id, email, name } };  \u002F\u002F Missing new field\n}\n\u002F\u002F Production path\nreturn { data: { id, email, name, notification_settings } };\n\n\u002F\u002F PASS: Both paths must return the same shape\nif (isSandboxMode()) {\n  return { data: { id, email, name, notification_settings: null } };\n}\nreturn { data: { id, email, name, notification_settings } };\n```\n\n**Test to catch it**:\n\n```typescript\nit(\"sandbox and production return same fields\", async () => {\n  \u002F\u002F In test env, sandbox mode is forced ON\n  const res = await GET(createTestRequest(\"\u002Fapi\u002Fuser\u002Fprofile\"));\n  const { json } = await parseResponse(res);\n\n  for (const field of REQUIRED_FIELDS) {\n    expect(json.data).toHaveProperty(field);\n  }\n});\n```\n\n### Pattern 2: SELECT Clause Omission\n\n**Frequency**: Common with Supabase\u002FPrisma when adding new columns\n\n```typescript\n\u002F\u002F FAIL: New column added to response but not to SELECT\nconst { data } = await supabase\n  .from(\"users\")\n  .select(\"id, email, name\")  \u002F\u002F notification_settings not here\n  .single();\n\nreturn { data: { ...data, notification_settings: data.notification_settings } };\n\u002F\u002F → notification_settings is always undefined\n\n\u002F\u002F PASS: Use SELECT * or explicitly include new columns\nconst { data } = await supabase\n  .from(\"users\")\n  .select(\"*\")\n  .single();\n```\n\n### Pattern 3: Error State Leakage\n\n**Frequency**: Moderate — when adding error handling to existing components\n\n```typescript\n\u002F\u002F FAIL: Error state set but old data not cleared\ncatch (err) {\n  setError(\"Failed to load\");\n  \u002F\u002F reservations still shows data from previous tab!\n}\n\n\u002F\u002F PASS: Clear related state on error\ncatch (err) {\n  setReservations([]);  \u002F\u002F Clear stale data\n  setError(\"Failed to load\");\n}\n```\n\n### Pattern 4: Optimistic Update Without Proper Rollback\n\n```typescript\n\u002F\u002F FAIL: No rollback on failure\nconst handleRemove = async (id: string) => {\n  setItems(prev => prev.filter(i => i.id !== id));\n  await fetch(`\u002Fapi\u002Fitems\u002F${id}`, { method: \"DELETE\" });\n  \u002F\u002F If API fails, item is gone from UI but still in DB\n};\n\n\u002F\u002F PASS: Capture previous state and rollback on failure\nconst handleRemove = async (id: string) => {\n  const prevItems = [...items];\n  setItems(prev => prev.filter(i => i.id !== id));\n  try {\n    const res = await fetch(`\u002Fapi\u002Fitems\u002F${id}`, { method: \"DELETE\" });\n    if (!res.ok) throw new Error(\"API error\");\n  } catch {\n    setItems(prevItems);  \u002F\u002F Rollback\n    alert(\"削除に失敗しました\");\n  }\n};\n```\n\n## Strategy: Test Where Bugs Were Found\n\nDon't aim for 100% coverage. Instead:\n\n```\nBug found in \u002Fapi\u002Fuser\u002Fprofile     → Write test for profile API\nBug found in \u002Fapi\u002Fuser\u002Fmessages    → Write test for messages API\nBug found in \u002Fapi\u002Fuser\u002Ffavorites   → Write test for favorites API\nNo bug in \u002Fapi\u002Fuser\u002Fnotifications  → Don't write test (yet)\n```\n\n**Why this works with AI development:**\n\n1. AI tends to make the **same category of mistake** repeatedly\n2. Bugs cluster in complex areas (auth, multi-path logic, state management)\n3. Once tested, that exact regression **cannot happen again**\n4. Test count grows organically with bug fixes — no wasted effort\n\n## Quick Reference\n\n| AI Regression Pattern | Test Strategy | Priority |\n|---|---|---|\n| Sandbox\u002Fproduction mismatch | Assert same response shape in sandbox mode |  High |\n| SELECT clause omission | Assert all required fields in response |  High |\n| Error state leakage | Assert state cleanup on error |  Medium |\n| Missing rollback | Assert state restored on API failure |  Medium |\n| Type cast masking null | Assert field is not undefined |  Medium |\n\n## DO \u002F DON'T\n\n**DO:**\n- Write tests immediately after finding a bug (before fixing it if possible)\n- Test the API response shape, not the implementation\n- Run tests as the first step of every bug-check\n- Keep tests fast (\u003C 1 second total with sandbox mode)\n- Name tests after the bug they prevent (e.g., \"BUG-R1 regression\")\n\n**DON'T:**\n- Write tests for code that has never had a bug\n- Trust AI self-review as a substitute for automated tests\n- Skip sandbox path testing because \"it's just mock data\"\n- Write integration tests when unit tests suffice\n- Aim for coverage percentage — aim for regression prevention\n","# AI Regression Testing\n\nTesting patterns specifically designed for AI-assisted development, where the same model writes code and reviews it — creating systematic blind spots that only automated tests can catch.\n\n## When to Activate\n\n- AI agent (Claude Code, Cursor, Codex) has modified API routes or backend logic\n- A bug was found and fixed — need to prevent re-introduction\n- Project has a sandbox\u002Fmock mode that can be leveraged for DB-free testing\n- Running `\u002Fbug-check` or similar review commands after code changes\n- Multiple code paths exist (sandbox vs production, feature flags, etc.)\n\n## The Core Problem\n\nWhen an AI writes code and then reviews its own work, it carries the same assumptions into both steps. This creates a predictable failure pattern:\n\n```\nAI writes fix → AI reviews fix → AI says \"looks correct\" → Bug still exists\n```\n\n**Real-world example** (observed in production):\n\n```\nFix 1: Added notification_settings to API response\n  → Forgot to add it to the SELECT query\n  → AI reviewed and missed it (same blind spot)\n\nFix 2: Added it to SELECT query\n  → TypeScript build error (column not in generated types)\n  → AI reviewed Fix 1 but didn't catch the SELECT issue\n\nFix 3: Changed to SELECT *\n  → Fixed production path, forgot sandbox path\n  → AI reviewed and missed it AGAIN (4th occurrence)\n\nFix 4: Test caught it instantly on first run PASS:\n```\n\nThe pattern: **sandbox\u002Fproduction path inconsistency** is the #1 AI-introduced regression.\n\n## Sandbox-Mode API Testing\n\nMost projects with AI-friendly architecture have a sandbox\u002Fmock mode. This is the key to fast, DB-free API testing.\n\n### Setup (Vitest + Next.js App Router)\n\n```typescript\n\u002F\u002F vitest.config.ts\nimport { defineConfig } from \"vitest\u002Fconfig\";\nimport path from \"path\";\n\nexport default defineConfig({\n  test: {\n    environment: \"node\",\n    globals: true,\n    include: [\"__tests__\u002F**\u002F*.test.ts\"],\n    setupFiles: [\"__tests__\u002Fsetup.ts\"],\n  },\n  resolve: {\n    alias: {\n      \"@\": path.resolve(__dirname, \".\"),\n    },\n  },\n});\n```\n\n```typescript\n\u002F\u002F __tests__\u002Fsetup.ts\n\u002F\u002F Force sandbox mode — no database needed\nprocess.env.SANDBOX_MODE = \"true\";\nprocess.env.NEXT_PUBLIC_SUPABASE_URL = \"\";\nprocess.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = \"\";\n```\n\n### Test Helper for Next.js API Routes\n\n```typescript\n\u002F\u002F __tests__\u002Fhelpers.ts\nimport { NextRequest } from \"next\u002Fserver\";\n\nexport function createTestRequest(\n  url: string,\n  options?: {\n    method?: string;\n    body?: Record\u003Cstring, unknown>;\n    headers?: Record\u003Cstring, string>;\n    sandboxUserId?: string;\n  },\n): NextRequest {\n  const { method = \"GET\", body, headers = {}, sandboxUserId } = options || {};\n  const fullUrl = url.startsWith(\"http\") ? url : `http:\u002F\u002Flocalhost:3000${url}`;\n  const reqHeaders: Record\u003Cstring, string> = { ...headers };\n\n  if (sandboxUserId) {\n    reqHeaders[\"x-sandbox-user-id\"] = sandboxUserId;\n  }\n\n  const init: { method: string; headers: Record\u003Cstring, string>; body?: string } = {\n    method,\n    headers: reqHeaders,\n  };\n\n  if (body) {\n    init.body = JSON.stringify(body);\n    reqHeaders[\"content-type\"] = \"application\u002Fjson\";\n  }\n\n  return new NextRequest(fullUrl, init);\n}\n\nexport async function parseResponse(response: Response) {\n  const json = await response.json();\n  return { status: response.status, json };\n}\n```\n\n### Writing Regression Tests\n\nThe key principle: **write tests for bugs that were found, not for code that works**.\n\n```typescript\n\u002F\u002F __tests__\u002Fapi\u002Fuser\u002Fprofile.test.ts\nimport { describe, it, expect } from \"vitest\";\nimport { createTestRequest, parseResponse } from \"..\u002F..\u002Fhelpers\";\nimport { GET, PATCH } from \"@\u002Fapp\u002Fapi\u002Fuser\u002Fprofile\u002Froute\";\n\n\u002F\u002F Define the contract — what fields MUST be in the response\nconst REQUIRED_FIELDS = [\n  \"id\",\n  \"email\",\n  \"full_name\",\n  \"phone\",\n  \"role\",\n  \"created_at\",\n  \"avatar_url\",\n  \"notification_settings\",  \u002F\u002F ← Added after bug found it missing\n];\n\ndescribe(\"GET \u002Fapi\u002Fuser\u002Fprofile\", () => {\n  it(\"returns all required fields\", async () => {\n    const req = createTestRequest(\"\u002Fapi\u002Fuser\u002Fprofile\");\n    const res = await GET(req);\n    const { status, json } = await parseResponse(res);\n\n    expect(status).toBe(200);\n    for (const field of REQUIRED_FIELDS) {\n      expect(json.data).toHaveProperty(field);\n    }\n  });\n\n  \u002F\u002F Regression test — this exact bug was introduced by AI 4 times\n  it(\"notification_settings is not undefined (BUG-R1 regression)\", async () => {\n    const req = createTestRequest(\"\u002Fapi\u002Fuser\u002Fprofile\");\n    const res = await GET(req);\n    const { json } = await parseResponse(res);\n\n    expect(\"notification_settings\" in json.data).toBe(true);\n    const ns = json.data.notification_settings;\n    expect(ns === null || typeof ns === \"object\").toBe(true);\n  });\n});\n```\n\n### Testing Sandbox\u002FProduction Parity\n\nThe most common AI regression: fixing production path but forgetting sandbox path (or vice versa).\n\n```typescript\n\u002F\u002F Test that sandbox responses match the expected contract\ndescribe(\"GET \u002Fapi\u002Fuser\u002Fmessages (conversation list)\", () => {\n  it(\"includes partner_name in sandbox mode\", async () => {\n    const req = createTestRequest(\"\u002Fapi\u002Fuser\u002Fmessages\", {\n      sandboxUserId: \"user-001\",\n    });\n    const res = await GET(req);\n    const { json } = await parseResponse(res);\n\n    \u002F\u002F This caught a bug where partner_name was added\n    \u002F\u002F to production path but not sandbox path\n    if (json.data.length > 0) {\n      for (const conv of json.data) {\n        expect(\"partner_name\" in conv).toBe(true);\n      }\n    }\n  });\n});\n```\n\n## Integrating Tests into Bug-Check Workflow\n\n### Custom Command Definition\n\n```markdown\n\u003C!-- .claude\u002Fcommands\u002Fbug-check.md -->\n# Bug Check\n\n## Step 1: Automated Tests (mandatory, cannot skip)\n\nRun these commands FIRST before any code review:\n\n    npm run test       # Vitest test suite\n    npm run build      # TypeScript type check + build\n\n- If tests fail → report as highest priority bug\n- If build fails → report type errors as highest priority\n- Only proceed to Step 2 if both pass\n\n## Step 2: Code Review (AI review)\n\n1. Sandbox \u002F production path consistency\n2. API response shape matches frontend expectations\n3. SELECT clause completeness\n4. Error handling with rollback\n5. Optimistic update race conditions\n\n## Step 3: For each bug fixed, propose a regression test\n```\n\n### The Workflow\n\n```\nUser: \"バグチェックして\" (or \"\u002Fbug-check\")\n  │\n  ├─ Step 1: npm run test\n  │   ├─ FAIL → Bug found mechanically (no AI judgment needed)\n  │   └─ PASS → Continue\n  │\n  ├─ Step 2: npm run build\n  │   ├─ FAIL → Type error found mechanically\n  │   └─ PASS → Continue\n  │\n  ├─ Step 3: AI code review (with known blind spots in mind)\n  │   └─ Findings reported\n  │\n  └─ Step 4: For each fix, write a regression test\n      └─ Next bug-check catches if fix breaks\n```\n\n## Common AI Regression Patterns\n\n### Pattern 1: Sandbox\u002FProduction Path Mismatch\n\n**Frequency**: Most common (observed in 3 out of 4 regressions)\n\n```typescript\n\u002F\u002F FAIL: AI adds field to production path only\nif (isSandboxMode()) {\n  return { data: { id, email, name } };  \u002F\u002F Missing new field\n}\n\u002F\u002F Production path\nreturn { data: { id, email, name, notification_settings } };\n\n\u002F\u002F PASS: Both paths must return the same shape\nif (isSandboxMode()) {\n  return { data: { id, email, name, notification_settings: null } };\n}\nreturn { data: { id, email, name, notification_settings } };\n```\n\n**Test to catch it**:\n\n```typescript\nit(\"sandbox and production return same fields\", async () => {\n  \u002F\u002F In test env, sandbox mode is forced ON\n  const res = await GET(createTestRequest(\"\u002Fapi\u002Fuser\u002Fprofile\"));\n  const { json } = await parseResponse(res);\n\n  for (const field of REQUIRED_FIELDS) {\n    expect(json.data).toHaveProperty(field);\n  }\n});\n```\n\n### Pattern 2: SELECT Clause Omission\n\n**Frequency**: Common with Supabase\u002FPrisma when adding new columns\n\n```typescript\n\u002F\u002F FAIL: New column added to response but not to SELECT\nconst { data } = await supabase\n  .from(\"users\")\n  .select(\"id, email, name\")  \u002F\u002F notification_settings not here\n  .single();\n\nreturn { data: { ...data, notification_settings: data.notification_settings } };\n\u002F\u002F → notification_settings is always undefined\n\n\u002F\u002F PASS: Use SELECT * or explicitly include new columns\nconst { data } = await supabase\n  .from(\"users\")\n  .select(\"*\")\n  .single();\n```\n\n### Pattern 3: Error State Leakage\n\n**Frequency**: Moderate — when adding error handling to existing components\n\n```typescript\n\u002F\u002F FAIL: Error state set but old data not cleared\ncatch (err) {\n  setError(\"Failed to load\");\n  \u002F\u002F reservations still shows data from previous tab!\n}\n\n\u002F\u002F PASS: Clear related state on error\ncatch (err) {\n  setReservations([]);  \u002F\u002F Clear stale data\n  setError(\"Failed to load\");\n}\n```\n\n### Pattern 4: Optimistic Update Without Proper Rollback\n\n```typescript\n\u002F\u002F FAIL: No rollback on failure\nconst handleRemove = async (id: string) => {\n  setItems(prev => prev.filter(i => i.id !== id));\n  await fetch(`\u002Fapi\u002Fitems\u002F${id}`, { method: \"DELETE\" });\n  \u002F\u002F If API fails, item is gone from UI but still in DB\n};\n\n\u002F\u002F PASS: Capture previous state and rollback on failure\nconst handleRemove = async (id: string) => {\n  const prevItems = [...items];\n  setItems(prev => prev.filter(i => i.id !== id));\n  try {\n    const res = await fetch(`\u002Fapi\u002Fitems\u002F${id}`, { method: \"DELETE\" });\n    if (!res.ok) throw new Error(\"API error\");\n  } catch {\n    setItems(prevItems);  \u002F\u002F Rollback\n    alert(\"削除に失敗しました\");\n  }\n};\n```\n\n## Strategy: Test Where Bugs Were Found\n\nDon't aim for 100% coverage. Instead:\n\n```\nBug found in \u002Fapi\u002Fuser\u002Fprofile     → Write test for profile API\nBug found in \u002Fapi\u002Fuser\u002Fmessages    → Write test for messages API\nBug found in \u002Fapi\u002Fuser\u002Ffavorites   → Write test for favorites API\nNo bug in \u002Fapi\u002Fuser\u002Fnotifications  → Don't write test (yet)\n```\n\n**Why this works with AI development:**\n\n1. AI tends to make the **same category of mistake** repeatedly\n2. Bugs cluster in complex areas (auth, multi-path logic, state management)\n3. Once tested, that exact regression **cannot happen again**\n4. Test count grows organically with bug fixes — no wasted effort\n\n## Quick Reference\n\n| AI Regression Pattern | Test Strategy | Priority |\n|---|---|---|\n| Sandbox\u002Fproduction mismatch | Assert same response shape in sandbox mode |  High |\n| SELECT clause omission | Assert all required fields in response |  High |\n| Error state leakage | Assert state cleanup on error |  Medium |\n| Missing rollback | Assert state restored on API failure |  Medium |\n| Type cast masking null | Assert field is not undefined |  Medium |\n\n## DO \u002F DON'T\n\n**DO:**\n- Write tests immediately after finding a bug (before fixing it if possible)\n- Test the API response shape, not the implementation\n- Run tests as the first step of every bug-check\n- Keep tests fast (\u003C 1 second total with sandbox mode)\n- Name tests after the bug they prevent (e.g., \"BUG-R1 regression\")\n\n**DON'T:**\n- Write tests for code that has never had a bug\n- Trust AI self-review as a substitute for automated tests\n- Skip sandbox path testing because \"it's just mock data\"\n- Write integration tests when unit tests suffice\n- Aim for coverage percentage — aim for regression prevention\n",{"name":5,"metadata":24,"description":7},{"origin":25},"ECC","main","af388a77c2fe5e0b4fd879cca4300a0ffa9a6579","skills\u002Fecc-ai-regression-testing",1,"https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis","https:\u002F\u002Fgithub.com\u002FTanNhatCMS","https:\u002F\u002Fmrkiet.name.vn","2026-11-07 14:23:08",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add TanNhatCMS\u002Fjarvis --skill ai-regression-testing",{"tool":40,"command":41},"bunx","bunx skills add TanNhatCMS\u002Fjarvis --skill ai-regression-testing",{"tool":43,"command":44},"pnpm","pnpm dlx skills add TanNhatCMS\u002Fjarvis --skill ai-regression-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fecc-ai-regression-testing\u002FSKILL.md",true,[],[49,56,64,71,78,85],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7EWYJR0J8DARY7E59Z6Y9MV","web-scrape","Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open\u002Ffetch fails on JS-heavy pages, or when you need clean markdown\u002Fstructured extraction from a site. Requires FIRECRAWL_API_KEY.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fweb-scrape\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":60,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7EWYBN5P6F2AJG3FR24T9BP","design-taste-frontend","tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML\u002FCSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, \"AI-made\", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7EWY8FQFNQ2GB7NZZWGSSDX","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-tdd\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7EWY5SHBFRH1HDHVWM9K7TV","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-debugging\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7EWY3NM0Z0JAKS7HDZ24K66","requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-code-review\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7EWY0WRMWX4M9ZFY0WKC593","brainstorming","You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-brainstorming\u002FSKILL.md",[],[]]