OpenCode is an open-source AI coding agent that helps developers work on software projects. It includes agents for full-access development, read-only exploration and planning, plus a general subagent for complex searches and multistep tasks; the catalogue add-ons extend its workflows.
Borrowing it
Nothing to install: this file belongs to anomalyco/opencode. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/anomalyco/opencode/dev/.opencode/skills/unit-tests/SKILL.mdgit clone --depth 1 https://github.com/anomalyco/opencodeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/anomalyco/opencode/unit-tests)<a href="https://agentmods.dev/skills/anomalyco/opencode/unit-tests"><img src="https://agentmods.dev/badge/skills/anomalyco/opencode/unit-tests/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/anomalyco/opencode/unit-tests"><img src="https://agentmods.dev/badge/skills/anomalyco/opencode/unit-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00175 | $0.05839 |
| Opus 5.5 | $0.00070 | $0.02336 |
| Sonnet 5.5 | $0.00035 | $0.01168 |
| Haiku 4.5 | $0.00017 | $0.00584 |
Grade A, and why
unit-tests scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
- **Independent children** start together (`Promise.all`, `packages/ai/test/exports.test.ts:63`). `packages/app/test-browser/playwright-config.test.ts` runs sequential `Bun.spawnSync` (3.5s on Windows, 1.4s on Linux); `p How it starts
The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Fast, Reliable Unit Tests
CI runs bun turbo test --affected --concurrency=3 on 4-vCPU Linux and Windows runners (unit job in .github/workflows/test.yml), so each suite shares the CPU with two others, and Windows is the slower leg. Most slow or flaky unit tests here wait on real time, spawn too many processes, or assert wall-clock speed.
Read these first; this skill does not repeat them:
- Root
AGENTS.md: the Testing and Style Guide sections. packages/app/AGENTS.mdTests (packages/desktopandpackages/gui-extensionsfollow it): one owner per contract, and no production seams for tests.packages/ai/AGENTS.md: cassettes. Theeffectskill:it.effectandit.live.
Sibling skills: tui-tests (OpenTUI renderer tests in tui and cli), app-e2e-tests (Playwright in packages/app/e2e), component-tests (Storybook Playwright). This skill owns cli subprocess and service tests.
Know the budget
- Bun's default per-test timeout is 5000ms. Check the package's
testscript:- 30s: ai, cli, desktop, http-recorder, latex, merman, simulation, theme and tui pass
--timeout 30000; core'sscript/test.tspasses--timeout=30000. - 5s: client, httpapi-codegen and sdk pass
--timeout 5000; app, codemode, function, gui-extensions, plugin, plugin-browser, script, server, session-ui, ui and util use the default.
- 30s: ai, cli, desktop, http-recorder, latex, merman, simulation, theme and tui pass
- Size Windows risk by counting spawns, not by local wall time.
- npm.test.ts "installs a Git package from an npm ::path: subdirectory at a branch" takes 0.4s locally and hit 5000ms on Windows CI. Each Npm.add Git case makes about 75 git process events: 3
clone --recurse-submodules, which run the git-submodule shell script. - Assume roughly 40ms per Git-for-Windows spawn (estimated from an earlier git.test run on Windows CI: ~24s for 564 spawns). Some core file groups run 5-9x slower on Windows than locally.
- Those
test.eachcases (npm.test.ts:223,:251) hit 5000ms in 13 of 45 Windows core runs; that is why core's runner now defaults to 30s (comment atpackages/core/script/test.ts:38).
- npm.test.ts "installs a Git package from an npm ::path: subdirectory at a branch" takes 0.4s locally and hit 5000ms on Windows CI. Each Npm.add Git case makes about 75 git process events: 3
- A timeout loosens the budget only when it exceeds the package default.
- In a 5s package, work that legitimately needs longer gets a per-test timeout and a comment naming the work:
packages/server/test/fetch.test.ts:406-407("Real retries wait 18 * 200 ms ...",{ timeout: 10_000 }).test.each(table)(name, fn, 30_000)takes it as the third argument. Use file-widesetDefaultTimeoutonly when every test in the file does such work. - In core, the four file-level
setDefaultTimeout(30_000)calls only restate the runner default, and a per-test{ timeout: 15_000 }(still intool-shell.test.ts,session-generate.test.tsand others) is stricter than it. Do not add values at or below 30s there.
- In a 5s package, work that legitimately needs longer gets a per-test timeout and a comment naming the work:
- Never absorb a sleep, poll or production interval with a larger timeout,
--retry, orskipIf(win32); remove the wait. Skip on Windows only when the platform lacks the capability, with a comment (npm.test.ts:313, symlinks).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago Changed f7744a08a3d7
- 6d ago Changed 0fee850057b5
- 7d ago First seen · 141 lines · 175 tokens per session scan A e329fdec58db
unit-tests is a skill published in the GitHub repository anomalyco/opencode (220,205 stars, last pushed today), licensed MIT. It adds 175 tokens to every session and 5,839 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-16.
Other skills, from other repositories
test-master
Generates test files, creates mocking strategies, analyzes code coverage, designs test architectures, and produces test plans and defect reports across functional, performance, and security testing disciplines. Use when writing unit tests, integration tests, or E2E tests; creating test strategies or automation…
migrate-xunit-to-xunit-v3
Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…
go-testing
Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.
dart-test
DART Test: unit tests, integration tests, CI validation, and debugging.
principle-test-behavior-not-implementation
Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.
mobiai-ios-testing
Use when writing or running tests in an iOS project — unit tests, UI tests, snapshot tests, choosing the right framework.