mock-to-internals-migration · zaxbyhub — Claude Code skill: setup
mock-to-internals-migration guides test migrations away from Bun mock.module leaks toward dependency-injection seams using _internals.
MIT ★ 539 updated 2026-10-29
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a claude-codeWhat mock-to-internals-migration does
This workflow guides migration of opencode-swarm test suites away from brittle module-level mocks. Instead of intercepting imports via mock.module, dependencies move behind an explicit _internals container. Source and test edits rely on the apply_patch tool.
Validation runs per file with bun --smol test <file> --timeout 30000. Overridden _internals fields must be restored inside afterEach to keep test runs fully isolated.
What it helps with
- resolve test leakage caused by Bun mock.module
- expose test seams via injectable _internals containers
- verify touched test files using bun --smol test
- restore internal mock overrides inside afterEach hooks
Example prompts for the agent
- Refactor auth.test.ts away from mock.module to use an _internals seam
- Fix Bun test isolation failures in api.test.ts using dependency injection
- Expose injectable dependencies in session.ts and reset them in afterEach
How to install mock-to-internals-migration
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a claude-code2Manually: put the files in place
~/.claude/skills/mock-to-internals-migration/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/mock-to-internals-migration/
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a codex2Manually: put the files in place
.agents/skills/mock-to-internals-migration/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a cursor2Manually: put the files in place
.cursor/skills/mock-to-internals-migration/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ZaxbyHub/opencode-swarm .agents/skills/mock-to-internals-migration2Manually: put the files in place
.github/skills/mock-to-internals-migration/SKILL.md1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a gemini-cli2Platform CLI
gemini skills install https://github.com/ZaxbyHub/opencode-swarm --path .agents/skills/mock-to-internals-migrationManually: put the files in place
.devin/skills/mock-to-internals-migration/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -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 mock-to-internals-migration
How to install mock-to-internals-migration in Claude Code?
Run npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a claude-code in your terminal.
What does mock-to-internals-migration do?
It coordinates replacing unstable Bun module mocks with targeted _internals seams across project test suites.
How does it validate test changes?
It runs focused per-file validation using bun --smol test <file> --timeout 30000 immediately after applying edits.
Source text
SKILL.md · MIT
--- name: mock-to-internals-migration description: Codex adapter for migrating opencode-swarm tests away from Bun mock.module leakage toward _internals dependency-injection seams. Use when touching tests with mock.module, adding test seams, fixing Bun mock isolation failures, or updating source modules for injectable internals. metadata: audience: swarm-plugin --- # Mock To Internals Migration Read `.opencode/skills/generated/mock-to-internals-migration/SKILL.md` for the canonical migration protocol. Also load: 1. `.agents/skills/writing-tests/SKILL.md` 2. `.agents/skills/engineering-conventions/SKILL.md` if the seam touches runtime-sensitive code Codex-specific execution notes: - Use `apply_patch` for source and test edits. - Use focused per-file `bun --smol test <file> --timeout 30000` validation first. - Restore any `_internals` overrides in `afterEach`. - Prefer small seams that expose only the dependency under test.
© ZaxbyHub · MIT · ZaxbyHub/opencode-swarm
Similar skills
All skills for Testing and QA →mock-to-internals-migration by other authors comes first.