writing-tests

Codify testing conventions, mocks, and CI practices for OpenCode Swarm tests.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/trader-RM/ultra-swarm --skill writing-tests-trader-rm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-tests
Source: https://github.com/trader-RM/ultra-swarm/tree/main/base/opencode-swarm/.opencode/writing-tests
Command: npx skills add https://github.com/trader-RM/ultra-swarm --skill writing-tests-trader-rm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Apply when writing tests, modifying test files, fixing test failures, debugging CI failures, adding test coverage, creating adversarial tests, or reviewing any file under tests/. Also apply when implementing features or fixes that require corresponding test changes.

Core Features & Use Cases

  • Provides a standardized framework for writing, organizing, and reviewing tests across the OpenCode Swarm repository.
  • Enforces guidelines for test frameworks (bun:test), mocking isolation, and CI-friendly practices.
  • Guides test placement (unit, integration, security) and per-file isolation to prevent cross-file interference.

Quick Start

Set up your testing workflow by aligning with bun:test usage, mock isolation rules, and per-file test organization in tests/.

Frequently Asked Questions about writing-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce test flakiness with bun:test?

Reduce test flakiness by enforcing per-file isolation, safe mocking, and dependency injection. Standardizing test organization prevents cross-file interference and minimizes maintenance overhead in your bun:test suite.

What is the best way to organize unit and integration tests in a CI workflow?

Organize unit, integration, and security tests under the tests/ directory with structured placement and per-file isolation. This CI-friendly practice ensures reliable execution and prevents cross-file test interference.

How do I set up safe mocking for unit tests?

Set up safe mocking by applying dependency injection and strict mock isolation rules. This disciplined approach prevents state leakage between tests and improves overall reliability and maintainability.

Does this testing convention apply when debugging CI failures?

Yes, apply these conventions when debugging CI failures, fixing test failures, or adding coverage. The framework codifies practices for modifying test files and resolving issues under tests/.

When should I use per-file isolation for test suites?

Use per-file isolation to prevent cross-file interference whenever you write or modify tests under tests/. It is essential for reducing flakiness and maintenance overhead across unit, integration, and security tests.