run-affected-test-file-in-isolation-and-in-co-run-with-its-test- skill
run-affected-test-file-in-isolation-and-in-co-run-with-its-test- is a Claude Code skill that makes the agent run tests in isolation and with sibling files after mock cleanup changes.
MIT ★ 539 updated 2026-10-29
npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a claude-codeWhat run-affected-test-file-in-isolation-and-in-co-run-with-its-test- does
The skill addresses a Bun issue: adding afterEach(() => mock.restore()) can break co-run if sibling tests rely on leaked mock state. The agent must verify both isolated and group execution before committing.
It contains three blocks: trigger (no explicit condition), required procedure (run tests in both modes), forbidden shortcut (adding afterEach without co-run check). Delegation references the SKILL.md file, verification happens through diff and test runs.
Auto-generated from the opencode-swarm knowledge base, source ID 1b7d37db-81d1-4b0d-90ab-85a7e68f90bf. Works without external dependencies — this is a test process rule.
What it helps with
- run tests isolated and grouped after mock cleanup
- catch leaked mock state between files in Bun
- block commits with
afterEachbut no co-run verification
Example prompts for the agent
- Run
auth.test.tsisolated and withuser.test.tsafter addingmock.restore() - Check that tests in
services/pass both solo and together after mock changes - Add
afterEachfor mock cleanup and run all test-suite files
How to install run-affected-test-file-in-isolation-and-in-co-run-with-its-test-
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a claude-code2Manually: put the files in place
~/.claude/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a codex2Manually: put the files in place
.agents/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a cursor2Manually: put the files in place
.cursor/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ZaxbyHub/opencode-swarm .opencode/skills/generated/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-2Manually: put the files in place
.github/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.md1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a gemini-cli2Platform CLI
gemini skills install https://github.com/ZaxbyHub/opencode-swarm --path .opencode/skills/generated/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-Manually: put the files in place
.devin/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about run-affected-test-file-in-isolation-and-in-co-run-with-its-test-
How to install run-affected-test-file-in-isolation-and-in-co-run-with-its-test- in Claude Code?
Run npx skills add ZaxbyHub/opencode-swarm --skill run-affected-test-file-in-isolation-and-in-co-run-with-its-test- -a claude-code. The skill will land in ~/.claude/skills/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.md.
What does run-affected-test-file-in-isolation-and-in-co-run-with-its-test- do?
It forces the agent to run tests twice after mock cleanup — first the single file, then the whole group — to catch leaked mock state between files in Bun.
Why check both isolated and co-run in Bun?
Adding afterEach(() => mock.restore()) can break co-run if neighbouring tests depend on leaked mocks. Both modes surface different failure patterns.
Source text
SKILL.md · MIT
--- name: run-affected-test-file-in-isolation-and-in-co-run-with-its-test- description: run affected test file in isolation AND in co-run with its test-suite peers after mock cleanup changes metadata: generated_from_knowledge: '["1b7d37db-81d1-4b0d-90ab-85a7e68f90bf"]' source_knowledge_ids: '["1b7d37db-81d1-4b0d-90ab-85a7e68f90bf"]' generated_at: "2026-07-06T14:02:41.500Z" confidence: "0.60" status: active version: "1" skill_origin: generated --- <!-- generated by opencode-swarm skill-generator. Do not edit by hand; edits will be preserved on regeneration only with controlled update mode. --> # run affected test file in isolation AND in co-run with its test-suite peers after mock cleanup changes ## Trigger - (no explicit trigger metadata; cluster derived from category/tags) ## Required Procedure - run affected test file in isolation AND in co-run with its test-suite peers after mock cleanup changes ## Forbidden Shortcuts - add top-level afterEach mock.restore without verifying co-run with sibling test files ## Delegation Template When delegating a task affected by this skill, include: ``` SKILLS: file:.opencode/skills/generated/run-affected-test-file-in-isolation-and-in-co-run-with-its-test-/SKILL.md ``` ## Reviewer Checks - Verify each required action above appears in the diff. ## Test Engineer Checks - Add or update tests covering the trigger condition and the forbidden shortcut. ## Source Knowledge IDs - 1b7d37db-81d1-4b0d-90ab-85a7e68f90bf — In Bun, adding afterEach(() => mock.restore()) to fix mock isolation can break co-run with sibling test files that depend on leaked mock state. Always verify both isolated and co-run behavior before committing mock cleanup changes.
© ZaxbyHub · MIT · ZaxbyHub/opencode-swarm