Skip to main content
skill CX Codex

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

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

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

mock-to-internals-migration ZaxbyHub 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. 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 meticulous-use-session-data alwaysmeticulous meticulous-use-session-data — a skill for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode that downloads structured Meticulous session data — recorded user flows and network mocks. CX Codex +1 9,000installs testing Mindrally Defines software testing guidelines for AI agents, covering test isolation, table-driven checks, and mock boundaries. CX Codex +1 888installs 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 testing-boss Pedro Nauck testing-boss guides test writing and LLM eval design: helps pick the right test layer, trim fragile mocks, and diagnose flaky CI suites without adding dummy production code. CX Codex +1 274installs demock LilMGenius demock — a Claude Code skill that finds mocks and hidden failures on live code paths. It runs when reviewing changes, integrations, or error handling. CX Codex +1 125installs

From the same set121

The whole set →
swarm-implement The swarm-implement skill for Claude Code takes a feature or bug fix from exploration through validation, following the repo's canonical SKILL.md. CX Codex +1 ★ 539repo stars research-first research-first forces agents to verify repo facts and external sources before planning or writing code. CX Codex +1 ★ 539repo stars qa-sweep The qa-sweep skill runs an independent QA pass after implementation or debugging, inspecting the diff and changed files before focused validation. CX Codex +1 ★ 539repo stars contributing contributing is a Claude Code skill that maps commits, test runs and PRs to the opencode-swarm checklist, including the required release fragment. CX Codex +1 ★ 539repo stars pr-review-fix This compatibility skill routes older pr-review-fix calls to the swarm-pr-feedback workflow for handling pull request feedback. CX Codex +1 ★ 539repo stars tech-debt-ci-review tech-debt-ci-review audits technical debt and shaky CI: test theater, flaky runs, green builds hiding a break. You get findings tied to files and lines, plus a fix order. CX Codex +1 ★ 539repo stars guardrail-patterns guardrail-patterns guides agents when editing destructive-command guards in opencode-swarm, setting document reading order and adversarial testing rules. CX Codex +1 ★ 539repo stars propagation-test The propagation-test skill sets a test procedure for changes to a shared module: exercise every consumer through the shared seam, without per-consumer overrides. CX Codex +1 ★ 539repo stars

Project sponsors

Companies that keep this analytics open