AI code slop patterns
The mistakes Copilot, Cursor, Claude Code, Codex and friends leave in pull requests, why they matter, and how to fix them. Each one is a rule in SlopScore for Code.
- The "... existing code ..." placeholder: AI coding tools sometimes write '// ... existing code ...' or '// rest of the implementation' instead of real code. Here's why it slips through review and how to block it in CI.
- Hallucinated imports (and slopsquatting): LLMs regularly import packages that don't exist or aren't installed. Attackers register those names ('slopsquatting'). How to catch undeclared imports in every pull request.
- Swallowed exceptions: AI-written code often wraps calls in try/catch and then ignores the error. Why empty catch blocks and 'except: pass' are a review red flag, with fixes.
- Unused helpers: Coding agents write helper functions 'just in case' and never call them. How to spot unused new functions in a PR before they become permanent dead code.
- Duplicated blocks: AI tools regenerate similar code instead of reusing it. How to catch duplicated blocks in a PR diff and when to extract a function.
- Over-commented boilerplate: AI-generated code narrates every line: '// Initialize the variable', '// Return the result'. Why it hurts readability and which comments to keep.
- TODO stubs and unimplemented functions: Agents leave 'TODO: implement', 'throw new Error("Not implemented")' and 'raise NotImplementedError' in code that ships. How to block untracked stubs in CI.
- Hallucinated APIs: LLMs call methods that don't exist, like Math.clamp, fs.promises.exists, dict.has_key or os.path.exist. A list of common ones and how to catch them before runtime.
- Debug output left in: Agents debug with console.log and print() and forget to remove them, often with emoji. How to catch debug leftovers in a PR without blocking scripts and tests.
- Type escape hatches: When types don't line up, AI tools reach for 'as any', 'as unknown as T' and @ts-ignore. Why that defeats TypeScript and what to do instead.
- Giant generated changes: Agents can add 1,000 lines to one file in a minute. Nobody can review that. How to flag giant files in PRs and get them split.
- Generic and inconsistent names: AI code mixes camelCase and snake_case and uses names like data2, temp1 and helper1. Why names matter for review and how to flag them.