Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ZaxbyHub/opencode-swarm --skill mock-to-internals-migration -a claude-code
Open on GitHub

What 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 wrapCommand is 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-code

2Manually: put the files in place

~/.claude/skills/mock-to-internals-migration/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/mock-to-internals-migration/

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.

mock-to-internals-migration ZaxbyHub mock-to-internals-migration guides test migrations away from Bun mock.module leaks toward dependency-injection seams using _internals. CX Codex +1 ★ 539repo stars bun-jest-migration secondsky bun-jest-migration is a Claude Code skill that guides Jest test suites through a move to Bun’s test runner. It covers imports, mocks, and test configuration. CX Codex +1 405installs gjalla-test-audit gjalla gjalla-test-audit audits test suites to uncover false confidence, over-mocked logic, and assertions that conceal code regressions. Helpful when hardening test suites before major updates. CX Codex +1 888installs caliber-testing caliber-ai-org caliber-testing is a Claude Code skill that generates Vitest tests with process.env resets, vi.hoisted mocks, and test files placed in __tests__ directories. CX Codex +1 ★ 1,319repo stars testing caliber-ai-org Defines Vitest testing patterns for Caliber, enforcing colocated test suites, environment isolation, and global LLM mocks. CX Codex +1 ★ 1,319repo stars test-migration kindlmann test-migration migrates a test suite from Selenium, Cypress, Jest, Mocha or Protractor to Playwright and Vitest without quietly losing coverage. CX Codex +1 1,300installs migrate-to-rstest rstackjs migrate-to-rstest migrates Jest, Vitest, or Playwright Test suites to Rstest while keeping test discovery, assertions, mocks, snapshots, and coverage intact. For moving a runner without rewriting scenarios. CX Codex +1 436installs

From the same set121

The whole set →
discover This skill delegates repository discovery and maps project rules, code structure, and risk areas. Use it before a complex change when you need to understand the existing project first. CX Codex +1 ★ 539repo stars ci-fix-monitor ci-fix-monitor is a Claude Code skill that monitors pull request check runs and resolves CI failures. It tracks builds until every required job turns green. CX Codex +1 ★ 539repo stars swarm-resume swarm-resume is a Claude Code skill that restores swarm plan state and clears stale git branches to resume work on an approved plan. CX Codex +1 ★ 539repo stars ci-failure-batching ci-failure-batching collects failed PR checks before planning fixes. Use it to group related CI problems and avoid a separate push cycle for each one. CX Codex +1 ★ 539repo stars gate-attribution gate-attribution assigns reviewer and test engineer verdicts to individual plan tasks during swarm batch runs. Activates when dispatches return multi-task rows. CX Codex +1 ★ 539repo stars merge-queue-readiness The merge-queue-readiness skill simulates a PR merged with the latest main before it enters a GitHub merge queue. Use it to catch integration failures that isolated PR checks can miss. CX Codex +1 ★ 539repo stars issue-tracer issue-tracer — a subagent that carries a GitHub issue from report to fix plan. It collects evidence, pinpoints the root cause, and touches no code until you approve the plan. CX Codex +1 ★ 539repo stars qa-reviewer The qa-reviewer subagent reviews pull requests before merge, checking logic, security, error handling, style, and test coverage without changing code. CX Codex +1 ★ 539repo stars

Project sponsors

Companies that keep this analytics open