opencode: Skill for OpenCode

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

component-tests is a skill for OpenCode from anomalyco/opencode. It costs 171 tokens per session (4,790 once invoked), scanned C, original, MIT.

A guide for writing and maintaining Storybook component tests with Playwright. These tests render one interface component in a browser-like page while replacing backend services with in-page test doubles.

In plain words
What is it for?
Use it when adding, changing, reviewing, or debugging component tests in the listed application and session-interface packages.
Why use it?
It helps avoid slow or unreliable tests caused by shared development servers, parallel workers, module loading, cold pages, and UI actions running too early.

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/component-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 component-tests

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/anomalyco/opencode/component-tests"><img src="https://agentmods.dev/badge/skills/anomalyco/opencode/component-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 171 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,790 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.00171 $0.04790
Opus 5.5 $0.00068 $0.01916
Sonnet 5.5 $0.00034 $0.00958
Haiku 4.5 $0.00017 $0.00479

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

Security

Grade C, and why

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

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf packages/storybook/node_modules/.cache
.opencode/skills/component-tests/SKILL.md · 118 lines

How it starts

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

Component tests

Each package suite starts one Storybook/Vite dev server, and every worker shares it (packages/storybook/playwright/config.ts:17-24; CI uses 2 workers, config.ts:15). With fullyParallel (config.ts:12), the tests of one file run on several workers in any order. There is no backend: server, SDK and sync modules are in-page mocks. Every test gets a fresh context, and mount is a full iframe navigation (packages/storybook/playwright/story.ts:37). Slow or flaky component tests in CI have come from five sources: the shared server's dependency optimizer, module resolution that depended on the install layout, a cold first story, a product race (the mobile drawer), or an action that ran before the UI reached the state it needed.

Read these first rather than repeating them:

  • packages/storybook/playwright/README.md covers layout, run commands and "Adding a test".
  • packages/app/AGENTS.md "Tests" decides whether a test should exist, when theme or direction cases are allowed, and that a regression test must fail before the fix.
  • packages/app/e2e/AGENTS.md "Test Hygiene" applies here unchanged.

Stories and mount

  • Location. Put the story next to the production component under src/ of ui, session-ui, app or gui-extensions. Storybook indexes only the stories globs in packages/storybook/.storybook/main.ts:44-49.
  • Story ID. It is the meta id if one is set (packages/session-ui/src/components/session-review.stories.tsx:25). Otherwise it is the kebab-cased title, then --, then the kebab-cased export. Check it at http://127.0.0.1:6006/?path=/story/<id>. A wrong ID never renders, so mount waits out its full 30 s root wait (story.ts:39) and then fails.
  • URL args can be dropped. mount(id, { args, globals }) writes them into the URL (story.ts:20-36). Storybook drops an arg when the story declares no args/argTypes entry for its key. It also drops one whose value is not [A-Za-z0-9 _-]*, a number, a hex color or rgb()/hsl(), which rules out paths, URLs and file names with dots. The only trace is the browser console warning "Omitted potentially unsafe URL args.", and the test then passes on the default scenario.
    • Give every arg a typed default. With args: { split: false } (session-review.stories.tsx:129), split:false arrives as a boolean.
    • Pick punctuated values inside the story, from a scenario-style arg.
  • Globals are theme, direction and locale (packages/storybook/.storybook/preview.tsx:106-122). mount also sets a11y.manual (story.ts:29-36); caller globals override it.
  • Portaled UI. mount returns #storybook-root. Dialogs, menus and drawers render outside it, so locate them from page (packages/app/component-tests/composer.spec.ts:101-107).
  • Server state comes from the resolve.alias list in viteFinal (main.ts:72-94), which points app server, SDK and sync modules at packages/storybook/.storybook/mocks/app/**. Extend a mock rather than adding a server. Restore mock state in onCleanup (mockProviderAuth, packages/app/src/providers/connect/dialog.stories.tsx:23) so that switching stories in the Storybook UI does not inherit it. Tests reset it on every mount.
  • Requests the mocks do not answer. Route them with page.route. That includes server endpoints such as /api/fs/read (packages/session-ui/component-tests/read-image.spec.ts:20) and external URLs such as favicons (packages/session-ui/component-tests/markdown.spec.ts:217).

Read the full file on GitHub · 118 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 · 118 lines · 171 tokens per session scan C f6efe004f8dd

Subscribe to this mod's changes

component-tests is a skill published in the GitHub repository anomalyco/opencode (220,205 stars, last pushed today), licensed MIT. It adds 171 tokens to every session and 4,790 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). 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