Agent skill

Writing Rust Tests

by xmtp in xmtp/libxmtp

A skill your agent uses when writing, modifying, or reviewing Rust tests in crates/ or bindings/ - covers test macros, fixtures, assertions, WASM compatibility, and how to run tests

MITAuto-check passed

Install Writing Rust Tests

skills CLI
$ npx skills add xmtp/libxmtp --skill writing-rust-tests -a claude-code

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

GitHub CLI
$ gh skill install xmtp/libxmtp writing-rust-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/xmtp/libxmtp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/writing-rust-tests .claude/skills/writing-rust-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
writing-rust-tests
GitHub stars
121
Token cost
~740 tokens
SKILL.md length
216 words
Files
7
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when writing, modifying, or reviewing Rust tests in crates/ or bindings/ - covers test macros, fixtures, assertions, WASM compatibility, and how to run tests

  • Reviewing Rust tests in crates/
  • SKILL.md covers Essentials, Running Tests, Writing Philosophy and Further Reference
  • Calls just and cargo
  • Bindings/ - covers test macros

What it does

Writing Rust Tests is an agent skill from xmtp/libxmtp. Use when writing, modifying, or reviewing Rust tests in crates/ or bindings/ - covers test macros, fixtures, assertions, WASM compatibility, and how to run tests

Its SKILL.md is about 740 tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files (for example `assertions.md`, `fixtures.md` and `parametrized.md`).

It works with Rust and WebAssembly. The repository describes itself as: shared library bindings & reference implementation of XMTP (X-tensible Message Transport Protocol). The licence is MIT.

When your agent uses it

  • Reviewing Rust tests in crates/
  • Bindings/ - covers test macros
  • WASM compatibility
  • How to run tests

Example prompts

  • “/writing-rust-tests”

What it can do on your machine

Read from SKILL.md and the folder at commit cc87802. 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:

    • just
    • 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

Writing Rust Tests loads about 740 tokens when it runs. Until then it costs about 45 tokens; SKILL.md has 216 words of instructions outside code blocks.

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

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 xmtp/libxmtp at commit cc87802, republished under its MIT licence (© xmtp). 216 words, ~740 tokens.

Download SKILL.mdSave it as .claude/skills/writing-rust-tests/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
writing-rust-tests
description
Use when writing, modifying, or reviewing Rust tests in crates/ or bindings/ - covers test macros, fixtures, assertions, WASM compatibility, and how to run tests

Writing Rust Tests in libxmtp

Essentials

Always use #[xmtp_common::test] instead of #[test] or #[tokio::test] in crates/. It handles native/WASM dispatch and logging init.

rust
#[xmtp_common::test(unwrap_try = true)]
async fn test_something() {
    tester!(alix);
    tester!(bo);

    let group = alix.create_group(None, None)?;
    group.invite(&bo).await?;
    group.send_msg(b"hello").await;  // internally unwraps; returns ()

    bo.sync_welcomes().await?;
    let bo_group = bo.group(&group.group_id)?;
    let msg = bo_group.test_last_message_bytes().await?;
    assert_eq!(msg.unwrap(), b"hello");
}
  • unwrap_try = true transforms ? into .unwrap() — use for tests returning ()
  • tester!(name) creates a registered test client with logging
  • group.invite(&other).await? and group.send_msg(b"msg").await from MlsGroupExt trait

Exception: bindings/mobile tests use #[tokio::test(flavor = "multi_thread")] directly (never targets WASM).

Running Tests

All just test and just wasm test variants pass extra args through to cargo nextest run:

bash
just test                           # All (v3 + d14n)
just test v3                        # V3 only
just test v3 test_send_message      # Specific test in v3
just test crate xmtp_mls            # Single crate
just wasm test                      # All WASM (v3 + d14n)

Tests that create clients need the backend: just backend up / just backend down

See Running Tests for nextest filter syntax, profiles, WASM/d14n targeting, and CI commands.

Writing Philosophy

  • Test behavior, not implementation. Don't assert on internal state that could change.
  • One assertion focus per test. test_send_message shouldn't also verify group creation.
  • Don't test the obvious. Skip trivial getters, derive impls, framework behavior.
  • Don't duplicate coverage. If test_talk_in_dm covers DM messaging, don't add test_dm_send_message.
  • Use tester! and convenience methods. Don't manually build clients.
  • Prefer unwrap_try = true. Eliminates noisy .unwrap() chains.

Further Reference

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

Files

SKILL.md and 6 other files in .claude/skills/writing-rust-tests of xmtp/libxmtp.

  • SKILL.md
  • assertions.md
  • fixtures.md
  • parametrized.md
  • running.md
  • utilities.md
  • wasm.md

