rust-code-quality
Perform comprehensive Rust code quality reviews against best practices for async Rust, error handling, testing, and project structure
Works with
---
name: rust-code-quality
description: Perform comprehensive Rust code quality reviews against best practices for async Rust, error handling, testing, and project structure
license: MIT
---
# Rust Code Quality Review
Systematically review Rust code quality against best practices.
## Quality Dimensions
| Dimension | Focus | Tools |
|-----------|-------|-------|
| Structure | Files <500 LOC, module hierarchy | `find . -name "*.rs"` |
| Error Handling | Custom Error, Result<T>, no unwrap | `rg "unwrap\|Result<"` |
| Async Patterns | async fn, spawn_blocking, no blocking | `rg "async fn\|spawn_blocking"` |
| Testing | >90% coverage, integration tests | `cargo tarpaulin` |
| Documentation | Public APIs 100% documented | `cargo doc --no-deps` |
## Analysis Commands
```bash
# Project structure
find . -name "*.rs" -not -path "*/target/*" -exec wc -l {} + | sort -rn
# Error handling
rg "unwrap\(\)" --glob "!*/tests/*" --glob "*.rs"
# Async patterns
rg "async fn|spawn_blocking|tokio::" --glob "*.rs"
# Testing
cargo test --all
cargo tarpaulin --out Html
# Linting
./scripts/code-quality.sh fmt
./scripts/code-quality.sh clippy --workspace
cargo audit
```
## Output Format
```markdown
# Rust Code Quality Report
## Summary
- **Score**: X/100
- **Critical Issues**: N
- **Warnings**: M
## By Dimension
- Structure: X/10 - [Status]
- Error Handling: X/10 - [Status]
- Async Patterns: X/10 - [Status]
- Testing: X/10 - [Status]
- Documentation: X/10 - [Status]
## Critical Issues
1. [Issue] - File:line
- Fix: [Recommendation]
## Action Items
### High Priority
- [ ] Fix critical issues
### Medium Priority
- [ ] Address warnings
```
## Best Practices Checklist
✓ Files <500 LOC
✓ Clear module hierarchy
✓ Custom Error enum
✓ Result<T> for fallible ops
✓ No unwrap() in production
✓ async fn for IO operations
✓ spawn_blocking for CPU work
✓ >90% test coverage
✓ Public APIs documentedMore Testing skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
setup-pre-commit
mattpocock/skills
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

