Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Review Rust code for memory safety, concurrency patterns, performance optimization, and ecosystem tooling (cargo, clippy, rustfmt).
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 146% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 92% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 128% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 1392% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 406% | 0% |
Trigger conditions:
Not for:
cargo check or rust-analyzer LSP)cargo diagnostics)Time normalization:
NOW_ET using NIST/time.gov semantics (America/New_York, ISO-8601)NOW_ET for all citation access datesInput validation:
code_path must exist and contain valid Rust code (.rs files)analysis_focus must be one of: "safety", "concurrency", "performance", "all"rust_edition must be "2018" or "2021" (affects borrow checker and async behavior)check_unsafe must be boolean (controls unsafe block analysis depth)Source freshness:
Prerequisites:
Fast path for ownership/borrowing issues:
100 - (borrow_errors×15 + move_errors×10 + lifetime_warnings×5)Decision: If analysis_focus == "safety" AND score >90 → STOP at T1; otherwise proceed to T2.
References:
Extended validation for async/await and synchronization:
std::fs, std::thread::sleep in async fnsReference: Tokio Tutorial (accessed 2025-10-26T03:52:00-04:00)
Reference: Rust Atomics and Locks (accessed 2025-10-26T03:52:00-04:00)
Reference: Tokio: Async in Depth (accessed 2025-10-26T03:52:00-04:00)
deadlock_risk×20 + race_condition×15 + resource_leak×10Deep dive into zero-copy, allocations, and SIMD:
Reference: Rust Performance Book - Heap Allocations (accessed 2025-10-26T03:52:00-04:00)
Reference: Rust Performance Book - Type Sizes (accessed 2025-10-26T03:52:00-04:00)
Reference: Portable SIMD Project (accessed 2025-10-26T03:52:00-04:00)
Reference: Criterion.rs (accessed 2025-10-26T03:52:00-04:00)
check_unsafe == true)Reference: The Rustonomicon - Unsafe Rust (accessed 2025-10-26T03:52:00-04:00)
Analysis Focus Routing:
safety → T1 only, skip concurrency/performanceconcurrency → T1 + T2 (ownership matters for Send/Sync)performance → T1 + T3 (safety issues affect optimization validity)all → T1 + T2 + T3 (comprehensive analysis)Abort Conditions:
code_path not readable → error "File/directory not accessible"Severity Thresholds:
Ambiguity Handling:
Schema (JSON):
json{ "code_path": "string", "rust_edition": "2018 | 2021", "analysis_focus": "safety | concurrency | performance | all", "overall_score": "integer (0-100)", "safety_report": { "ownership_issues": [ { "file": "string", "line": "integer", "severity": "critical | high | medium | low", "category": "move-after-use | borrow-conflict | lifetime", "message": "string", "fix": "string (optional)" } ], "unsafe_blocks": [ { "file": "string", "line": "integer", "soundness_concern": "boolean", "rationale": "string", "safe_alternative": "string (optional)" } ] }, "concurrency_analysis": { "deadlock_risks": ["array of objects with file/line/description"], "race_conditions": ["array of objects"], "async_issues": ["array of objects with tokio-specific patterns"], "sync_primitive_recommendations": ["array of strings"] }, "performance_recommendations": { "allocations": ["array of hotspots with impact estimates"], "zero_copy_opportunities": ["array with refactoring suggestions"], "simd_candidates": ["array with vectorization potential"], "profiling_setup": "string (command to run)" }, "ecosystem_suggestions": { "recommended_crates": ["array of crate names with use cases"], "clippy_config": "string (TOML snippet)", "rustfmt_config": "string (TOML snippet)" }, "metrics": { "total_lines": "integer", "unsafe_line_count": "integer", "async_fn_count": "integer", "critical_issues": "integer", "high_issues": "integer", "medium_issues": "integer", "low_issues": "integer" }, "timestamp": "ISO-8601 string (NOW_ET)" }
Required Fields:
code_path, rust_edition, analysis_focus, overall_score, metrics, timestampsafety_report, concurrency_analysis, performance_recommendations (based on focus)Fix Suggestions:
Example: Async Rust Service with Concurrency Issues
rust// INPUT: async service with tokio runtime inefficiencies use tokio::sync::Mutex; use std::sync::Arc; async fn process_requests(db: Arc<Mutex<Database>>) { loop { let req = receive_request().await; // Issue 1: Holding lock across .await (blocking other tasks) let mut db = db.lock().await; db.update(req).await; // .await while holding Mutex // Issue 2: Blocking I/O in async context std::fs::read_to_string("config.txt").unwrap(); // Issue 3: Spawning without bound (memory leak potential) tokio::spawn(async move { slow_operation().await; }); } } // T2 ANALYSIS OUTPUT: // Critical: Mutex held across .await (line 9-10) // Fix: Minimize critical section, release before async call // High: Blocking std::fs in async fn (line 13) // Fix: Use tokio::fs::read_to_string // High: Unbounded task spawning (line 16) // Fix: Use semaphore or bounded channel
Token Budgets:
Safety:
cargo check --message-format=jsonAuditability:
Performance:
Accuracy:
cargo checkOfficial Rust Documentation (accessed 2025-10-26T03:52:00-04:00):
Async/Concurrency (accessed 2025-10-26T03:52:00-04:00):
Performance (accessed 2025-10-26T03:52:00-04:00):
Tooling Integration:
resources/clippy-config.toml - Recommended clippy lints for each focus arearesources/rustfmt.toml - Standard formatting configurationresources/cargo-deny.toml - Dependency security/license checkingCrate Recommendations by Use Case:
Other measured skills in the registry, with their headline benchmark lift.