Open the folder on GitHubat commit cc87802

Compare with similar skills

Writing Rust 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.

Writing Rust Tests compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Writing Rust Tests this skillxmtp/libxmtp121—~740Automated safety check: PassMIT
Asupersync Mega SkillDicklesworthstone/asupersync281—~2.9kAutomated safety check: PassCustom licence
Crossbindcrossbind/crossbind148—~1.1kAutomated safety check: PassMIT
Fungienbop/fungi132—~2.9kAutomated safety check: PassApache-2.0
Webapp Buildersidequery/sidemantic129—~5.5kAutomated safety check: PassAGPL-3.0
Edge Pythondylan-sutton-chavez/edge-python272—~12kAutomated safety check: PassCustom licence

Similar skills

  • Asupersync Mega Skill

    Dicklesworthstone/asupersync

    Build, migrate, debug, and maintain Asupersync. An agent skill from Dicklesworthstone/asupersync.

    281 GitHub stars~2.9k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Crossbind

    crossbind/crossbind

    A skill your agent uses when a user wants to call C++ or Rust from JavaScript or TypeScript; add a native library such as GDAL, SQLite, OpenSSL, GEOS or PROJ to a browser, Node.js, Cloudflare Worker…

    148 GitHub stars~1.1k tokensUpdated today
    MobileAuto-check passed
  • Fungi

    enbop/fungi

    Install, configure, and operate the Fungi CLI across devices.

    132 GitHub stars~2.9k tokensUpdated 4 days ago
    DevOps & CloudAuto-check passed
  • Webapp Builder

    sidequery/sidemantic

    Build interactive analytics webapps, demos, dashboards, or embedded app surfaces from Sidemantic semantic models using copyable component primitives and deterministic query inspection.

    129 GitHub stars~5.5k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Edge Python

    dylan-sutton-chavez/edge-python

    Write, run, test and package Edge Python programs with the edge CLI.

    272 GitHub stars~12k tokensUpdated today
    SecurityAuto-check passed
  • Style Checker

    noumena-labs/Sipp

    Enforces this monorepo's coding style rules by inspecting git diffs, reading .agents/skills/style-checker/references/styleguidance.md, fixing style violations, and reporting the result.

    121 GitHub stars~1.4k tokensUpdated 18 days ago
    DevelopmentAuto-check passed

More from xmtp/libxmtp

  • Working With Nix

    xmtp/libxmtp

    A skill your agent uses when working with Nix flakes, selecting devShells, debugging environment issues, or understanding Nix infrastructure - covers shell selection, environment detection, common…

    121 GitHub stars~1.4k tokensUpdated today
    Auto-check passed

Works with

Questions about Writing Rust Tests

What does Writing Rust Tests do?

A skill your agent uses when writing, modifying, or reviewing Rust tests in crates/ or bindings/ - covers test macros, fixtures, assertions, WASM compatibility, and how to run tests. Writing Rust Tests is an agent skill from xmtp/libxmtp.

When should I use Writing Rust Tests?

Writing Rust Tests fits situations like: reviewing Rust tests in crates/; bindings/ - covers test macros; WASM compatibility; how to run tests.

How do I install Writing Rust Tests in Claude Code?

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

How do I install Writing Rust Tests in Codex?

Run `npx skills add xmtp/libxmtp --skill writing-rust-tests -a codex`. Or copy the skill folder (.claude/skills/writing-rust-tests in xmtp/libxmtp) into .agents/skills/writing-rust-tests in your project. Codex loads it when a task matches its description.

Can I use Writing Rust 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 xmtp/libxmtp --skill writing-rust-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/writing-rust-tests, .gemini/skills/writing-rust-tests, .github/skills/writing-rust-tests and .opencode/skills/writing-rust-tests in your project.

What does Writing Rust Tests need to run?

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

Does Writing Rust 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 Writing Rust 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 Writing Rust Tests use?

Writing Rust 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 Writing Rust Tests use?

About 740 tokens (SKILL.md is roughly 3k 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 Writing Rust Tests?

Skills that share tags, products or a category with Writing Rust Tests: Asupersync Mega Skill (Dicklesworthstone/asupersync, 281 stars), Crossbind (crossbind/crossbind, 148 stars), Fungi (enbop/fungi, 132 stars) and Webapp Builder (sidequery/sidemantic, 129 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Writing Rust Tests?

xmtp (a GitHub organization) maintains it in xmtp/libxmtp, which has 121 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 8, 2026.

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