[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74JY96ZWA6BXMVP34QB5FZQ":3,"skill-same:01M74JY96ZWA6BXMVP34QB5FZQ":56},{"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":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":35,"updatedAt":36,"install":37,"resources":49},"01M74JY96ZWA6BXMVP34QB5FZQ","add-regression-test",null,"After a bug fix lands (or is staged), generate a regression test that fails on the pre-fix code and passes on the post-fix code — pinning the bug so it can't silently return. Walks the agent through reproducing the failure first (against the pre-fix state via `git stash` or temporary revert), writing the assertion that captures it, then verifying the test goes red without the fix and green with it. Trigger phrases — \"add a regression test\", \"pin this bug\", \"write a test for the fix\", \"\u002Fadd-regression-test\", \"lock in this bug fix\", \"make sure this doesn't come back\", or invoke automatically after a \u002Ffix-bug session that produced a code fix. Skip for — fixes whose behavior change is already covered by existing passing tests, pure refactors with no behavior delta, fixes to test code itself, and unreproducible heisenbugs.","Acauhi99\u002Fopencode-agent-system","Acauhi99","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F109399110?v=4","01M74JTV4VH2YAER6TABE78RKF","Acauhi","01M74JTV5CXNC5DEV2XR5SBFG3",1,"MIT","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fadd-regression-test\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: add-regression-test\ndescription: After a bug fix lands (or is staged), generate a regression test that fails on the pre-fix code and passes on the post-fix code — pinning the bug so it can't silently return. Walks the agent through reproducing the failure first (against the pre-fix state via `git stash` or temporary revert), writing the assertion that captures it, then verifying the test goes red without the fix and green with it. Trigger phrases — \"add a regression test\", \"pin this bug\", \"write a test for the fix\", \"\u002Fadd-regression-test\", \"lock in this bug fix\", \"make sure this doesn't come back\", or invoke automatically after a \u002Ffix-bug session that produced a code fix. Skip for — fixes whose behavior change is already covered by existing passing tests, pure refactors with no behavior delta, fixes to test code itself, and unreproducible heisenbugs.\nlicense: MIT\ncompatibility: opencode\nmetadata:\n  source: \"Adapted from AgentSystemLabs\u002Fcore (MIT)\"\n  requires_codegraph: true\n---\n\n> **Tool mapping (OpenCode):** This skill uses:\n> - `question` tool for user prompts (not `AskUserQuestion`)\n> - `task` tool for subagents (not `Agent` or `Task` subagent syntax)\n> - `skill({ name: \"...\" })` to load other skills (not `Skill(skill=\"...\", args=\"...\")`)\n> - `codegraph_explore`, `codegraph_search`, `codegraph_context` for codebase exploration (preferred)\n> - `todowrite` for phase\u002Fprogress tracking\n> - `grep`, `glob`, `read`, `bash` as fallback when `.codegraph\u002F` is not initialized\n>\n> **Context rule:** This skill supersedes any prior skill instructions. Follow ONLY these instructions now. Read the user's goal and any mode\u002Finclude\u002Fskip from the conversation context.\n\nRead `mode=`, `include=`, and `skip=` from the conversation context. Default to the mode specified in this skill if not provided.\n\n# Add Regression Test\n\nA regression test is only valuable if it would have failed before the fix and passes after. Anything else is a confidence test pretending to be a regression test. The whole skill is built around proving both halves.\n\n---\n\n## Phase 1 — Identify the Fix\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nDetermine what changed:\n\n- If the fix is staged or committed but not pushed: `git diff \u003Cbase>..HEAD -- \u003Cfiles>` and `git log \u003Cbase>..HEAD --oneline`.\n- If the fix is in the working tree: `git diff` (unstaged) plus `git diff --cached` (staged).\n- If the user names a commit: `git show \u003Csha>`.\n\nRead the changed code. Identify:\n- The function \u002F route \u002F component the fix lives in\n- The input shape that triggers the bug (from the diff context, the bug report, or the user)\n- The expected externally-observable outcome (return value, DB row, HTTP response, emitted event, rendered DOM)\n\nIf the fix is purely structural (renames, refactor, reformatting) with no behavior delta — stop. Tell the user there is nothing to regression-test.\n\n**Exit:** the bug's input shape and expected outcome are written down.\n\n---\n\n## Phase 2 — Detect Test Harness\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nApply the harness-detection rules from `write-tests` (or use that skill's references file directly): config files, lockfile, scripts. If no harness exists, hand off to `skill({ name: \"write-tests\" })` Phase 3 to install one — do not introduce a runner here.\n\n**Exit:** the runner command and the test-file convention are known.\n\n---\n\n## Phase 3 — Reproduce the Failure\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nThis is the load-bearing step. **MANDATORY — READ [`references\u002Freproduction-modes.md`](references\u002Freproduction-modes.md)** before choosing a mode.\n\nPick one mode:\n\n- **A. Fix is unstaged in working tree** → write the test, `git stash` only the fix files, run the test (must fail), `git stash pop`, run the test (must pass).\n- **B. Fix is staged but not committed** → write the test, `git stash --keep-index` to set aside the test, then `git stash pop`-trick won't work cleanly; instead use mode C.\n- **C. Fix is committed locally** → write the test on top, then `git revert --no-commit \u003Cfix-sha>` in a temporary worktree (or via `git stash` of the fix files), confirm the test fails, restore.\n- **D. Fix is squashed into a larger commit and can't be cleanly isolated** → revert just the offending hunks via `git checkout \u003Cpre-fix-sha> -- \u003Cfile>` in a worktree, confirm test fails, restore.\n\nIn every mode, the gate is the same: **the test must fail without the fix code present.** A test that passes both before and after is broken — go back and tighten the assertion.\n\n**Exit:** the test failed against the pre-fix code with output that names the actual bug behavior (not \"expected X, got undefined\" — the failure message should resemble the original bug report).\n\n---\n\n## Phase 4 — Verify the Pass\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nRestore the fix, run the test. It must pass.\n\nIf it doesn't pass: either the assertion is wrong (too strict, asserting unrelated behavior) or the fix is incomplete. Surface to the user — do not loosen the assertion to make it green.\n\n**Exit:** test passes with the fix in place.\n\n---\n\n## Phase 5 — Wire It In\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\n- Place the test in the project's convention (colocated `\u003Cname>.test.ts`, `tests\u002F`, `__tests__\u002F`, etc. — match the nearest sibling).\n- Name it after the bug's *symptom*, not the fix: `it(\"returns 404 when slug contains uppercase letters\")`, not `it(\"normalizes slug case\")`. The next reader needs to recognize the bug from the test name.\n- If a bug tracker reference exists (issue #, ticket id), include it in a one-line comment above the test.\n\nRun the full suite — the new test plus its neighbors must all pass.\n\n**Exit:** test is in place; full suite is green.\n\n---\n\n## Phase 6 — Report\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\n```\nRegression test added: \u003Cpath>:\u003Cline>\n  Pinned: \u003Cone-line bug description>\n  Verified failed against: \u003Cpre-fix sha or \"stashed working tree\">\n  Verified passes against: HEAD\n  Run: \u003Cproject test command>\n```\n\n---\n\n## NEVER\n\n- **NEVER skip the failure verification.**\n  **Instead:** stash, revert, or use a temporary worktree to confirm the test fails without the fix, every time.\n  **Why:** a test written against a fix that's already in the file passes by construction. Without the failing-state proof, you have a confidence test, not a regression test — it cannot detect the bug coming back.\n\n- **NEVER assert on internal call sequences or implementation details.**\n  **Instead:** assert on the externally-observable outcome — return value, DB row state, HTTP response, rendered DOM, emitted event.\n  **Why:** implementation-coupled tests pass for the wrong reasons and break on every refactor. The bug is observable; the test should be too.\n\n- **NEVER loosen an assertion to make a failing test pass.**\n  **Instead:** if the test fails after the fix, surface the discrepancy to the user. Either the fix is incomplete or the assertion is wrong — the user decides.\n  **Why:** silently weakening the assertion is the exact failure mode that lets the bug return without anyone noticing. The test stops protecting against the very thing it was written for.\n\n- **NEVER name the test after the fix.**\n  **Instead:** name it after the bug's symptom (the wrong behavior, not the corrected one).\n  **Why:** \"normalizes slug case\" tells the next reader nothing about what bug it pins; \"returns 404 when slug contains uppercase letters\" makes the regression obvious if the test ever fails again.\n\n- **NEVER write a regression test for an unreproducible heisenbug.**\n  **Instead:** stop and tell the user the bug needs a deterministic reproduction first; suggest adding logging or a feature flag to capture the failing input.\n  **Why:** a flaky test pinning a flaky bug is twice the noise — the test will fail intermittently on CI for unrelated reasons and get muted, defeating its purpose.\n\n- **NEVER bundle unrelated cleanup or \"while I'm here\" assertions into the regression test.**\n  **Instead:** one test, one assertion, one bug. Other tests go in their own block.\n  **Why:** if the file is later changed and the regression assertion fails, the developer needs to recognize *exactly* which behavior regressed. Mixed assertions make that ambiguous and erode trust in the test name.\n\n- **NEVER mock the layer where the bug lived.**\n  **Instead:** test the real code path that produced the bug. If the bug was in the data-access layer, hit the test DB; if it was in a handler, call the handler.\n  **Why:** mocking the buggy layer means the test asserts your idea of how it works, not how it works. The original bug came from a mismatch between the two — the test must exercise the real thing.\n","> **Tool mapping (OpenCode):** This skill uses:\n> - `question` tool for user prompts (not `AskUserQuestion`)\n> - `task` tool for subagents (not `Agent` or `Task` subagent syntax)\n> - `skill({ name: \"...\" })` to load other skills (not `Skill(skill=\"...\", args=\"...\")`)\n> - `codegraph_explore`, `codegraph_search`, `codegraph_context` for codebase exploration (preferred)\n> - `todowrite` for phase\u002Fprogress tracking\n> - `grep`, `glob`, `read`, `bash` as fallback when `.codegraph\u002F` is not initialized\n>\n> **Context rule:** This skill supersedes any prior skill instructions. Follow ONLY these instructions now. Read the user's goal and any mode\u002Finclude\u002Fskip from the conversation context.\n\nRead `mode=`, `include=`, and `skip=` from the conversation context. Default to the mode specified in this skill if not provided.\n\n# Add Regression Test\n\nA regression test is only valuable if it would have failed before the fix and passes after. Anything else is a confidence test pretending to be a regression test. The whole skill is built around proving both halves.\n\n---\n\n## Phase 1 — Identify the Fix\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nDetermine what changed:\n\n- If the fix is staged or committed but not pushed: `git diff \u003Cbase>..HEAD -- \u003Cfiles>` and `git log \u003Cbase>..HEAD --oneline`.\n- If the fix is in the working tree: `git diff` (unstaged) plus `git diff --cached` (staged).\n- If the user names a commit: `git show \u003Csha>`.\n\nRead the changed code. Identify:\n- The function \u002F route \u002F component the fix lives in\n- The input shape that triggers the bug (from the diff context, the bug report, or the user)\n- The expected externally-observable outcome (return value, DB row, HTTP response, emitted event, rendered DOM)\n\nIf the fix is purely structural (renames, refactor, reformatting) with no behavior delta — stop. Tell the user there is nothing to regression-test.\n\n**Exit:** the bug's input shape and expected outcome are written down.\n\n---\n\n## Phase 2 — Detect Test Harness\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nApply the harness-detection rules from `write-tests` (or use that skill's references file directly): config files, lockfile, scripts. If no harness exists, hand off to `skill({ name: \"write-tests\" })` Phase 3 to install one — do not introduce a runner here.\n\n**Exit:** the runner command and the test-file convention are known.\n\n---\n\n## Phase 3 — Reproduce the Failure\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nThis is the load-bearing step. **MANDATORY — READ [`references\u002Freproduction-modes.md`](references\u002Freproduction-modes.md)** before choosing a mode.\n\nPick one mode:\n\n- **A. Fix is unstaged in working tree** → write the test, `git stash` only the fix files, run the test (must fail), `git stash pop`, run the test (must pass).\n- **B. Fix is staged but not committed** → write the test, `git stash --keep-index` to set aside the test, then `git stash pop`-trick won't work cleanly; instead use mode C.\n- **C. Fix is committed locally** → write the test on top, then `git revert --no-commit \u003Cfix-sha>` in a temporary worktree (or via `git stash` of the fix files), confirm the test fails, restore.\n- **D. Fix is squashed into a larger commit and can't be cleanly isolated** → revert just the offending hunks via `git checkout \u003Cpre-fix-sha> -- \u003Cfile>` in a worktree, confirm test fails, restore.\n\nIn every mode, the gate is the same: **the test must fail without the fix code present.** A test that passes both before and after is broken — go back and tighten the assertion.\n\n**Exit:** the test failed against the pre-fix code with output that names the actual bug behavior (not \"expected X, got undefined\" — the failure message should resemble the original bug report).\n\n---\n\n## Phase 4 — Verify the Pass\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\nRestore the fix, run the test. It must pass.\n\nIf it doesn't pass: either the assertion is wrong (too strict, asserting unrelated behavior) or the fix is incomplete. Surface to the user — do not loosen the assertion to make it green.\n\n**Exit:** test passes with the fix in place.\n\n---\n\n## Phase 5 — Wire It In\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\n- Place the test in the project's convention (colocated `\u003Cname>.test.ts`, `tests\u002F`, `__tests__\u002F`, etc. — match the nearest sibling).\n- Name it after the bug's *symptom*, not the fix: `it(\"returns 404 when slug contains uppercase letters\")`, not `it(\"normalizes slug case\")`. The next reader needs to recognize the bug from the test name.\n- If a bug tracker reference exists (issue #, ticket id), include it in a one-line comment above the test.\n\nRun the full suite — the new test plus its neighbors must all pass.\n\n**Exit:** test is in place; full suite is green.\n\n---\n\n## Phase 6 — Report\n\nUse `todowrite` to mark this phase as in_progress. Mark it completed when done.\n\n```\nRegression test added: \u003Cpath>:\u003Cline>\n  Pinned: \u003Cone-line bug description>\n  Verified failed against: \u003Cpre-fix sha or \"stashed working tree\">\n  Verified passes against: HEAD\n  Run: \u003Cproject test command>\n```\n\n---\n\n## NEVER\n\n- **NEVER skip the failure verification.**\n  **Instead:** stash, revert, or use a temporary worktree to confirm the test fails without the fix, every time.\n  **Why:** a test written against a fix that's already in the file passes by construction. Without the failing-state proof, you have a confidence test, not a regression test — it cannot detect the bug coming back.\n\n- **NEVER assert on internal call sequences or implementation details.**\n  **Instead:** assert on the externally-observable outcome — return value, DB row state, HTTP response, rendered DOM, emitted event.\n  **Why:** implementation-coupled tests pass for the wrong reasons and break on every refactor. The bug is observable; the test should be too.\n\n- **NEVER loosen an assertion to make a failing test pass.**\n  **Instead:** if the test fails after the fix, surface the discrepancy to the user. Either the fix is incomplete or the assertion is wrong — the user decides.\n  **Why:** silently weakening the assertion is the exact failure mode that lets the bug return without anyone noticing. The test stops protecting against the very thing it was written for.\n\n- **NEVER name the test after the fix.**\n  **Instead:** name it after the bug's symptom (the wrong behavior, not the corrected one).\n  **Why:** \"normalizes slug case\" tells the next reader nothing about what bug it pins; \"returns 404 when slug contains uppercase letters\" makes the regression obvious if the test ever fails again.\n\n- **NEVER write a regression test for an unreproducible heisenbug.**\n  **Instead:** stop and tell the user the bug needs a deterministic reproduction first; suggest adding logging or a feature flag to capture the failing input.\n  **Why:** a flaky test pinning a flaky bug is twice the noise — the test will fail intermittently on CI for unrelated reasons and get muted, defeating its purpose.\n\n- **NEVER bundle unrelated cleanup or \"while I'm here\" assertions into the regression test.**\n  **Instead:** one test, one assertion, one bug. Other tests go in their own block.\n  **Why:** if the file is later changed and the regression assertion fails, the developer needs to recognize *exactly* which behavior regressed. Mixed assertions make that ambiguous and erode trust in the test name.\n\n- **NEVER mock the layer where the bug lived.**\n  **Instead:** test the real code path that produced the bug. If the bug was in the data-access layer, hit the test DB; if it was in a handler, call the handler.\n  **Why:** mocking the buggy layer means the test asserts your idea of how it works, not how it works. The original bug came from a mismatch between the two — the test must exercise the real thing.\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":27},{"source":25,"requires_codegraph":26},"Adapted from AgentSystemLabs\u002Fcore (MIT)",true,"opencode","main","a40966cd3b7323e693a9fd665ab9c720d8bf9634","skills\u002Fadd-regression-test",0,"https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system","https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@acauhi\u002Fopencode-agent-system","https:\u002F\u002Fgithub.com\u002FAcauhi99","@github Backend Engineer","2026-07-07 22:24:45",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":26},[39,42,45],{"tool":40,"command":41},"npx","npx skills add Acauhi99\u002Fopencode-agent-system --skill add-regression-test",{"tool":43,"command":44},"bunx","bunx skills add Acauhi99\u002Fopencode-agent-system --skill add-regression-test",{"tool":46,"command":47},"pnpm","pnpm dlx skills add Acauhi99\u002Fopencode-agent-system --skill add-regression-test","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fadd-regression-test\u002FSKILL.md",[50],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Freproduction-modes.md","REFERENCE","参考文档",2988,"https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fadd-regression-test\u002Freferences\u002Freproduction-modes.md",[57,63,69,76,82,89],{"skillNo":58,"name":59,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M74KEHKFCSF2H23R44MR5DN8","write-tests","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fwrite-tests\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M74KEEXZW2185BZ3VJCM7AF6","update-changelog","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fupdate-changelog\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M74KDVH470SS6WPS8WK3VSW3","triage","Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Ftriage\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M74KDKGNY0MQXQ0ZHAGYSJJ4","to-prd","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fto-prd\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M74KD9YN0K59GWMWDT5YHBKY","to-issues","Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Fto-issues\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M74KD14VJAJZ8E4ENN0KP9GV","testing-plan","https:\u002F\u002Fgithub.com\u002FAcauhi99\u002Fopencode-agent-system\u002Fblob\u002Fmain\u002Fskills\u002Ftesting-plan\u002FSKILL.md",[],[]]