Advanced Rust code analysis and correction system with comprehensive error prevention, code quality enforcement, and detailed documentation in Chinese. Runs Cargo checks, Clippy, tests, and formatting to ensure robust Rust code.
Advanced Rust code analysis and correction system designed for Cursor IDE. This skill provides comprehensive error prevention, code quality enforcement, and systematic debugging for Rust projects using Cargo toolchain integration.
This skill transforms Cursor into a powerful Rust development environment with:
1. **Terminal Environment**: Assume Windows PowerShell environment
2. **Direct Guidance**: Provide direct solutions without asking questions
3. **Error Resolution Focus**: Prioritize fixing errors over cosmetic changes
4. **No New Errors**: Never introduce new errors while fixing existing ones
5. **Preserve Functionality**: Maintain all existing functionality during refactoring
6. **Implement Over Remove**: Always prefer implementing uses for code over removing it
Execute commands in strict priority order:
1. **Priority 1 - Build Errors**: `cargo check`
- Run before making any changes
- Run after each change
- Must pass before proceeding
2. **Priority 2 - Safety Issues**: `cargo clippy`
- Fix warnings and denials
- Suggest actionable improvements
- Address common mistakes
3. **Priority 3 - Test Failures**: `cargo test`
- Run unit, integration, and doc tests
- Ensure no regressions
- Validate all changes
4. **Priority 4 - Style**: `cargo fmt -- --check`
- Check formatting consistency
- Follow Rustfmt guidelines
- Maintain readability
**Error Prevention Checks**:
**Pre-Implementation Analysis**:
**Implementation Guards**:
**Strategy**: Implement or justify, never just remove
For each unused import, choose one approach:
1. **Type Implementations**:
- Create wrapper types
- Implement common traits (Debug, Clone, Display, etc.)
- Add type conversions (From, Into, TryFrom, TryInto)
2. **Function Implementations**:
- Create utility functions using the import
- Add test coverage demonstrating usage
- Implement usage examples
3. **Module Implementations**:
- Create feature modules utilizing the import
- Implement module tests
- Add integration examples
4. **Justification**: If truly unused, document why removal is appropriate
**Constants Organization**:
**Magic Numbers**:
**Error Handling Patterns**:
**Language**: All documentation must be in Chinese (中文)
**Required Sections** for all public items:
**Implementation Documentation**:
**Change Documentation Format**:
```rust
// 修改内容:
// - 错误: [list of errors fixed]
// - 更改: [list of changes made]
// - 原因: [rationale for changes]
// - 性能影响: [optional performance implications]
// - 安全性影响: [optional safety implications]
```
**Inline Comments**:
When providing code suggestions:
**Reference Prefix**: Use `(at)` to reference modules
**Import Syntax**:
```rust
use crate::...; // Absolute from crate root
pub use::...; // Re-export
use super::...; // Parent module
use self::...; // Current module
```
**Module Definitions**:
```rust
mod {name}; // Private module
pub mod {name}; // Public module
mod {name} { ... } // Inline module
```
**Static Analysis**:
**Semantic Analysis**:
**Optimization Analysis**:
**Unsafe Code**:
**Error Handling**:
After applying any fix:
1. Run `cargo check` - must pass
2. Run `cargo clippy` - address all warnings
3. Run `cargo test` - all tests must pass
4. Verify no new errors introduced
5. Ensure no functionality regressions
For each error, provide:
**Scenario**: Fixing compilation errors in a Rust project
1. Agent runs `cargo check` and identifies 5 build errors
2. Agent analyzes root causes: 3 type mismatches, 1 missing import, 1 unused import
3. For unused import, agent implements a utility function using it
4. Agent fixes type mismatches with proper conversions
5. Agent adds missing import with proper module path
6. Agent documents all changes in Chinese
7. Agent runs validation: `cargo check` → `cargo clippy` → `cargo test` → `cargo fmt`
8. Agent confirms no new errors introduced
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/rust-eze-debugger-j98ml7/raw