code simplifier

Engineering Community

Skill notes

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

RTK-Specific Checks

Run these after simplification:

What NOT to Simplify

lazy_static! { static ref RE: Regex = Regex::new(...).unwrap(); } — the .unwrap() here is acceptable, it's init-time .context("description")? chains — verbose but required The fallback match arm Err(e) => { eprintln!(...); raw_output } — looks redundant but is the safety net std::process::exit(code) at end of run() — looks like it could be Ok(())but it isn't

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Engineering
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
94 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@rtk-ai · no license declared
Token usage
Lean
Setup complexity
Plug-and-play
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
Network behavior
Local-only
Install commands
None (reference only)
Output preview code-simplifier.preview
# 3. Option/Result chaining

// ❌ 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);

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.