Strip AI-codegen cruft from a branch — defensive checks the type system should make unrepresentable, redundant validation, speculative abstraction, no-op wrappers — while preserving load-bearing seams. Use after a feature lands and before merge, when asked to "simplify", "de-ornament", "remove cruft", "make erroneous states unrepresentable", or "clean up" a diff.
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
A structured pass to remove accumulated cruft from a branch — particularly the failure mode where code solves, at a narrow local layer, a problem that should be addressed globally or structurally. The canonical example: instead of enforcing design intent in the type system (making erroneous states unrepresentable), the code accumulates defensive runtime checks to detect and flag bad states that a better type would forbid at compile time.
This is a quality pass, not a bug hunt. Every change must be behavior-preserving, with the existing test suite as the safety net. It complements a correctness-focused review (which hunts bugs); route bug findings there, not here. If you trip over a genuine correctness bug mid-pass, note and surface it separately — do not fix it as part of this pass.
A recognizable shape — an unwrap_or, a single-impl trait — is a prompt to ask whether the
construct earns its keep here, not a finding in itself. Reason about intent and invariants, not
form.
Option<bool>, a sentinel (""/-1/0) standing in for an Option/enum, a field validated
on every read rather than made unconstructable-when-invalid, or a "this can't happen" guard.Do not strip things that earn their keep. Call them out as intentional rather than flagging them:
AtomicBool guard through a
shared &self can't be replaced by take-by-value Option if the caller holds &self).AsyncWrite) that has a real second caller in tests.When unsure whether something is cruft or load-bearing: it is load-bearing until proven otherwise. Default to keeping.
Finding no ornamentation is a valid and common result — especially on small or already-tight diffs. Report "clean" rather than inventing a finding to justify the pass.
Run the steps directly, or route the fan-out and edits through whatever review/delegation process the repo otherwise follows. Keep edits one-at-a-time and behavior-preserving, and review each before moving on. Match effort to the diff: for a few files, scan and fix directly; the clustering and per-cluster fan-out below are for large, multi-author branches.
Compute the cumulative branch diff against the merge base and list the changed source files, excluding generated/state files (lockfiles, task-tracker state) unless relevant. This is the review surface.
Partition the changed files into coherent clusters (e.g. parse/types, registry/storage, config/state-modeling, wiring/transport). Take one cluster at a time — or, if the repo supports parallel read-only reviewers, one reviewer per cluster. For each, apply:
cargo check --all-targets before reporting,file:location; the specific cruft; a crisp remedy
(prefer "replace runtime check X with type Y"); behavior-preserving vs. behavior-changing.Separate clear wins from judgment calls, and name anything judged intentional / load-bearing so it is not re-litigated. The review stage reports findings only — it does not edit.
Merge the findings. Drop:
Option<bool> → Option<Resolved> so the bad state is
unrepresentable); the rest are small isolated cleanups.Take one finding (or one tightly-coupled pair) at a time. Pin the exact contract before editing — especially for a structural refactor, write the target type design and the invariant truth-table the change must preserve, plus a test-migration map (migrate tests to the new shape; never weaken assertions to pass). Execute in increasing invasiveness: small, isolated, behavior-preserving cleanups first; the big structural remodel last, on an already-cleaned base. After each change, verify cargo and review it before moving on. If no existing test exercises the changed path, the suite is not a safety net for it — add a characterization test first, or lower the finding's confidence and flag the gap.
Before deleting a "no-op", confirm it is one. A classic trap: a let _ = (&field, …) discard or
an #[allow] that looks ornamental but actually suppresses a real dead_code/lint warning
(e.g. #[derive(Deserialize)] does not count as a read, and #[derive(Debug)] is ignored by
dead-code analysis — so fields only read via derives genuinely warn). If removing the "cruft"
produces a warning or breaks a check, restore it and report rather than deleting into a broken
build. Don't trade ornament for a warning.
Run the full check suite on the whole de-ornamented stack: cargo fmt --check,
cargo clippy --all-targets --all-features, cargo nextest run, ratchets check. Confirm no
assertion was weakened or deleted to make a change pass — tests that only covered genuinely-removed
code may go with it, but everything else must be migrated, not loosened.
enabled: Option<bool> rewritten
None → Some(true) at assembly and read via unwrap_or(false), then carried dead into a
component that only exists when enabled. Fix: split the parse DTO from a resolved type; make the
consumer field Option<ResolvedConfig> with no enabled field, so "disabled" = None by
construction. Deletes the rewrite, the accessor, the unwrap_or, the dead field, and the
explanatory comments that existed only to compensate for the confusing type.Option. A helper returning an owned String with "" meaning "absent",
forcing a downstream !is_empty() && … guard. Fix: return Option<&str>; the guard and an
allocation vanish.struct FooThing; whose only purpose is
to host one associated fn that is never called on an instance and implements no trait. Fix:
make it a module-level free fn, delete the struct/impl. (Distinguish from the real seam —
the trait + concrete type it delegates to — which stays.)summarize() that just returns self.list(), with no
override and one caller. Fix: delete it; the caller uses list(). Reintroduce only if a second,
genuinely-distinct behavior ever materializes.imbue-ai/offload
6998230
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.