All posts

3 Rules for AI Coding: Preventing AI Slop

AI Slop: Stop it from taking the hard way around easy problems, reporting false completions, and explaining things in more complicated ways than needed. These are the 3 rules you must use when coding with AI.

Contents

    Lots of people do most of their coding with Claude Code or Codex these days, right? Finding, fixing, testing, committing, deploying. It's convenient, but isn't the biggest problem AI slop? Code that works but nobody knows how, and unnecessary code piling up endlessly. Or simple things being made hard to get done.

    And then there's the case where it says it's done, but it isn't really done. In the end, you have to check again, read through it, and fix it yourself. So how do we reduce this kind of thing?

    3 Rules You Must Follow for AI Coding

    Let's keep it simple. Say you ask an agent, "Did you put out the release?" The agent would answer like this:

    "Yes, let me walk you through the release process. First, I created a tag and pushed it to the remote repository. Then the Release workflow in GitHub Actions ran. It's split into a Windows job and an Android job, and the Android job restores the signing key, builds the APK, and verifies the signature. Checking it, the workflow finished successfully, and the files appear to have been uploaded to the release page. If you have any more questions, just let me know!"

    Nothing it says is wrong. But it tends to over-explain even simple things. Before long, I stop reading the content carefully.

    Attention-span

    Attention-span is a rule for exactly this. It makes the answer start with the conclusion, write only as much as needed without over-explaining, and yet not cut warnings. If you then say "explain in more detail," it explains in full detail like before.

    This is the answer to the same question after adding the rule.

    I just checked again, and v1.6.0 is the latest release, and it's a stable public release.

    It ends in the first line. What I liked most was the part about "don't cut warnings" rather than just "be brief." If you only tell it to be short, the agent leaves out what actually matters, but with this rule, that problem goes away.

    Installation

    alexgreensh/attention-span: Make your agents talk human. ADHD-friendly output s…

    "I can't trust 'it's done'"

    This was the biggest one.

    When an agent says "Fixed it, the tests should pass," I often just believe it and move on. But later I found that quite a few times it hadn't run the tests, had run only some of them, or passed off earlier results as if they were current. It was even worse when I split work among sub-agents. Whatever a sub-agent called a "success" got passed along as-is.

    verification-before-completion prevents this.If there's no fresh evidence just gathered, don't say it's complete.

    Before saying "done," it makes the agent rerun the proof, and only say it after checking the output, exit code, and failure count. "Probably" or "should be" doesn't count as evidence. It also doesn't trust sub-agents' reports and reruns things directly. The same goes before commits, pushes, and releases. Anything it couldn't verify, it has to clearly say it couldn't verify.

    After adding the rule, the reports changed like this:

    117 tests passed (just run, 0 failures), real transmission test passed with the built executable, all 3 jobs in the GitHub build succeeded. However, I haven't yet clicked the Explorer menu in the installed version.

    It's an md file included in the superpower skill, so just grab it and use it, that's all.

    superpowers/skills/verification-before-completion/SKILL.md at main · obra/super…

    Code that's oddly messy and ugly to look at

    Slop refers to output that looks thrown together carelessly. Looking at code AI wrote, it works, but certain patterns keep showing up that feel off. anti-slop is a bundle of rules that blocks those patterns in TypeScript and JavaScript.

    test.ts
    const names = users.filter((u) => u.active).map((u) => u.name);
    
    // 이렇게 쓰게 합니다
    const names: string[] = [];
    
    for (const u of users) {
      if (u.active) names.push(u.name);
    }

    dmmulroy/anti-slop: Opinionated Oxlint rules for rejecting low-evidence TypeScr…

    Installation

    For Claude Code, I added verification-before-completion and anti-slop to ~/.claude/CLAUDE.md, and turned on attention-span as an output style. For Codex, I put all three into the single ~/.codex/AGENTS.md file. Putting the same things in both tools means they work about the same no matter which one I use.

    Review

    This doesn't make the AI smarter or produce more impressive work. What it does is reduce the parts I have to review. That said, it's not 100% accurate either, so please do review the code.

    Comments 2

    1. Loading comments.