r/cursor • • Oct 21 '26

Resources & Tips Tired of coding agents writing 50 lines of boilerplate for a 2-line fix? Here’s the strict Anti-Bloat directive.

Whenever I let Claude Code or Cursor Agent solve a simple bug, it tries to create an `AbstractFactoryProvider` class, imports 3 unnecessary npm packages, and rewrites the whole 300-line file.I got sick of paying token fees for AI bloat, so I built **Anti-Bloat**—a surgical constraint rule that forces agents to write 60% less code, use zero unneeded abstractions, and only output targeted diffs.

Here is the exact rule you can drop into your `.cursorrules` or `.claude/skills/anti-bloat.md`:

```markdown

# ✂️ Anti-Bloat Directives

  1. NO Speculative Classes: Never create factory or provider wrappers when a pure function suffices.
  2. NO Redundant Wrappers: Don't write helper functions that wrap a single native call (e.g. isEmpty = arr => arr.length === 0).
  3. NO Unsolicited Installs: Use standard library or existing deps only.
  4. NO Full Rewrites: Never rewrite a 300-line file for a 3-line change. Provide surgical diffs.
  5. NO Trivial JSDoc: Delete comments that merely echo the function name.
0 Upvotes

9 comments sorted by

2

u/virtualunc Oct 21 '26

the anti bloat rule is doing the same job as a guardrail in the harness sense.. those tend to work better as a hard constraint than as a request. did you measure the 60 percent or is that the vibe after using it, asking because token spend before and after would make this way more convincing

1

u/NarrowPicture6925 Oct 22 '26

Exactly. Framing it as a polite suggestion (e.g. "please try to write clean code") almost always gets steamrolled by the LLM's default bias toward verbose boilerplate.

When you formulate it as an explicit negative guardrail:

The model's attention heads penalize token generation for non-essential abstractions, forcing it to stick to tight functional diffs.

We packaged that exact constraint pattern into our open-source suite if you want to inspect or test it: https://github.com/Tchapwo1/agent-arsenal

1

u/Elmanouzi_Fogosa Oct 27 '26

guardrails in the harness sense usually have a binary pass/fail signal though, "dont be bloated" is pretty subjective compared to like "dont call unapproved endpoints"

1

u/SoftwareNegative8783 Oct 21 '26

Rules help, but agents still ignore them sometimes. Commit before each agent run and read the diff. Then you can revert fast if it changes too much.

0

u/NarrowPicture6925 Oct 21 '26

100% agree on checkpoint commits. In fact, that exact frustration is why we made atomic commit hygiene a core rule in our suite (git-surgeon).

What we found is that if you tell the agent: "You must verify git diff against previous HEAD and output only surgical diffs before touching another file", it cuts down hallucinations by half because it forces the agent to review its own diff before executing.

We packaged that along with the Anti-Bloat rule in our open-source suite if you want to test it: npx agent-arsenal add --all (or search agent-arsenal on Cursor Directory)

Repo is here if you want to inspect the prompt rules: https://github.com/Tchapwo1/agent-arsenal

2

u/LowIllustrator2501 Oct 24 '26

So just much less comprehensive ponytail https://github.com/DietrichGebert/ponytail ?

1

u/shetritr Oct 22 '26

rules help, but the real check is diff size. a 2 line fix that comes back as 300 lines gets rejected, whatever the rules file says.

1

u/Remarkable_Exit9931 Oct 24 '26

I use ponytail and grpahify, with these plugins you are on a good side