# Mock To Internals Migration

> mock-to-internals-migration

- Skill: `zaxbyhub/mock-to-internals-migration-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zaxbyhub/mock-to-internals-migration-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zaxbyhub/mock-to-internals-migration-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zaxbyhub (https://skillmd.com/u/zaxbyhub)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zaxbyhub/mock-to-internals-migration-2

---


<!-- 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.

