# rust-unit-tests

rust-unit-tests is a Claude Code skill that writes and improves Rust unit tests within the codebase. It assists when handling data transformations or fixing reproducible bugs.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 720 repo stars
- Author: dominikmartn
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dominikmartn/harp/tree/HEAD/.agents/skills/rust-unit-tests/SKILL.md
- Updated: 2026-11-10
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/rust-unit-tests

## What it does

This skill guides the creation of crate-level unit tests for deterministic logic and pure data processing. It enforces the use of specific test files like `_tests.rs` or `mod_test.rs` while ensuring tests exercise public APIs rather than internal state.

The skill discourages change-detector tests and promotes state-based assertions to keep the test suite maintainable. It suggests separating logic from I/O layers to facilitate unit testing without heavy mocking.

The tool assumes a standard Rust project environment. It is not designed for GUI rendering, PTY timing, or integration scenarios where internal shell wiring is the primary concern.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dominikmartn/harp --skill rust-unit-tests -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/rust-unit-tests/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/rust-unit-tests/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dominikmartn/harp --skill rust-unit-tests -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/rust-unit-tests/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dominikmartn/harp --skill rust-unit-tests -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/rust-unit-tests/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dominikmartn/harp .agents/skills/rust-unit-tests
```

2. **Manually: put the files in place**
- File: `.github/skills/rust-unit-tests/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dominikmartn/harp --skill rust-unit-tests -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dominikmartn/harp --path .agents/skills/rust-unit-tests
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/rust-unit-tests/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dominikmartn/harp/tree/HEAD/.agents/skills/rust-unit-tests/SKILL.md

## When to use it
- generate unit tests for data transformation logic
- verify edge cases for parser functions
- create a failing test for a bug
- refactor code into testable pure functions

## Example prompts
- Create a unit test for the function in `parser.rs`
- Add edge case coverage to `domain_logic_tests.rs`
- Update tests to verify system state via public API

## Similar
- [rust-write-tests](https://affpapa.org/en/nevibecode/skills/rust-write-tests.md) — skill · 257 installs
- [writing-unit-tests](https://affpapa.org/en/nevibecode/skills/writing-unit-tests.md) — skill · 25700 installs
- [create-tests-extract](https://affpapa.org/en/nevibecode/skills/create-tests-extract.md) — skill · 113 installs
- [run-rust-tests](https://affpapa.org/en/nevibecode/skills/run-rust-tests.md) — skill · ★ 6244 repo stars
- [321-frameworks-spring-boot-testing-unit-tests](https://affpapa.org/en/nevibecode/skills/321-frameworks-spring-boot-testing-unit-tests.md) — skill · 413 installs
- [rust-tests](https://affpapa.org/en/nevibecode/rules/rust-tests.md) — rule · ★ 1627 repo stars

From the same set: [dominikmartn/harp](https://affpapa.org/en/nevibecode/by/dominikmartn/harp.md) — 62 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
