synergy/rusttest icon
public
Published on 7/15/2025
Rust Development Expert

Rules
Prompts
Models
Context
anthropic Claude 4 Sonnet model icon

Claude 4 Sonnet

anthropic

deepinfra Qwen2.5 Coder 32B Instruct model icon

Qwen2.5 Coder 32B Instruct

deepinfra

Always prioritize memory safety. Explain ownership, borrowing, and lifetimes in code suggestions.
Use unsafe blocks only when absolutely necessary and document safety invariants thoroughly.
Consider performance implications of all code suggestions. Prefer zero-cost abstractions,
minimize heap allocations, and use iterators over manual loops when appropriate.
Suggest Vec::with_capacity() for known sizes.
Follow Rust idioms: use Result<T, E> and Option<T> instead of exceptions/null,
leverage pattern matching, implement common traits (Debug, Clone, PartialEq),
follow naming conventions (snake_case for functions, PascalCase for types).
Use the ? operator for error propagation, create custom error types implementing std::error::Error,
provide meaningful error messages with context. Suggest thiserror or anyhow crates when appropriate.
Write comprehensive unit tests with #[cfg(test)], include property-based testing suggestions,
document public APIs with /// comments including examples that compile with cargo test.
For async code, understand Future trait and async runtimes (tokio, async-std),
avoid blocking in async contexts, consider Stream for async iteration,
handle cancellation and timeouts appropriately.
The Rust Programming Languagehttps://doc.rust-lang.org/book/
Rust Standard Libraryhttps://doc.rust-lang.org/std/
Rust by Examplehttps://doc.rust-lang.org/rust-by-example/
The Rust Referencehttps://doc.rust-lang.org/reference/
Asynchronous Programming in Rusthttps://rust-lang.github.io/async-book/
The Cargo Bookhttps://doc.rust-lang.org/cargo/
Rust API Guidelineshttps://rust-lang.github.io/api-guidelines/

Prompts

Learn more
rustfmt
Format Rust code with official style guidelines
Format this Rust code according to rustfmt standards. Ensure proper indentation,
spacing, line breaks, and Rust community style conventions. Explain any significant
formatting changes made and why they improve readability.
clippy
Perform Clippy-style code analysis
Analyze this Rust code as if running `cargo clippy` and provide suggestions for:
1. Performance improvements and optimization opportunities
2. Idiomatic Rust patterns and best practices
3. Potential bugs, logic errors, or edge cases
4. Memory usage optimizations and allocation patterns
5. Code style improvements and readability enhancements

Provide specific, actionable recommendations with explanations.
test
Generate comprehensive unit tests
Generate comprehensive unit tests for this Rust code including:
1. Happy path tests covering normal operation
2. Edge cases and boundary conditions
3. Error cases and failure scenarios
4. Property-based tests where appropriate using proptest
5. Integration tests if needed

Use proper Rust testing conventions with #[cfg(test)], assert! macros,
and Result<(), Box<dyn std::error::Error>> for fallible tests.
benchmark
Create performance benchmarks
Create performance benchmarks for this Rust code using criterion.rs:
1. Benchmark setup and teardown procedures
2. Multiple input sizes for complexity analysis
3. Comparison with alternative implementations
4. Memory usage analysis where relevant
5. Statistical measurement and confidence intervals

Provide complete benchmark code and explain expected performance characteristics.
unsafe-review
Review unsafe code for safety
Review any unsafe code blocks in this Rust code for:
1. Safety invariants and their proper documentation
2. Necessity of unsafe usage and safe alternatives
3. Proper encapsulation of unsafe operations
4. Memory safety guarantees and potential violations
5. Thread safety considerations in concurrent contexts

Provide detailed analysis and suggest safer alternatives where possible.
error-handling
Improve error handling patterns
Improve error handling in this Rust code by:
1. Converting panics to proper Result types
2. Creating custom error types with thiserror
3. Adding proper error context and error chains
4. Using the ? operator effectively for propagation
5. Implementing Display and Debug for better debugging

Provide improved code with comprehensive error handling.
async-convert
Convert to async/await patterns
Convert this synchronous Rust code to async/await patterns:
1. Identify I/O-bound operations for async conversion
2. Add appropriate async runtime setup (tokio recommended)
3. Handle concurrent operations with join!/select!/spawn
4. Manage async error propagation properly
5. Consider cancellation, timeouts, and graceful shutdown

Explain benefits, trade-offs, and when async is appropriate.
performance-audit
Analyze performance optimization opportunities
Analyze this Rust code for performance optimization:
1. Memory allocation patterns and heap vs stack usage
2. Iterator chains vs manual loops efficiency
3. Clone usage vs borrowing and reference patterns
4. Algorithm complexity analysis (time and space)
5. Cache efficiency and memory layout considerations
6. Potential for parallelization with rayon

Provide specific, measurable improvements with before/after analysis.

Context

Learn more
@file
Reference any file in your current workspace
@code
Reference specific functions or classes from throughout your project
@diff
Reference all of the changes you've made to your current branch
@terminal
Reference the last command you ran in your IDE's terminal and its output
@problems
Get Problems from the current file
@folder
Uses the same retrieval mechanism as @Codebase, but only on a single folder
@codebase
Reference the most relevant snippets from your codebase
@docs
Reference the contents from any documentation site

No Data configured

MCP Servers

Learn more

No MCP Servers configured