agentleFS
Baba01hacker666Baba01hacker666/dummyskills/skills/rust/rust-testing/SKILL.md

rust-testing

Skill0 starsChanged 2 months agoMITView on GitHub

Guides agents through authoring, running, and debugging Rust tests with cargo test, test filters, and #[should_panic].

29 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use rust-async-patterns and rust-best-practices.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • klauswgSkill

    rust-async-patterns

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns. Use when building async Rust applications, implementing concurrent systems, or debugging async code.

    Also in 4 projects that use this

  • MicrosoftSkill

    rust-best-practices

    Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.

    Also in 7 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 28 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 14
  2. Very specific:

    Do not use for linting; use rust-clippy-check.

    line 20
  3. Very specific:

    If test_name is missing: run all tests in package via cargo test.

    line 26
  4. Very specific:

    Never comment out assert_eq!

    line 27
  5. Distinctive:

    Follow these numbered actions:

    line 30
  6. Very specific:

    Read panic trace (left: X, right: Y).

    line 34
  7. Very specific:

    If testing expected panics: annotate with #[should_panic(expected = "message")].

    line 43
  8. Distinctive:

    Stop and ask the user when:

    line 70

“Common” is measured: kept by at least 6 in 10 of the 28 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Testing (cargo test)

Guides agents through executing, isolating, and debugging Rust unit tests, integration tests (tests/), and documentation tests using cargo test.

1. Purpose

Execute and debug Rust tests. A "Unit Test" resides in src/ annotated with #[test]. An "Integration Test" resides in tests/.

2. When to Use

Use this skill when:

  • Running Rust test suites (cargo test).
  • Filtering by test function name (cargo test <name>).
  • Viewing stdout in passing or failing tests (cargo test -- --nocapture).

3. When Not to Use

  • Do not use for linting; use rust-clippy-check.

4. Required Inputs

  • test_name: Name or substring of the test to run.

5. Missing-Input Behavior

  1. If test_name is missing: run all tests in package via cargo test.
  2. Never comment out assert_eq! to hide test failures.

6. Procedure

Follow these numbered actions:

  1. Action 1: Run Targeted Test
    • Execute: cargo test <test_name> -- --nocapture
  2. Action 2: Inspect Panic or Assertion Message
    • Read panic trace (left: X, right: Y).
  3. Action 3: Trace and Modify Source Code
    • Edit source logic to satisfy test contract.
  4. Action 4: Re-Run Targeted Test
    • Confirm test <name> ... ok.
  5. Action 5: Run Full Test Suite
    • Execute cargo test.

7. Decision Rules

  • If testing expected panics: annotate with #[should_panic(expected = "message")].
  • For integration tests: run cargo test --test <integration_test_file>.

8. Output Format

Emit the report using this template:

### Rust Test Report: [Test Name]

- **Command**: `cargo test [test_name]`
- **Status**: [ok | FAILED]
- **Passed**: [Count] | **Failed**: [Count]

#### Resolution Notes
- [Root cause and fix description]

9. Verification Checklist

  • cargo test exits with code 0.
  • No assertions commented out.
  • Compiler warnings addressed.

10. Common Failures and Recovery

Failure SymptomCauseRecovery Action
thread panicked at assertion failed: left == rightLogic mismatchInspect evaluated values; correct algorithm.

11. Stop or Escalation Conditions

Stop and ask the user when:

  • Tests require external C libraries (linking errors).

12. Examples

Example 1: Successful Execution

Input:

Test: test_parse_header

Output:

### Rust Test Report: test_parse_header

- **Command**: `cargo test test_parse_header -- --nocapture`
- **Status**: ok
- **Passed**: 1 | **Failed**: 0

#### Resolution Notes
- Fixed off-by-one slice index in header parser.

Example 2: Ambiguous or Missing Input

Input:

Test rust.

Output:

### Rust Test Report: Running Full Suite

- **Command**: `cargo test`
- **Status**: ok
- **Passed**: 12 | **Failed**: 0

Example 3: Expected Final Output

Output:

### Rust Test Report: test_token_expiration

- **Command**: `cargo test test_token_expiration`
- **Status**: ok
- **Passed**: 1 | **Failed**: 0

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.