Agent skill

Write Tests

by gnomeria in gnomeria/usbtree

Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression.

MITAuto-check passedTesting & QA

Install Write Tests

skills CLI
$ npx skills add gnomeria/usbtree --skill write-tests -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install gnomeria/usbtree write-tests --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/gnomeria/usbtree.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/write-tests .claude/skills/write-tests && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
write-tests
GitHub stars
688
Token cost
~622 tokens
SKILL.md length
299 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression.

  • Works in 4 steps: Match repo style → Choose level → Write → …
  • The user says write tests for
  • SKILL.md covers Step 1 — Match repo style, Step 2 — Choose level, Step 3 — Write and Step 4 — Run and report
  • Calls cargo

What it does

Write Tests is an agent skill from gnomeria/usbtree. Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression. Use when the user says "write tests for", "add test coverage", "test this function/handler/component", "this needs tests", or after implementing a feature that lacks tests.

Its SKILL.md is about 620 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Test generation and Test coverage. The repository describes itself as: Live USB device tree in your terminal. Rust TUI, no root, no libusb. Full activity metrics on Linux; device tree on macOS/Windows. The licence is MIT.

When your agent uses it

  • The user says write tests for
  • Add test coverage
  • Test this function/handler/component
  • This needs tests

Example prompts

  • “write tests for”
  • “add test coverage”
  • “test this function/handler/component”
  • “/write-tests”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Match repo style
  2. Choose level
  3. Write
  4. Run and report

What it can do on your machine

Read from SKILL.md and the folder at commit 8ba6a5e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Write Tests loads about 622 tokens when it runs. Until then it costs about 75 tokens; SKILL.md has 299 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~622

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from gnomeria/usbtree at commit 8ba6a5e, republished under its MIT licence (© gnomeria). 299 words, ~622 tokens.

