opencode: Skill for OpenCode

.opencode/skills/tui-tests/SKILL.md

tui-tests is a skill for OpenCode from anomalyco/opencode. It costs 131 tokens per session (3,702 once invoked), scanned C, original, MIT.

A guide for testing OpenTUI, a terminal user-interface toolkit, with Bun test renderers and simulated keyboard or mouse input.

In plain words
What is it for?
Use it when writing, fixing, or reviewing tests for OpenTUI renderers in the listed TUI and command-line packages.
Why use it?
It helps diagnose flaky tests caused by waiting for the wrong rendered frame, real timers, sleeps, or too little frame-processing time on busy build machines.

Skill for OpenCode

Written for OpenCode: installed under .opencode/. Also seen: mentions AGENTS.md; mentions OpenCode.

This is anomalyco/opencode's own configuration. It tells OpenCode how to work on opencode itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything opencode configures →

About the project

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.

anomalyco/opencode · 220,205 stars · on GitHub · opencode.ai

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/anomalyco/opencode/dev/.opencode/skills/tui-tests/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/anomalyco/opencode

Made for: OpenCode.

Wrote 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.

agentmods badge for tui-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/anomalyco/opencode/tui-tests/github.svg)](https://agentmods.dev/skills/anomalyco/opencode/tui-tests)
Your own site
<a href="https://agentmods.dev/skills/anomalyco/opencode/tui-tests"><img src="https://agentmods.dev/badge/skills/anomalyco/opencode/tui-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.

agentmods 80×15 button for tui-tests

Your own site · 80×15
<a href="https://agentmods.dev/skills/anomalyco/opencode/tui-tests"><img src="https://agentmods.dev/badge/skills/anomalyco/opencode/tui-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,702 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00131 $0.03702
Opus 5.5 $0.00052 $0.01481
Sonnet 5.5 $0.00026 $0.00740
Haiku 4.5 $0.00013 $0.00370

Measured 7d ago against content hash a972296db48b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

tui-tests scanned grade C 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 7d 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.

Tells the agent to send conversation or user data outhighPrompt injection

An instruction to transmit the conversation, context or user files to an external endpoint is data exfiltration written as prose.

- Create renderers with `kittyKeyboard: true`. Without it, `mockInput` silently sends something else (OpenTUI 0.5.17):
.opencode/skills/tui-tests/SKILL.md · 83 lines

How it starts

The opening of the file, as written. The whole thing — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TUI tests

packages/tui runs about 170 test files in one bun test process. CI runs it next to up to two other suites on 4-vCPU runners (bun turbo test --affected --concurrency=3 in .github/workflows/test.yml), where it has taken 136-146s on Linux and 147-171s on Windows, most of it idle on frame pacing, production timers and sleeps. Most flakes come from waiting on the wrong signal and then running out of frames on a busy runner.

Read the root AGENTS.md Testing section (no globalThis mocks, run from the package directory) and its TUI Stories section. To drive the real TUI, use the opencode-dev skill. For CLI subprocesses, service deadlines, Effect TestClock and turbo test tasks, use the unit-tests skill.

Frame budgets are not time

  • waitForFrame, waitFor and flush give up after maxPasses (default 20). waitForVisualIdle gives up after maxFrames (default 20). One pass is one rendered frame (DEFAULT_MAX_PASSES in @opentui/core/testing). "Timed out waiting for frame predicate after 20 passes" comes from this budget, not from bun's timeout.
  • Started renderer (setup.renderer.start(), as createAppFixture does at packages/tui/test/fixture/app.ts:28): frames tick at OpenTUI's default 30 fps, so 20 passes are about 0.66s. Production renders at targetFps: 60 (packages/tui/src/app.tsx:241), so test frames are twice as slow as the real app.
  • Not started (the default for testRender and createTestRenderer): waitFor and waitForFrame fail within milliseconds when no render is scheduled, and the error shows isRunning: false. In the same state flush() and waitForVisualIdle() return immediately without error; they do not wait for fetches or timers. Await the signal, then renderOnce().
  • Wait on frames only for something a frame produces. For anything else, wait on the signal itself:
    • Focus set on a timer. DialogSelect focuses its filter with setTimeout(..., 1) (packages/tui/src/ui/dialog-select.tsx:702), which takes about 15ms on Windows. typeText sends keys to whatever is focused, so early keys are dropped and Enter then picks the default option. Put the focus in the predicate, as both dialog waits in packages/tui/test/command-selection.test.tsx do (:68-70 for the model, :75-80 for the variant): setup.renderer.currentFocusedRenderable instanceof InputRenderable. Before the variant wait had it, the test flaked in 5 CI runs in 20 hours, including a dev push, and a bigger budget did not help: it still failed with maxPasses: 150, because the keys were lost, not late. If a wait fails with the focus in the predicate, look for a state race, not the budget.
    • Markdown and code text. <markdown> (packages/tui/src/routes/session/message-parts.tsx:182) draws no text until the shared tree-sitter worker replies, while frames keep ticking, so a plain waitForFrame can spend all 20 passes on a loaded runner with the text still pending. Use waitForHighlightedFrame(setup, predicate, options?) from packages/tui/test/fixture/frame.ts. When the predicate fails, it awaits every in-flight CodeRenderable.highlightingDone inside the frame predicate, and awaiting there does not use up passes. It accepts any setup with renderer and waitForFrame; app-lifecycle, session-group-navigation and session-home wait on transcript text this way. If the code under test accepts a client, inject new MockTreeSitterClient({ autoResolveTimeout: 0 }) instead (packages/tui/test/mini/scrollback.surface.test.ts:87).
    • Requests and other state. Await the deferred response your fetch handler returns. With no signal to await, poll with a wall-clock deadline instead of raising maxPasses: the file-local waitForFrame(setup, matches) at command-selection.test.tsx:117 checks captureCharFrame() every 10ms for up to 2s. wait in packages/tui/test/cli/tui/data.test.tsx:37 and waitForModel in packages/tui/test/fixture/local.tsx:109 do the same for state.
  • waitForVisualIdle returns on the first frame with cellsUpdated === 0 by default. A frame waiting on a highlight is also quiet, so wait for the text before you measure layout or assert on it: session-home.test.tsx:227 waits for "History message 0001" with waitForHighlightedFrame after waitForVisualIdle() instead of reading the frame directly.
  • Settle steps cost frames. Each waitForVisualIdle({ quietFrames: 3 }) takes at least 3 frames, about 100ms at 30 fps. session-group-navigation.test.tsx has 14 of them. When you know what you are waiting for, wait for that frame instead.
  • Do not use maxPasses as a clock. Several waits do, and each assumes 33ms frames:
    • app-lifecycle.test.tsx:792: 120 passes to cover the 1s reconnect delay after setup.events.disconnect() at :784;
    • app-lifecycle.test.tsx:1721-1723: 200 passes per retry-countdown second;
    • component/dialog-shell-output.test.tsx:144: 100 passes for a 1s poll, plus Bun.sleep(1100) at :163 and :182;
    • session-panel.test.tsx:590: 120 passes in ready() for the initial load.

Read the full file on GitHub · 83 lines

Changes

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.

  1. 7d ago First seen · 83 lines · 131 tokens per session scan C a972296db48b

Subscribe to this mod's changes

tui-tests is a skill published in the GitHub repository anomalyco/opencode (220,205 stars, last pushed today), licensed MIT. It adds 131 tokens to every session and 3,702 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it C with 1 finding (tells the agent to send conversation or user data out). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-16.

Related

Other skills, from other repositories

research-engineer

An uncompromising Academic Research Engineer. Operates with absolute scientific rigor, objective criticism, and zero flair. Focuses on theoretical correctness, formal verification, and optimal implementation across any required technology.

davila7/claude-code-templates · 43 tokens

tika-eval-compare

Compare extracts from two Tika builds over a corpus to detect regressions in content, encoding, exceptions, and embedded-document handling. Use for "compare before/after extracts", "eval this change against the corpus".

apache/tika · 50 tokens

cua-driver

Use Cua Driver for desktop or browser tasks that are awkward or unavailable through Bash/APIs, or when the user explicitly wants GUI interaction: app testing, visual bug reproduction, form filling, calendar entry, screenshots, and demo recording. Also covers Cua setup; not OpenAI Codex Computer Use or web research.

davidondrej/skills · 68 tokens

jetson-validate-image

Use after jetson-flash-image to run static BSP checks, on-target smoke/regression tests on a flashed DUT, or both. Not for build or flash steps. Triggers: validate bsp, on-target validation.

NVIDIA/skills · 50 tokens

atmos-validation

Validate Atmos projects, components, arbitrary JSON Schema inputs, EditorConfig, and GitHub Actions; use affected-file selection and native CI annotations.

cloudposse/atmos · 31 tokens

skill-benchmark

Benchmark AI skill effectiveness by measuring implementation quality against legacy constraints.

HoangNguyen0403/agent-skills-standard · 16 tokens