code-simplifier
Skill16 starsChanged 7 months agoApache-2.0View on GitHub
Use when writing, reviewing, or editing Rust code in this project - applies iterator chains, Option/Result chaining, early returns, borrow-over-clone, and if-let simplifications per project conventions
59 other projects use a version of this.
Adopted by
Most recently taken up by
- euxx/claude-skills-for-copilottheir own version, first seen Nov 8, 2026
- aktsmm/Agent-Skillstheir own version, first seen Nov 8, 2026
- ValorVie/custom-skillstheir own version, first seen Nov 8, 2026
- ZhouYinLong-lab/Dog-Skillstheir own version, first seen Nov 8, 2026
- simonwong/skillstheir own version, first seen Nov 6, 2026
- islandhopper81/claude-skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use tdd-rust, type-design-analyzer and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
FlorianBruniauxSkilltdd-rust
Also in 3 projects that use this
PaulKinlanSkilltype-design-analyzer
Analyzes type design quality focusing on encapsulation, invariant expression, usefulness, and enforcement. Provides quantitative ratings (1-10) for each dimension.
Also in 3 projects that use this
PaulKinlanSkillcomment-analyzer
Analyzes code comments for accuracy, completeness, and long-term maintainability. Identifies misleading comments, comment rot, and documentation gaps.
Also in 4 projects that use this
ufodev-ioSkillsecurity-guardian
Comprehensive security layer for all interactions with Claude: audits code, dependencies, commands, configs, and AI-generated output for vulnerabilities. Protects against prompt injection, data leaks, unsafe advice, and social engineering. Works in Cursor, Claude Code, claude.ai, and API contexts. Use always as a background security protocol in any Claude-powered environment.
Also in 3 projects that use this
SentrySkillfind-bugs
Find bugs, security vulnerabilities, and code quality issues in local branch changes. Use when asked to review changes, find bugs, security review, or audit code on the current branch.
Also in 3 projects that use this
tossSkillpr-triage
Classify and summarize a PR for efficient review
Also in 3 projects that use this
- +1 more from PaulKinlan
Other versions59 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 59
- rtk-ai/rtk★ 86ksame name
- tisfeng/Easydict★ 15ksame name
- elie222/inbox-zero★ 13ksame name
- getsentry/skills★ 1.1ksame name
- Azure/azqr★ 799same name
- DoubleML/doubleml-for-py★ 798same name
- deadlock-mod-manager/deadlock-mod-manager★ 584same name
- microsoft/ghqr★ 528same name
- feiskyer/codex-settings★ 248same name
- wesm/middleman★ 198same name
49 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- tool-creatorSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 54 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Use iterator chains for transformation logic.
- Very specific: line 146
Use match only when both arms carry logic.
“Common” is measured: kept by at least 6 in 10 of the 54 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust Code Simplifier
Proactive pattern guide for writing simple, idiomatic Rust. Apply these patterns whenever writing or modifying Rust code — not only when asked to simplify.
Project rules: These patterns align with .claude/rules/rust-patterns.md. When in doubt, re-read the rules file.
1. Iterator Chains Over Manual Loops
Use iterator chains for transformation logic. Reserve for loops only when the body needs early error returns with ?.
// WRONG
let mut names = Vec::new();
for tool in tools {
if tool.is_available() {
names.push(tool.name().to_owned());
}
}
// RIGHT
let names: Vec<String> = tools
.iter()
.filter(|t| t.is_available())
.map(|t| t.name().to_owned())
.collect();When to keep a loop: The body calls fallible operations with ?:
// Loop is correct here — early return on error
for entry in entries {
let meta = entry.metadata().context("failed to read metadata")?;
process(&meta).await?;
}2. Option/Result Chaining
Flatten nested match/if let on Option/Result into chained combinators or ?.
// WRONG — nested match pyramid
match config.project.as_ref() {
Some(project) => match project.settings.as_ref() {
Some(settings) => match settings.get("key") {
Some(val) => Some(val.to_owned()),
None => None,
},
None => None,
},
None => None,
}
// RIGHT — ? operator for Option propagation
config
.project
.as_ref()?
.settings
.as_ref()?
.get("key")
.map(|v| v.to_owned())Combinator quick reference:
| Pattern | Use when |
? | Propagate None/Err to caller |
.map() | Transform inner value |
.and_then() | Chain operations that return Option/Result |
.unwrap_or_default() | Fallback to Default impl |
.unwrap_or_else(|| ...) | Fallback with computation |
3. Early Returns
Guard against invalid/empty states at the top. Avoid deep nesting for the main logic.
// WRONG — main logic buried in nested conditions
fn process(entries: &[Entry], prefix: &str) -> Vec<String> {
let mut results = Vec::new();
if !entries.is_empty() {
if !prefix.is_empty() {
for entry in entries {
if entry.name.starts_with(prefix) {
results.push(entry.name.strip_prefix(prefix).unwrap().to_owned());
}
}
}
}
results
}
// RIGHT — guard clauses, then flat logic
fn process(entries: &[Entry], prefix: &str) -> Vec<String> {
if entries.is_empty() || prefix.is_empty() {
return Vec::new();
}
entries
.iter()
.filter(|e| e.name.starts_with(prefix))
.filter_map(|e| e.name.strip_prefix(prefix))
.map(|s| s.to_owned())
.collect()
}Signals to look for: is_empty(), is_none(), is_err(), boolean flags checked before the real work begins.
4. Avoid Redundant Clones
Borrow instead of cloning. When ownership is needed, use .to_owned() (not .clone()). Use String::from("...") for string literals (not "...".to_string()).
// WRONG — clones where borrows suffice
fn format_tool(tool: &Tool) -> String {
let data = tool.data.clone();
let name = tool.name.clone();
format!("{}: {}", name, data)
}
// RIGHT — format! borrows automatically
fn format_tool(tool: &Tool) -> String {
format!("{}: {}", tool.name, tool.data)
}// WRONG
let label = "default".to_string();
let copy = config.clone();
// RIGHT
let label = String::from("default");
let copy = config.to_owned();5. if let for Single-Variant Match
Use match only when both arms carry logic. Use if let when only one variant matters.
// WRONG — match with throwaway arm
match result {
Some(val) => process(val),
None => (),
}
// RIGHT
if let Some(val) = result {
process(val);
}
// RIGHT — match when both arms carry logic
match result {
Ok(ctx) => tool.format(ctx).await,
Err(e) => log_and_report(e),
}Common Mistakes
| Mistake | Fix |
.clone() to satisfy borrow checker | Restructure to borrow, or use .to_owned() if ownership needed |
"literal".to_string() | String::from("literal") |
Nested if/match guarding empty/none | Early return guard clause at top |
for loop that only filters + maps | Iterator chain with .filter().map().collect() |
match x { Some(v) => f(v), None => () } | if let Some(v) = x { f(v); } |
Nested match on Option chains | ? operator or .and_then() |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

