mock-to-internals-migration · zaxbyhub, generated — Claude Code skill for mock migration
mock-to-internals-migration is a Claude Code skill for moving mocks from Vitest to Bun and checking the _internals seam. It activates for mock migrations and related test-structure changes.
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
The skill lays out a process for moving mocks from Vitest to Bun. It calls for a test run before edits, then a search for every vi.fn(), vi.spyOn(), and vi.mock() in converted files. Each mock.module return value should retain the real module’s exports, and command transformations should produce the same result on repeated calls.
Read .opencode/skills/writing-tests/SKILL.md before editing test files. Changes to barrel exports call for running dependent tests; edits to recently refactored or extracted files call for a structure check first. The skill also specifies tests for both states of an opt-in feature and rules out inventing a new gating mechanism.
What it helps with
- move mocks from Vitest to Bun
- retain real module exports in
mock.module - check that
wrapCommandis idempotent - test both enabled and disabled opt-in states
Example prompts for the agent
- Move the mocks in this file from Vitest to Bun using
mock-to-internals-migration. - Check the barrel export changes and run the dependent tests.
- Add tests for both opt-in states without introducing a new gating mechanism.
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 .opencode/skills/generated/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 .opencode/skills/generated/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 do I install mock-to-internals-migration in Claude Code?
Run npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a claude-code. The skill file is located at ~/.claude/skills/mock-to-internals-migration/SKILL.md.
What does mock-to-internals-migration do?
It guides mock migrations from Vitest to Bun and sets checks for mock.module, barrel exports, and opt-in flags. It also calls for tests before and after the changes.
What does mock-to-internals-migration require?
Read .opencode/skills/writing-tests/SKILL.md before changing test files. The checks described by the skill use Bun, bun:test, and git diff.
Source text
SKILL.md · MIT
--- name: mock-to-internals-migration description: mock-to-internals-migration metadata: triggers: '["vitest to bun mock","mock-to-internals","_internals seam"]' generated_from_knowledge: '[]' source_knowledge_ids: '[]' generated_at: "2026-07-02T02:35:49.991Z" confidence: "0.60" status: active version: "6" 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. --> # mock-to-internals-migration ## Trigger - vitest to bun mock - mock-to-internals - _internals seam ## Required Procedure - mirror existing opt-in pattern: separate tool map constant, conditional merge in agents/index.ts, gating tests verifying disabled and enabled states - run barrel-import-dependent tests after modifying barrel exports - audit code structure integrity before editing a file that was recently refactored or extracted - grep for all vi.fn(), vi.spyOn(), vi.mock() in converted files before declaring conversion complete - spread real module exports as base of every mock.module return object - Load .opencode/skills/writing-tests/SKILL.md before touching any test file - run lint check (e.g. bun run lint or equivalent) as part of pre-submit verification, not just build - check for existing wrapper patterns before applying sandbox wrapping - design command-transformation pipelines as idempotent passes, not stacking layers - run tests on the unmodified codebase before starting to establish a failure baseline ## Forbidden Shortcuts - invent new tool-gating mechanisms for opt-in feature flags - label post-change test failures as 'pre-existing' without running tests before the change ## Delegation Template When delegating a task affected by this skill, include: ``` SKILLS: file:.opencode/skills/generated/mock-to-internals-migration/SKILL.md ``` ## Reviewer Checks - grep for import-from-barrel patterns in test files and run affected tests after barrel changes - grep for mock.module patterns that lack ...realModule spread - grep for mock.module calls to confirm they spread real exports - confirm bun:test isolation patterns match skill guidelines - verify wrapCommand idempotency by calling it twice on the same command and confirming output equals single-call output - Run `git diff <base>..<head> --name-only` and confirm file presence before marking introduced_by_pr: YES or NO ## Test Engineer Checks - Add or update tests covering the trigger condition and the forbidden shortcut.
© ZaxbyHub · MIT · ZaxbyHub/opencode-swarm
Similar skills
All skills for Testing and QA →mock-to-internals-migration by other authors comes first.