code-simplifier
FeaturedReview RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior.
AI & Automation 69,967 stars
4351 forks Updated yesterday Apache-2.0
Install
Quality Score: 99/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# RTK Code Simplifier
Review and simplify Rust code in RTK while respecting the project's constraints.
## Constraints (never simplify away)
- `lazy_static!` regex — cannot be moved inside functions even if "simpler"
- `.context()` on every `?` — verbose but mandatory
- Fallback to raw command — never remove even if it looks like dead code
- Exit code propagation — never simplify to `Ok(())`
- `#[cfg(test)] mod tests` — never remove test modules
## Simplification Patterns
### 1. Iterator chains over manual loops
```rust
// ❌ Verbose
let mut result = Vec::new();
for line in input.lines() {
let trimmed = line.trim();
if !trimmed.is_empty() && trimmed.starts_with("error") {
result.push(trimmed.to_string());
}
}
// ✅ Idiomatic
let result: Vec<String> = input.lines()
.map(|l| l.trim())
.filter(|l| !l.is_empty() && l.starts_with("error"))
.map(str::to_string)
.collect();
```
### 2. String building
```rust
// ❌ Verbose push loop
let mut out = String::new();
for (i, line) in lines.iter().enumerate() {
out.push_str(line);
if i < lines.len() - 1 {
out.push('\n');
}
}
// ✅ join
let out = lines.join("\n");
```
### 3. Option/Result chaining
```rust
// ❌ Nested match
let result = match maybe_value {
Some(v) => match transform(v) {
Ok(r) => r,
Err(_) => default,
},
None => default,
};
// ✅ Chained
let result = maybe_value
.and_then(|v| transform(v).ok())
.unwrap_or(default);
```
### 4. S...
Details
- Author
- rtk-ai
- Repository
- rtk-ai/rtk
- Created
- 5 months ago
- Last Updated
- yesterday
- Language
- Rust
- License
- Apache-2.0
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Listed
code-simplification
Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be.
0 Updated 1 weeks ago
JBSommeling AI & Automation Listed
code-simplifier
Detect and simplify overly complex code. Apply KISS principle - less is more.
23 Updated yesterday
nguyenthienthanh AI & Automation Listed
code-simplification
Simplify working code while preserving behavior—remove dead paths, flatten nesting, clarify names, reduce duplication. Use after features work but code feels over-engineered.
20 Updated 4 days ago
charlieviettq