agentleFS
kleosrkleosr/kleosrules/skills/slop-guard/SKILL.md

slop-guard

Skill1 starsChanged 45 days agoMITView on GitHub

Write-time patterns that reject low-evidence TypeScript and JavaScript: fake types (unknown contracts, chained or widen-then-assert casts), wasteful array and reducer passes, module mocking, and reflection. Use before writing or editing any code file; the type rules are for .ts, .tsx, .js, .jsx, .mjs, and .cjs. Adds no dependency or lint config; applies to new and changed lines only.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. kleosr/bridle★ 1100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    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 repository13 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    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. Very specific:

    Do one pass, not .filter(...).map(...).

    line 34
  2. Very specific:

    Do not call vi.mock, jest.mock, doMock, or unstable_mockModule.

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Slop guard

Low-evidence code claims a type or a behavior that nothing proves. Write the proof into the code, at the boundary where the data enters. Apply this to the lines you write or change. Do not migrate old code unless the ask says so. In other languages, apply the same idea: parse at the boundary, keep data passes linear, and test through real seams.

Types carry evidence

DoDo not
Parse input once at the boundary (schema, type guard, or explicit checks), then pass the narrow type.Accept unknown (or a union with it) as a function parameter. The cause of an error and the subject of a type predicate are the exceptions.
Return the real type.Declare a return of unknown, Promise<unknown>, or an alias that resolves to unknown.
Give a dictionary a real value type: Record<UserId, User>, Map<string, Order>.Use Record<string, unknown>, any, object, or {} as a value contract. A generic constraint like T extends Record<string, unknown> is allowed.
Keep a known value at its known type.Pass a known value into an unknown, object, or open-dictionary slot, then assert it back.
Cast only when a check in the same flow proves the type. Put that proof in code, not in a comment.Chain assertions (x as unknown as T, <T><unknown>x). as const is allowed.
Narrow with a parser or a type predicate at the boundary.Scatter ad hoc typeof x === "..." checks through business code. typeof x === "undefined" probes are allowed.
Call functions and read properties through their types.Use Reflect.apply or Reflect.get to skip the type system.
Name the domain thing: User, OrderLine.Put Shape in a local symbol name (UserShape). A library member such as schema.shape is allowed.

Data passes stay linear

  • Do one pass, not .filter(...).map(...). Use flatMap, a loop, or lazy .values().filter(...).map(...).toArray() when the runtime supports iterator helpers. Keep callback order, indexes, and thisArg semantics the same.
  • In reduce, mutate a fresh local accumulator. Do not copy it on every step with spread, Object.assign({}, acc, ...), Array.from(acc), concat, or slice.
  • To omit an optional field, build the object with an if. Do not use ...(cond ? { a } : {}): omitting a key and setting it to undefined are different.

Tests use real seams

Do not call vi.mock, jest.mock, doMock, or unstable_mockModule. Pass the dependency in (parameter, constructor, or layer) and give the test a real or in-memory implementation.

Effect

Apply this section only when the owning package manifest declares effect.

  • Match tagged values with Match, Predicate.isTagged, or tagged-enum matching. Do not compare or switch on _tag by hand, including inside Effect.catch handlers.
  • Build tagged values with Schema, a tagged class or error, or Data.taggedEnum. Do not write { _tag: "..." } literals.
  • Runtime callers import the owning Layer and yield the service. Do not import make<Service> constructors from project modules outside tests.
  • Replace chained literal ternaries over one value with Match.

Source

Adapted from the rule set of dmmulroy/anti-slop (MIT) at c44ef22. To enforce these rules with Oxlint in a repo, install that project's install-anti-slop skill. Adding the dependency needs approval.

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.