rust-testing-code-review
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Use when reviewing _test.rs files,
Best use case
rust-testing-code-review is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Use when reviewing _test.rs files,
Teams using rust-testing-code-review should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/rust-testing-code-review/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How rust-testing-code-review Compares
| Feature / Agent | rust-testing-code-review | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Use when reviewing _test.rs files,
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# Rust Testing Code Review ## Review Workflow 1. **Check test organization** — Unit tests in `#[cfg(test)]` modules, integration tests in `tests/` directory 2. **Check async test setup** — `#[tokio::test]` for async tests, proper runtime configuration 3. **Check assertions** — Meaningful messages, correct assertion type 4. **Check test isolation** — No shared mutable state between tests, proper setup/teardown 5. **Check coverage patterns** — Error paths tested, edge cases covered ## Output Format Report findings as: ```text [FILE:LINE] ISSUE_TITLE Severity: Critical | Major | Minor | Informational Description of the issue and why it matters. ``` ## Quick Reference | Issue Type | Reference | |------------|-----------| | Unit test structure, assertions, test organization | [references/unit-tests.md](references/unit-tests.md) | | Integration tests, async testing, fixtures, test databases | [references/integration-tests.md](references/integration-tests.md) | ## Review Checklist ### Test Structure - [ ] Unit tests in `#[cfg(test)] mod tests` within source files - [ ] Integration tests in `tests/` directory (one file per module or feature) - [ ] `use super::*` in test modules to access parent module items - [ ] Test function names describe the scenario: `test_<function>_<scenario>_<expected>` - [ ] Tests are independent — no reliance on execution order ### Async Tests - [ ] `#[tokio::test]` used for async test functions - [ ] `#[tokio::test(flavor = "multi_thread")]` when testing multi-threaded behavior - [ ] No `block_on` inside async tests (use `.await` directly) - [ ] Test timeouts set for tests that could hang ### Assertions - [ ] `assert_eq!` / `assert_ne!` used for value comparisons (better error messages than `assert!`) - [ ] Custom messages on assertions that aren't self-documenting - [ ] `matches!` macro used for enum variant checking - [ ] Error types checked with `matches!` or pattern matching, not string comparison - [ ] One assertion per test where practical (easier to diagnose failures) ### Mocking and Test Doubles - [ ] Traits used as seams for dependency injection (not concrete types) - [ ] Mock implementations kept minimal — only what the test needs - [ ] No mocking of types you don't own (wrap external dependencies behind your own trait) - [ ] Test fixtures as helper functions, not global state ### Error Path Testing - [ ] `Result::Err` variants tested, not just happy paths - [ ] Specific error variants checked (not just "is error") - [ ] `#[should_panic]` used sparingly — prefer `Result`-returning tests ### Test Naming - [ ] Test names read like sentences describing behavior (not `test_happy_path`) - [ ] Related tests grouped in nested `mod` blocks for organization - [ ] Test names follow pattern: `<function>_should_<behavior>_when_<condition>` ### Snapshot Testing - [ ] `cargo insta` used for complex structural output (JSON, YAML, HTML, CLI output) - [ ] Snapshots are small and focused (not huge objects) - [ ] Redactions used for unstable fields (timestamps, UUIDs) - [ ] Snapshots committed to git in `snapshots/` directory - [ ] Simple values use `assert_eq!`, not snapshots ### Doc Tests - [ ] Public API functions have `/// # Examples` with runnable code - [ ] Doc tests serve as both documentation and correctness checks - [ ] Hidden setup lines prefixed with `#` to keep examples clean - [ ] `cargo test --doc` passes (nextest doesn't run doc tests) ## Severity Calibration ### Critical - Tests that pass but don't actually verify behavior (assertions on wrong values) - Shared mutable state between tests causing flaky results - Missing error path tests for security-critical code ### Major - `#[should_panic]` without `expected` message (catches any panic, including wrong ones) - `unwrap()` in test setup that hides the real failure location - Tests that depend on execution order ### Minor - Missing assertion messages on complex comparisons - `assert!(x == y)` instead of `assert_eq!(x, y)` (worse error messages) - Test names that don't describe the scenario - Redundant setup code that could be extracted to a helper ### Informational - Suggestions to add property-based tests via `proptest` or `quickcheck` - Suggestions to add snapshot testing for complex output - Coverage improvement opportunities ## Valid Patterns (Do NOT Flag) - **`unwrap()` / `expect()` in tests** — Panicking on unexpected errors is the correct test behavior - **`use super::*` in test modules** — Standard pattern for accessing parent items - **`#[allow(dead_code)]` on test helpers** — Helper functions may not be used in every test - **`clone()` in tests** — Clarity over performance - **Large test functions** — Integration tests can be long; extracting helpers isn't always clearer - **`assert!` for boolean checks** — Fine when the expression is clearly boolean (`.is_some()`, `.is_empty()`) - **Multiple assertions testing one logical behavior** — Sometimes one behavior needs multiple checks - **`unwrap()` on `Result`-returning test functions** — Propagating with `?` is also fine but not required ## Before Submitting Findings Load and follow `beagle-rust:review-verification-protocol` before reporting any issue.
Related Skills
Post-Mortem & Incident Review Framework
Run structured post-mortems that actually prevent repeat failures. Blameless analysis, root cause identification, and action tracking.
Pitch Deck Reviewer
Reviews pitch decks and provides investor-ready feedback with scoring
Performance Review Engine
> Your AI-powered performance management system. Write reviews that develop people, not just evaluate them. From self-assessments to 360° feedback to calibration — complete frameworks for every review cycle.
Deal Desk — Structured Deal Review & Approval
Run every non-standard deal through a repeatable review process. Catch margin leaks, enforce discount guardrails, and close faster with pre-approved terms.
Contract Review Assistant
Analyze business contracts for risks, unfavorable terms, and missing clauses. Get a plain-English summary of what you're signing.
afrexai-code-reviewer
Enterprise-grade code review agent. Reviews PRs, diffs, or code files for security vulnerabilities, performance issues, error handling gaps, architecture smells, and test coverage. Works with any language, any repo, no dependencies required.
performance-review-cn
绩效面谈报告、OKR对齐度检测、校准辅助
clawdtm-review
Review and rate OpenClaw skills on ClawdTM. See what humans and AI agents recommend.
cyber-owasp-review
Map application security findings to OWASP Top 10 categories and generate remediation checklists. Use for normalized AppSec review outputs and category-level prioritization.
Contract Reviewer - AI Legal Document Risk Scanner
Upload any contract or legal document and get a structured risk analysis with flagged clauses, plain-language explanations, and negotiation suggestions.
serde-code-review
Reviews serde serialization code for derive patterns, enum representations, custom implementations, and common serialization bugs. Use when reviewing Rust code that uses serde, serde_json, toml, or any serde-based serialization format. Covers attribute macros, field renaming, and format-specific pitfalls.
rust-code-review
Reviews Rust code for ownership, borrowing, lifetime, error handling, trait design, unsafe usage, and common mistakes. Use when reviewing .rs files, checking borrow checker issues, error handling patterns, or trait implementations. Covers Rust 2021 edition patterns and modern idioms.