rust-write-tests

Installation
SKILL.md
Contains Shell Commands

This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.

Rust Test Writing Skill

Write tests that catch real bugs. Every test must guard a specific invariant -- not just prove the code "works."

The "What Could Break?" Framework

Before writing any test, answer these four questions:

  1. What invariant does this code maintain? (e.g., "deserialized config always has a default profile")
  2. What edge case would violate it? (e.g., "empty TOML table, missing key, extra unknown key")
  3. What platform difference could surface? (e.g., "path separators, case sensitivity, symlink behavior")
  4. What would a future refactor accidentally break? (e.g., "field added to struct but not to Display impl")

If you can only answer #1, your test is a happy-path test. Answer all four and you have a regression suite.

The 5 Test Transformations

Each transformation shows a superficial test pattern and its expert replacement.

Related skills

More from pproenca/dot-skills

Installs
102
GitHub Stars
141
First Seen
Mar 19, 2026