---
name: mock-to-internals-migration
description: mock-to-internals-migration
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.
