{"slug": "the-22-patterns-of-ai-code-slop-and-how-to-delete-them", "title": "The 22 patterns of AI code slop, and how to delete them", "summary": "A developer built an agent skill called stop-ai-slop that catalogs 22 patterns of AI-generated code slop and deletes them, demonstrated by collapsing an 8-insertion/54-deletion diff that removed a single-implementation interface, a one-product factory, restating comments, and an error-swallowing except clause. The skill ships with three labeled fixtures and a harness scoring recall, precision, and false positives on clean code, where gpt-6-luna scored 1.00 recall and 0.91 precision and claude-haiku-4-5-20251001 scored 1.00 recall and 0.83 precision, both with zero findings on the clean file. It installs via 'npx skills add kirankunapuli/stop-ai-slop' to 79 agents and offers a report-only GitHub Action for pull requests.", "body_md": "Your agent writes code that looks right. Interfaces with one implementation. Comments that restate the next line. `try/except` that swallows errors. Names like `data` and `process`. A dependency that does not exist. Tests that were edited to pass.\n\nReviewers approve it because it resembles the patterns good engineers write. That is the failure mode. AI output does not usually look broken. It looks thorough.\n\nI built an agent skill that catalogs these patterns and deletes them. This post is the catalog, a real before/after, and the eval I added so the claim can be checked.\n\nBefore anything else, ask: does this need to exist?\n\nIf a feature, abstraction, flag, or line is not required, delete it. Cleaning up code that should not exist is wasted work.\n\nThen the portability test. If a function, comment, or sentence could move unchanged into an unrelated project, it carries no information about this one. `processData`, `// Initialize the service`, and `Handles the request.` pass between any two repositories. That is the tell.\n\nAn agent asked to add invoice saving produced this:\n\n```\n    class InvoiceProcessorInterface(ABC):\n        \"\"\"Interface for invoice processors.\"\"\"\n\n        @abstractmethod\n        def process(self, data) -> dict:\n            \"\"\"Process the invoice.\"\"\"\n            ...\n\n    class InvoiceProcessor(InvoiceProcessorInterface):\n        def __init__(self, db):\n            # Store the database connection\n            self.db = db\n\n        def process(self, data) -> dict:\n            # Initialize the result\n            result = {}\n            # Loop through each item\n            for item in data:\n                # Try to parse the amount\n                try:\n                    amount = Decimal(item[\"amount\"])\n                except Exception:\n                    amount = 0\n                result[item[\"id\"]] = self._handle(amount)\n            return result\n\n    class InvoiceProcessorFactory:\n        \"\"\"Factory for invoice processors.\"\"\"\n\n        @staticmethod\n        def create(db) -> InvoiceProcessorInterface:\n            return InvoiceProcessor(db)\n```\n\nThe skill returned this:\n\n``` php\n    def save_invoice_amounts(db, invoice_lines) -> dict:\n        return {\n            line[\"id\"]: db.save({\"amount\": Decimal(line[\"amount\"])})\n            for line in invoice_lines\n        }\n```\n\nDiff: 8 insertions, 54 deletions.\n\nIt inlined the one-implementation interface and the single-product factory, renamed `data`, `result`, and `_handle`, deleted six restating comments, and removed the `except Exception` that turned an unparseable amount into zero.\n\nCode:\n\n`Retry-After`, missing timeouts, no rate-limit handling.\nGenerated prose:\n\nAn agent that writes a redundant comment and then edits a failing assertion to make the suite green is not a style problem. It is a correctness problem, and the suite is now lying.\n\nSo the skill also reviews the agent's own behavior:\n\nMost skills ship on claims. I added three labeled fixtures, two sloppy and one clean, and a harness that scores recall, precision, and false positives on the clean file.\n\n| Model | Recall | Precision | Findings on clean | \n|---|---|---|---|\n| gpt-6-luna (default) | 1.00 | 0.91 | 0 | \n| claude-haiku-4-5-20251001 | 1.00 | 0.83 | 0 | \n\nThe harness exits non-zero when recall drops or when the skill reports a finding on clean code. That second check matters most. A skill that invents problems is worse than one that misses a few.\n\nThe limits are in the repo: three fixtures, keyword scoring, one run per model. Keyword scoring is a floor, not a grade.\n\n```\n    npx skills add kirankunapuli/stop-ai-slop\n```\n\nIt installs to 79 agents, including Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, Windsurf, Zed, and Pi.\n\nThere is also a GitHub Action that reviews a pull request in report-only mode:\n\n```\n    - uses: kirankunapuli/stop-ai-slop@v1\n      with:\n        api-key: ${{ secrets.OPENAI_API_KEY }}\n```\n\nIt runs on OpenAI, Anthropic, Google, Groq, OpenRouter, local Ollama, or any OpenAI-compatible endpoint.\n\nValidation and authorization at trust boundaries, error handling that prevents data loss, security, accessibility, concurrency correctness, domain rules that are load-bearing, and the writer's voice. It never adds an abstraction, dependency, or config knob in the same pass that removes one.\n\nWhere has your agent produced slop that a reviewer waved through?", "url": "https://wpnews.pro/news/the-22-patterns-of-ai-code-slop-and-how-to-delete-them", "canonical_source": "https://dev.to/kirankunapuli/the-22-patterns-of-ai-code-slop-and-how-to-delete-13de", "published_at": "2026-09-24 20:09:18+00:00", "updated_at": "2026-09-24 20:29:09.285852+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "mlops"], "entities": ["stop-ai-slop", "kirankunapuli", "Claude Code", "Codex", "Cursor", "Gemini CLI", "GitHub Copilot", "OpenAI"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/the-22-patterns-of-ai-code-slop-and-how-to-delete-them", "markdown": "https://wpnews.pro/news/the-22-patterns-of-ai-code-slop-and-how-to-delete-them.md", "text": "https://wpnews.pro/news/the-22-patterns-of-ai-code-slop-and-how-to-delete-them.txt", "jsonld": "https://wpnews.pro/news/the-22-patterns-of-ai-code-slop-and-how-to-delete-them.jsonld"}}