Code Splitting
thedaviddias/Front-End-Checklist
A skill your agent uses when reviewing large SPA bundles, new dependency additions, or routes that feel slow to hydrate.
Protocol for splitting test files that approach or exceed the FR-006 500-line limit (enforced in CI by scripts/check-test-file-cap.ts as a diff-scoped ratchet).
$ npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ZaxbyHub/opencode-swarm test-file-split --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/test-file-split .claude/skills/test-file-split && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "test-file-split" agent skill from https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-split into .claude/skills/test-file-split/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "test-file-split", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-splitType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ZaxbyHub/opencode-swarm test-file-split --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/test-file-split .agents/skills/test-file-split && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "test-file-split" agent skill from https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-split into .agents/skills/test-file-split/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "test-file-split", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ZaxbyHub/opencode-swarm test-file-split --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/test-file-split .cursor/skills/test-file-split && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "test-file-split" agent skill from https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-split into .cursor/skills/test-file-split/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "test-file-split", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ZaxbyHub/opencode-swarm.git --path .agents/skills/test-file-split--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ZaxbyHub/opencode-swarm test-file-split --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/test-file-split .gemini/skills/test-file-split && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "test-file-split" agent skill from https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-split into .gemini/skills/test-file-split/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "test-file-split", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ZaxbyHub/opencode-swarm test-file-splitInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/test-file-split .github/skills/test-file-split && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "test-file-split" agent skill from https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-split into .github/skills/test-file-split/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "test-file-split", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ZaxbyHub/opencode-swarm test-file-split --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/test-file-split .opencode/skills/test-file-split && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "test-file-split" agent skill from https://github.com/ZaxbyHub/opencode-swarm/tree/main/.agents/skills/test-file-split into .opencode/skills/test-file-split/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "test-file-split", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
test-file-splitProtocol for splitting test files that approach or exceed the FR-006 500-line limit (enforced in CI by scripts/check-test-file-cap.ts as a diff-scoped ratchet).
Test File Split is an agent skill from ZaxbyHub/opencode-swarm. Protocol for splitting test files that approach or exceed the FR-006 500-line limit (enforced in CI by scripts/check-test-file-cap.ts as a diff-scoped ratchet). Covers describe-block extraction, shared helper management, pure-function extraction, mock isolation verification, and cascading-split detection. Load when a test file approaches or exceeds 500 lines.
Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
The repository describes itself as: Architect-centric agentic swarm plugin for OpenCode. Hub-and-spoke orchestration with SME consultation, code generation, and QA review. The licence is MIT.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 624cb60. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
bunFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Test File Split loads about 1.3k tokens when it runs. Until then it costs about 94 tokens; SKILL.md has 510 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from ZaxbyHub/opencode-swarm at commit 624cb60, republished under its MIT licence (© ZaxbyHub). 510 words, ~1,318 tokens.
.claude/skills/test-file-split/SKILL.md (or your agent's skills folder).scripts/check-test-file-cap.ts enforces the 500-line cap per test file (FR-006 / SC-006.1) as a diff-scoped ratchet: new test files over 500 lines and existing over-cap files that grew fail the quality gate and block PR merge. Pre-existing over-cap files not touched by the PR are non-blocking. Escape hatch: TEST_CAP_ENFORCE=0 soft-warns. This skill covers the complete splitting protocol.
Read first: .opencode/skills/writing-tests/SKILL.md (or .claude/skills/writing-tests/SKILL.md) for bun:test framework rules, mock isolation patterns, and file placement conventions.
# Check the file
wc -l tests/unit/scripts/my-module.test.ts
# Find all test files exceeding 400 lines (early warning)
find tests/ -name "*.test.ts" -exec wc -l {} \; | sort -rn | awk '$1 > 400'Identify natural describe() block boundaries. Group blocks by functional area:
describe() block should belong to exactly one split filebeforeEach/afterEach hooks determine which blocks must stay together| Pattern | Example | When to use |
|---|---|---|
<module>-<area>.test.ts | release-notes-fragments-sha.test.ts | Split by functional area (SHA resolution, validation, merge logic) |
<module>-<area>.adversarial.test.ts | auth-login.adversarial.test.ts | Split adversarial tests into their own file |
Three options, in order of preference:
Extract to shared utility (preferred for complex shared setup):
Create tests/helpers/<module>-shared.ts with shared fixtures, mock factories, and setup functions. Import from both split files.
Duplicate simple imports (for small overlap):
If only bun:test imports and 1-2 source imports are shared, duplicate them in both files. Simpler than a utility module for trivial cases.
Extract pure functions from source (for testability):
If the source module has inline validation logic, extract them as exported pure functions (e.g., isValidPrNumber, resolveAllCandidates) so both test files can target them independently. See the PR #1762 example below. See .opencode/skills/generated/safe-extraction/SKILL.md for the source extraction pattern.
describe() blocks from the original file.wc -l tests/unit/scripts/my-module.test.ts tests/unit/scripts/my-module-sha.test.ts
# Both must be under 500 linesbun --smol test tests/unit/scripts/my-module.test.ts --timeout 60000
bun --smol test tests/unit/scripts/my-module-sha.test.ts --timeout 60000# Critical: Bun shares a single process across test files.
# mock.module leaks can cause co-run failures even when isolated runs pass.
bun --smol test tests/unit/scripts/my-module*.test.ts --timeout 60000If the co-run fails but isolated runs pass, check for mock.module() leakage. See .opencode/skills/writing-tests/SKILL.md → "Mock Isolation Rules" and the _internals DI seam pattern.
_test_exports opportunityAfter splitting, evaluate whether internal utility functions in the source module can be exported via _test_exports for zero-mock testing. This is a natural cleanup moment — the split already forces you to review test coverage boundaries.
If a previously split file exceeds 500 lines again, the test suite is structurally too large for a single module. Do not split a third time — reorganize the tests by source module boundaries instead. Repeated splitting produces fragmented test suites that are hard to navigate and maintain.
tests/unit/scripts/release-notes-fragments.test.ts exceeded 500 lines. It was split into:
| File | Lines | Content |
|---|---|---|
release-notes-fragments.test.ts | 379 | Fragment collection, deduplication, output formatting |
release-notes-fragments-sha.test.ts | 261 | extractCommitShasFromBody, mergeCandidateLists, resolveAllCandidates, isValidPrNumber, stripCustomReleaseNotesBlock |
The split also extracted isValidPrNumber and resolveAllCandidates as pure exported functions from the source module, enabling independent testing.
© ZaxbyHub, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/test-file-split of ZaxbyHub/opencode-swarm.
Open the folder on GitHubat commit 624cb60
Test File Split next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Test File Split this skillZaxbyHub/opencode-swarm | 490 | — | ~1.3k | Automated safety check: Pass | MIT | |
| Code Splittingthedaviddias/Front-End-Checklist | 74k | — | ~492 | Automated safety check: Pass | MIT | |
| Splitting Oversized ModulesPostHog/posthog | 40k | — | ~2.2k | Automated safety check: Pass | Custom licence | |
| SplitsBankrBot/skills | 1.2k | — | ~3.9k | Automated safety check: Pass | None | |
| Mcore Split PRNVIDIA/Megatron-LM | 18k | — | ~1.4k | Automated safety check: Pass | Apache-2.0 | |
| Stack Split Commitmozilla-firefox/firefox | 13k | — | ~1.3k | Automated safety check: Pass | Custom licence |
thedaviddias/Front-End-Checklist
A skill your agent uses when reviewing large SPA bundles, new dependency additions, or routes that feel slow to hydrate.
PostHog/posthog
Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior.
BankrBot/skills
Use Splits with Bankr for onchain treasury operations: secure assets, process revenue, manage operating subaccounts, pay expenses, govern contracts, and maintain clean accounting books.
NVIDIA/Megatron-LM
Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.
mozilla-firefox/firefox
Split one large or hard-to-review commit into several commits that each stand on their own for review, in a git or a Jujutsu (jj) checkout.
lobehub/lobehub
Documents how LobeHub's standalone micro apps are hosted, built and routed differently on Cloud versus self-hosted Docker, so a change does not break one path while fixing the other.
ZaxbyHub/opencode-swarm
Runs an evidence-gated, quote-grounded audit of a codebase for security, QA, accessibility, performance and more, and writes a verified report without changing source files.
ZaxbyHub/opencode-swarm
Drives a bug report from validation and root-cause tracing through a critic-reviewed plan, an approved minimal fix and a PR-ready closure, never merging without recorded human approval.
ZaxbyHub/opencode-swarm
Codex adapter for opencode-swarm that governs commits, pushes, draft PRs, PR body updates and CI closeout, deferring to the repo's canonical commit-pr protocol.
ZaxbyHub/opencode-swarm
Keeps plans, decisions, evidence and reviewer verdicts in small files so long multi-phase tasks survive context compaction and session resumes.
ZaxbyHub/opencode-swarm
Ingests existing pull request feedback such as review comments and CI failures, verifies each claim, fixes confirmed issues and reports closure status for every item.
ZaxbyHub/opencode-swarm
Monitor a pull request after creation and act autonomously on pushed PR activity.
Protocol for splitting test files that approach or exceed the FR-006 500-line limit (enforced in CI by scripts/check-test-file-cap.ts as a diff-scoped ratchet). Test File Split is an agent skill from ZaxbyHub/opencode-swarm.ts as a diff-scoped ratchet).
Run `npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a claude-code`. Or copy the skill folder (.agents/skills/test-file-split in ZaxbyHub/opencode-swarm) into .claude/skills/test-file-split in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a codex`. Or copy the skill folder (.agents/skills/test-file-split in ZaxbyHub/opencode-swarm) into .agents/skills/test-file-split in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ZaxbyHub/opencode-swarm --skill test-file-split -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/test-file-split, .gemini/skills/test-file-split, .github/skills/test-file-split and .opencode/skills/test-file-split in your project.
Going by SKILL.md and its folder, Test File Split needs the command-line tools its instructions call (bun).
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Test File Split is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Test File Split: Code Splitting (thedaviddias/Front-End-Checklist, 74k stars), Splitting Oversized Modules (PostHog/posthog, 40k stars), Splits (BankrBot/skills, 1.2k stars) and Mcore Split PR (NVIDIA/Megatron-LM, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ZaxbyHub (a GitHub organization) maintains it in ZaxbyHub/opencode-swarm, which has 490 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on October 7, 2026.
Source: ZaxbyHub/opencode-swarm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.