agentleFS
d-oitd-oit/rust-2026-template/.agents/skills/anti-ai-slop/SKILL.md

anti-ai-slop

Skill15 starsChanged 5 months agoMITView on GitHub

Apply this skill when auditing, writing, or reviewing Rust code to avoid generic "AI slop" patterns: boilerplate structs with no purpose, copy-paste error handling, meaningless variable names, over-engineered abstractions, or hollow documentation. Triggers: "this looks AI-generated", "too much boilerplate", "meaningless names", "over-abstracted", "audit my code", "humanize this", "why is this so verbose", "remove unnecessary abstractions", "fix docs", "anti-pattern review".

13 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 5

    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
  1. Distinctive:

    Always name the problem before fixing it.

    line 28
  2. Distinctive:

    Concrete before abstract: Start with one function. Extract trait only when you have 2+ impls.

    line 49
  3. Very specific:

    Use thiserror for library errors, anyhow for application errors.

    line 66
  4. Distinctive:

    Every error message must answer: what was I doing, what input failed, what to do next.

    line 67
  5. Distinctive:

    Docs are contracts: If it can fail or panic, document it.

    line 120
  6. Distinctive:

    Zero-cost means earned: Don't add generics for flexibility you won't use.

    line 122
  7. Very specific:

    Run ./scripts/quality-gates.sh --only clippy while iterating and the full gate before committing.

    line 137

“Common” is measured: kept by at least 6 in 10 of the 11 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Anti-AI-Slop Skill — Rust Edition

How to Use

  1. Audit mode — Share code. Run through checklists below. Name every pattern.
  2. Creation mode — Read "What to do instead" first, then write code avoiding patterns.
  3. Spot-fix mode — Point to one element. Diagnose it, rewrite it, explain the fix.

Always name the problem before fixing it.


Part 1 — Code Structure Anti-Patterns

PatternWhat it looks likeWhy it's slop
Wrapper struct for no reasonstruct MyError(String) with no extra behaviorJust use anyhow::Error or the inner type directly
Over-engineered trait hierarchytrait Processor<T: Handler<U>> for one implOne trait, one impl = delete the trait
mod utilsmod utils { pub fn helper(...) }No concept. Scatter into real modules
mod commonGrab-bag module used by everythingSymptom of no domain model
Phantom genericsstruct Foo<T> { _marker: PhantomData<T> } with no boundsIf T does nothing, remove the generic
Re-export sprawlpub use inner::* chains 3 levels deepForces users to trace invisible paths
Builder for 2 fieldsFooBuilder::new().name(x).value(y).build()Just use Foo { name: x, value: y }

What to Do Instead

  • Model the domain. Name types after what they represent, not their role in the code.
  • Flat module tree. One level deep is almost always enough.
  • Direct construction. Struct literals over builders unless >5 optional fields or invariants.
  • Concrete before abstract. Start with one function. Extract trait only when you have 2+ impls.

Part 2 — Error Handling Anti-Patterns

PatternWhat it looks likeWhy it's slop
.unwrap() in library codevalue.parse().unwrap()Panics in calling code without context
`.expect("should not happen")everywhereIf it can happen, handle it. If not, prove it.
Box<dyn Error> in all signaturesfn run() -> Result<(), Box<dyn Error>>Erases error type, forces dynamic dispatch
`map_err(|_| "failed")Error message that says nothingInclude the input, the operation, what failed
match err { _ => return Err(...) }Manual error forwardingUse ? operator
Custom error type per functionParseConfigError, LoadConfigError, ReadConfigErrorOne ConfigError with variants

What to Do Instead

  • Use thiserror for library errors, anyhow for application errors.
  • Every error message must answer: what was I doing, what input failed, what to do next.
  • One error enum per module, not per function.

Part 3 — Documentation Anti-Patterns

PatternWhat it looks likeWhy it's slop
Restates the name/// Creates a new Foo. for fn new_foo()Zero information gain
# Examples with trivial codeExample that just calls new()Show a real use case or delete the section
Passive voice everywhere"This function is used to...""Creates", "Returns", "Validates" — be direct
TODO: implementLeft in committed codeEither implement it or open an issue
// Safety: this is safeIn unsafe blocksExplain why the invariants hold, not that they do

What to Do Instead

  • First line: one sentence, imperative, what it does for the caller.
  • # Errors section: enumerate what Err variants are returned and when.
  • # Panics section: document every panic condition explicitly.
  • # Safety section in unsafe: state the invariants required, not just "safe".

Part 4 — Naming Anti-Patterns

PatternWhat it looks likeFix
data, info, result as field namesstruct Foo { data: Vec<u8> }Name the content: payload, bytes, records
Manager, Handler, Processor typesstruct DataProcessorWhat does it process? InvoiceParser, LogNormalizer
Single-letter generics beyond Tfn foo<A, B, C, D>Name the role: Key, Value, Input, Output
is_true, has_data booleansif obj.is_true()Name the predicate: is_authenticated, has_pending_items
temp, tmp, val, x in non-trivial scope20-line function with let tmp = ...Name what it holds

Part 5 — Audit Workflow

  1. Scan — Check all four pattern lists. Flag every match by name.
  2. Score severity:
    • 🔴 Structural — Wrong abstraction level. Requires refactor.
    • 🟡 Surface — Wrong name, wrong error message, missing doc section.
    • 🟢 Cosmetic — Minor polish.
  3. Prioritize — Fix structural first. Don't rename fields on a wrong abstraction.
  4. Rewrite — Provide the specific replacement, not generic advice.
  5. Explain the why — Name the Rust principle behind each fix.

Positive Doctrine

  • Domain names > technical roles. Types are nouns from the problem space.
  • Errors are first-class. Design error types with as much care as success types.
  • Docs are contracts. If it can fail or panic, document it. No exceptions.
  • Flat is better than deep. One layer of abstraction does more than three thin ones.
  • Zero-cost means earned. Don't add generics for flexibility you won't use.

Repository Enforcement

This workspace already fails the build for several patterns above, so "fix" means changing the code, not silencing the lint:

  • clippy::unwrap_used and clippy::expect_used are denied in library code; binaries and tests may opt out with a reasoned attribute.
  • clippy::allow_attributes and allow_attributes_without_reason are denied, so adding #[allow(...)] is itself a failure unless a reason is supplied.
  • #![forbid(unsafe_code)] applies at the crate roots; // Safety: comments are only relevant to the explicitly reviewed unsafe sites that remain.
  • missing_docs and rustdoc link checks run in the quality gate.

Run ./scripts/quality-gates.sh --only clippy while iterating and the full gate before committing.

Rationalizations

RationalizationReality
"This pattern is common in production Rust."Common doesn't mean correct. Evaluate each abstraction on its own merits.
"The AI generated reasonable-looking code."Reasonable-looking code can hide real issues. Audit systematically, not superficially.
"It's just a wrapper struct — harmless."Every abstraction has a cost. If it adds no behavior, it adds confusion.

Red Flags

  • Finding mod utils or mod common in the codebase
  • More than one error type per module
  • #[doc = "Creates a new Foo."] on fn new_foo() (zero information gain)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.