writing-tests · zaxbyhub — Claude Code skill: tests and installation
writing-tests sets test-authoring rules for the opencode-swarm repository. Use it before changing tests that involve mocks, temporary paths, or regression checks.
MIT ★ 539 updated 2026-10-29
npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a claude-codeWhat writing-tests does
Before editing tests, the skill directs you to read AGENTS.md, followed by .opencode/skills/writing-tests/SKILL.md. Tasks touching architecture and other listed areas also call for .agents/skills/engineering-conventions/SKILL.md.
The guidance requires bun:test and favors dependency injection or _internals over mock.module when practical. Temporary paths use os.tmpdir() with path.join(...); mock-heavy directories should be tested one file at a time. Regression tests need a falsifiable check: bypass the fix, confirm the test fails for the expected reason, then restore the fix and confirm it passes. In Codex, use apply_patch for manual edits and shell commands for test runs; avoid broad test_runner scopes.
What it helps with
- check repository test rules before editing
- choose a mock strategy for Node.js modules
- build temporary paths for cross-platform tests
- verify that a regression test catches the bug
Example prompts for the agent
- Before changing tests, read the
opencode-swarmguidance and check my edits. - Add a regression test for this bug and show that it fails without the fix.
- Write a test using
os.tmpdir()andpath.join(...)for its temporary directory.
How to install writing-tests
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a claude-code2Manually: put the files in place
~/.claude/skills/writing-tests/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/writing-tests/
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a codex2Manually: put the files in place
.agents/skills/writing-tests/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a cursor2Manually: put the files in place
.cursor/skills/writing-tests/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ZaxbyHub/opencode-swarm .agents/skills/writing-tests2Manually: put the files in place
.github/skills/writing-tests/SKILL.md1Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a gemini-cli2Platform CLI
gemini skills install https://github.com/ZaxbyHub/opencode-swarm --path .agents/skills/writing-testsManually: put the files in place
.devin/skills/writing-tests/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about writing-tests
How do I install writing-tests in Claude Code?
Run npx skills add ZaxbyHub/opencode-swarm --skill writing-tests -a claude-code, then open ~/.claude/skills/writing-tests/SKILL.md.
What does writing-tests do?
It provides test-authoring rules for opencode-swarm, including guidance on mocks, temporary paths, and regression checks.
How should I verify a regression test with writing-tests?
Bypass the fix and confirm the test fails for the expected reason. Restore the fix and check that the test passes.
Source text
SKILL.md · MIT
--- name: writing-tests description: Codex adapter for opencode-swarm test authoring rules. Use before creating or modifying any test file in this repository, especially bun:test files, mock.module usage, _internals seams, temp directories, cross-platform tests, or CI-sensitive test structure. metadata: audience: swarm-plugin --- # Writing Tests Use this Codex-facing adapter before touching tests in `opencode-swarm`. Read, in order: 1. `AGENTS.md` 2. `.opencode/skills/writing-tests/SKILL.md` If the task also touches architecture, plugin initialization, subprocesses, tool registration, plan durability, `.swarm` storage, runtime portability, session/global state, guardrails/retry, chat/system hooks, or release/cache behavior, also load `.agents/skills/engineering-conventions/SKILL.md`. Codex-specific execution notes: - Use `apply_patch` for manual test/source edits. - Use the available shell execution tool for `bun --smol test`, per-file loops, `rg`, and validation commands. - Prefer shell test commands for repo validation. Do not use broad OpenCode `test_runner` scopes. - Preserve unrelated user changes in the worktree. Carry forward the source skill's core rules: `bun:test` only, dependency injection or `_internals` over `mock.module` where possible, real module spreading when mocking Node built-ins, `os.tmpdir()` plus `path.join(...)` for temp paths, and per-file isolation for mock-heavy directories. Regression tests must also be falsifiable: remove or bypass the fix, confirm the test fails for the expected reason, restore the fix, and confirm the test passes; record the evidence or document why an equivalent mutation was required.
© ZaxbyHub · MIT · ZaxbyHub/opencode-swarm
Similar skills
All skills for Testing and QA →writing-tests by other authors comes first.