What problem does it solve?
Extracting code from large monolith files frequently causes CI invariant check failures, broken dependency injection seams used for test mocking, and cross-file test regressions. This Skill provides a step-by-step safety-first protocol to eliminate these common refactoring risks.
Core Features & Use Cases
- Barrel re-export management: Preserves existing public API import paths so no downstream consumer code requires updates.
- _internals DI seam preservation: Maintains test mockability for extracted functions via getter/setter proxy patterns.
- CI and test verification: Automates updates to CI path allowlists and validates full cross-file test compatibility post-extraction.
- Use Case: When splitting a 2000+ line guardrails module into dedicated submodules for a TypeScript OpenCode plugin, this Skill ensures all existing imports resolve, test mocks continue to work, and CI quality gates pass without manual intervention.
Quick Start
Use the safe-extraction skill to split the oversized src/hooks/guardrails.ts file into modular subfiles while preserving all existing functionality and test coverage.