--- name: deslop description: "Use right after writing new feature code or finishing a refactor in Smith: find LLM-generated Rust slop in the touched code and rewrite it to expert, type-driven, tested Rust without asking." --- # Deslop Turn plausible-looking generated Rust into expert-grade Rust. Runs unattended: no questions, no approval gates, no stopping between passes. ## Scope - Code touched by the current change (`jj diff --stat`, or the area the user names). - Existing behavior stays; fix a bug only when proven and say so. - Public API stays untouched. - Second scope surfaces → list under Remaining, do not chase. ## Slop patterns - Unverified APIs, hallucinated fns, wrong crate features. - Overbroad abstractions: one-impl traits, generic soup, pass-through layers, dead code. - Near-duplicate logic with renamed variables. - Stringly typed domains where enums, newtypes, or validated structs belong. - Excess `clone`, `Arc`, `Mutex`, boxing, dynamic dispatch, global state. - Async faults: lock held across `.await`, blocking work in async paths, wrong bounds. - `unwrap` | `expect` | `panic` | swallowed errors | vague errors where domain errors belong. - Missing docs, missing tests, untested error paths, unverified security assumptions. - Insecure input, path, shell, env handling. ## Rewrite bar - Invalid states unrepresentable. - Narrow APIs, explicit ownership. - `Result` + `?`; document errors, panics, safety invariants. - Concrete types until abstraction earns its keep. - Delete unused code and needless layers. - Behavior-boundary tests for success and failure paths. ## Work 1. Read touched code, call sites, tests, public surface. 2. Run scoped gates; keep pre-existing failures visible. 3. Rank findings by severity; fix P0 and P1 surgically, P2 when cheap, log P3. 4. Missing proof → add focused test before rewriting. 5. Run scoped gates again. ## Report ```markdown ## Status complete | blocked | failed ## Findings - `path:line` · pattern · evidence · P0 | P1 | P2 | P3 ## Changes - `path` · change · why ## Tests - gates run, before and after ## Risks - behavior, API, security, migration ## Remaining - out-of-scope findings ```