Download SKILL.mdSave it as .claude/skills/write-tests/SKILL.md (or your agent's skills folder).
name
write-tests
description
Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression. Use when the user says "write tests for", "add test coverage", "test this function/handler/component", "this needs tests", or after implementing a feature that lacks tests.

Write Tests

Test fails when behavior breaks, passes when it doesn't — nothing more. Run at end, report honestly.

Step 1 — Match repo style

  • Tests live in-file: #[cfg(test)] mod tests at bottom, use super::*.
  • Builder helpers for fat structs (see dev() in src/usb.rs tests) — reuse existing helper, extend it, don't build parallel one.
  • Plain assert_eq!/assert!. No assertion crates, no mock frameworks.
  • Raw descriptor bytes: inline arrays with #[rustfmt::skip] + comment per chunk (existing pattern).

Step 2 — Choose level

Cheapest level that catches the regression:

  • Unit #[test] — pure logic: tree flatten/fold, parsing (usb.ids, sysfs values, descriptors), diff. Default. No hardware, no I/O.
  • Smoke — ./target/release/usbtree --demo --dump: exercises scan→tree→render path, no hardware. For wiring bugs, not logic bugs.
  • TUI in pty — --demo in pty for interaction (keys, fold, filter). Manual/scripted, last resort — most TUI logic is testable as pure functions on App state; prefer extracting that.

Pure parse bug tested through pty = wrong. Keybinding wiring tested as unit = also wrong. Match level to where bug lives.

Step 3 — Write

  • Behavior, not implementation. Assert outputs and state, not internals.
  • Name by behavior: max_power_parses_sysfs, filter_finds_devices_in_collapsed_hubs — not test1.
  • Independent tests: own data, no ordering deps. No shared mutable state — tests run parallel by default.
  • Filesystem cases: tempfile::TempDir if already a dep, else skip fs test and test the parse fn on a &str instead — push I/O to edge, test the pure part.
  • Cover happy path, interesting failures (malformed input, missing sysfs file, truncated descriptor), boundary values. Skip permutations hitting same branch.
  • Don't test nusb/ratatui — test your use of them.

Step 4 — Run and report

  • cargo test name_fragment first, then full cargo test.
  • Report pass/fail, verbatim output for red.
  • Test caught real bug in code under test → fix code (or flag), never the test.
  • Never weaken assertion or skip to get green. Never report green without running.

© gnomeria, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/write-tests of gnomeria/usbtree.

Open the folder on GitHubat commit 8ba6a5e

Compare with similar skills

Write Tests next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Write Tests compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Write Tests this skillgnomeria/usbtree688—~622Automated safety check: PassMIT
E2E Test ThinkerUniClipboard/UniClipboard1.8k—~1.7kAutomated safety check: PassAGPL-3.0
Ralph Coveragejvm-skills/jvm-skills140—~683Automated safety check: PassApache-2.0
Designing TestsCloudAI-X/opencode-workflow275—~2.9kAutomated safety check: PassMIT
Mutation Testingproffesor-for-testing/agentic-qe494—~1.7kAutomated safety check: PassMIT
Mutation Testjmagly/aiwg220—~3.2kAutomated safety check: PassMIT

Similar skills

  • E2E Test Thinker

    UniClipboard/UniClipboard

    Analyze the current branch's diff against main and determine which changes are testable via CLI-based end-to-end tests.

    1.8k GitHub stars~1.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Ralph Coverage

    jvm-skills/jvm-skills

    Run Ralph in coverage mode — iteratively write tests for untested classes until coverage targets are met.

    140 GitHub stars~683 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Designing Tests

    CloudAI-X/opencode-workflow

    Guides test strategy, TDD/BDD approaches, test coverage planning, and testing best practices.

    275 GitHub stars~2.9k tokensUpdated 9 mo ago
    Testing & QAAuto-check passed
  • Mutation Testing

    proffesor-for-testing/agentic-qe

    Test quality validation through mutation testing, assessing test suite effectiveness by introducing code mutations and measuring kill rate.

    494 GitHub stars~1.7k tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Mutation Test

    jmagly/aiwg

    Run mutation testing to validate test quality beyond code coverage.

    220 GitHub stars~3.2k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • Write Frontend Tests

    Elite588/AUTOGPT

    Analyze the current branch diff against dev, plan integration tests for changed frontend pages/components, and write them.

    103 GitHub stars~1.9k tokensUpdated 5 mo ago
    Testing & QAAuto-check passed

More from gnomeria/usbtree

  • Knowledge Graph

    gnomeria/usbtree

    Set up and maintain a lightweight, file-based knowledge graph of the repo — entities, typed relations, decisions, gotchas — so agents load context fast instead of re-exploring the codebase every…

    688 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed
  • CI GitHub Actions

    gnomeria/usbtree

    GitHub Actions CI pipeline conventions — job shape, caching, permissions, and action pinning.

    688 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Debug

    gnomeria/usbtree

    Systematic root-cause debugging — reproduce, isolate, fix at the source, prove the fix.

    688 GitHub stars~715 tokensUpdated 1 mo ago
    Auto-check passed
  • Refactor

    gnomeria/usbtree

    Behavior-preserving restructuring done safely — test net first, small verified steps, no mixed-in feature changes.

    688 GitHub stars~669 tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Write Tests

What does Write Tests do?

Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression. Write Tests is an agent skill from gnomeria/usbtree. Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression.

When should I use Write Tests?

Write Tests fits situations like: the user says write tests for; add test coverage; test this function/handler/component; this needs tests.

How do I install Write Tests in Claude Code?

Run `npx skills add gnomeria/usbtree --skill write-tests -a claude-code`. Or copy the skill folder (.agents/skills/write-tests in gnomeria/usbtree) into .claude/skills/write-tests in your project. Claude Code loads it when a task matches its description.

How do I install Write Tests in Codex?

Run `npx skills add gnomeria/usbtree --skill write-tests -a codex`. Or copy the skill folder (.agents/skills/write-tests in gnomeria/usbtree) into .agents/skills/write-tests in your project. Codex loads it when a task matches its description.

Can I use Write Tests in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add gnomeria/usbtree --skill write-tests -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/write-tests, .gemini/skills/write-tests, .github/skills/write-tests and .opencode/skills/write-tests in your project.

What does Write Tests need to run?

Going by SKILL.md and its folder, Write Tests needs the command-line tools its instructions call (cargo).

Does Write Tests access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Write Tests safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Write Tests use?

Write Tests is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Write Tests use?

About 622 tokens (SKILL.md is roughly 2.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Write Tests?

Skills that share tags, products or a category with Write Tests: E2E Test Thinker (UniClipboard/UniClipboard, 1.8k stars), Ralph Coverage (jvm-skills/jvm-skills, 140 stars), Designing Tests (CloudAI-X/opencode-workflow, 275 stars) and Mutation Testing (proffesor-for-testing/agentic-qe, 494 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Write Tests?

gnomeria (a GitHub user) maintains it in gnomeria/usbtree, which has 688 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on August 20, 2026.

Source: gnomeria/usbtree on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.