Code slop

From AsyrafHussin/agent-skills · View interactive version

Code slop is an AI agent skill from the GitHub repository AsyrafHussin/agent-skills. Detect AI-generated code patterns ("slop") in PHP/Laravel and TypeScript/React source — comment narration, generic naming, premature interfaces, defensive overdose, mock-everything tests, and the absence of human "scars". Use when reviewing AI-assisted PRs, auditing code for taste/quality (not metri

How to use this skill

Skill file

Code Slop Detection

Taste-level review of code for AI-generated patterns. Contains 24 rules across 6 categories covering comments, naming, over-engineering, defensive overdose, test slop, and style fingerprints. Where CODE0 measures quantitative code debt (complexity, duplication, CVEs), this skill measures the qualitative failure mode: code that passes every metric but reads like a tutorial blog post, not like a human wrote it.

Metadata

Why this skill exists

Industry data on AI-assisted code (GitClear 2025, cURL bug-bounty shutdown 2025, arXiv 2510.03029):

None of this fails a typical CI lint. It just makes the codebase slowly unmaintainable. This skill is the lens for catching it before it ships.

The core insight: reading cost > writing cost now. The cost of writing code collapsed; the cost of reading it didn't. Code you can't quickly understand is slop, even if it works.

How to Audit

When the user asks "review for AI slop", "audit code-quality taste", or "find AI patterns" — run through this skill's rules as a checklist against the changed files (PR diff) or full repo.

Audit Step 1: Determine Scope

Audit Step 2: Detect Stack

| Signal | Stack |

|--------|-------|

| composer.json + artisan | PHP / Laravel |

| package.json (with TypeScript/React deps) | Node / TypeScript / React |

| Both present | Laravel + Inertia + React |

Audit Step 3: Run the Slop Checklist

For each item below, output:

Comments
Naming
Over-engineering
Defensive overdose
Test slop
Style fingerprints

Audit Step 4: Build the Slop Ledger

End the audit with a verdict table:

## Code Slop Ledger

| File | Verdict | Top findings | Suggested action |
|------|---------|--------------|------------------|
| app/Services/UserExportService.php | INFLATED | 12 narration comments; 3 closing-brace labels; `*Helper` overuse | Strip comments; rename Helper → split into functions |
| resources/js/Pages/Orders/Show.tsx | CRITICAL | 4 `as any`; mock-everything tests; useless wrapper; impossible null checks | Rewrite section; remove tests; revisit type model |
| app/Models/Order.php | CLEAN | — | — |

## Summary
- CLEAN: X files
- SUSPICIOUS: Y files
- INFLATED: Z files (top priority: …)
- CRITICAL: N files (rewrite before merge)

When to Apply

Reference this skill when:

Step 1: Detect Project Stack

Most rules are stack-agnostic in concept, but examples and detection commands differ between PHP and TypeScript.

| Signal | Stack | Tooling |

|--------|-------|---------|

| composer.json | PHP / Laravel | phpstan, phpcs, phpmd, manual grep |

| package.json | Node / TS / React | eslint, tsc --noEmit, knip, manual grep |

Rule Categories by Priority

| Priority | Category | Impact | Prefix |

|----------|----------|--------|--------|

| 1 | Comments | CRITICAL | comments- |

| 2 | Naming | CRITICAL | naming- |

| 3 | Over-engineering | HIGH | over-eng- |

| 4 | Defensive overdose | HIGH | defensive- |

| 5 | Test slop | HIGH | test- |

| 6 | Style fingerprints | MEDIUM | style- |

Quick Reference

1. Comments (CRITICAL)

2. Naming (CRITICAL)

3. Over-engineering (HIGH)

4. Defensive overdose (HIGH)

5. Test slop (HIGH)

6. Style fingerprints (MEDIUM)

Essential Patterns

The "would this pass code review?" filter

For each code chunk, ask:

  1. Could I cut a third of these comments and the code would be clearer? → likely comment slop
  2. Do the variable names tell me what they hold, or just what type they are? → likely naming slop
  3. Could this class be a function? → likely over-engineering
  4. Does this catch block actually handle anything, or just log? → likely defensive overdose
  5. Does this test fail if I break the function? → if no, test slop
  6. Are there any // HACK: / // XXX: markers in the diff? → if no, suspicious for AI

Verdict bands (matched to AI-SLOP-Detector's scoring)

| Verdict | Meaning | Action |

|---|---|---|

| CLEAN | < 5% of lines flagged | Ship |

| SUSPICIOUS | 5–15% flagged | Review changes one more time |

| INFLATED | 15–30% flagged | Strip slop, split commits |

| CRITICAL | > 30% flagged | Rewrite section before merge |

How to Use

Read individual rule files for detailed conventions and examples:

rules/comments-narration.md
rules/naming-generic-placeholders.md
rules/over-eng-premature-interface.md
rules/defensive-generic-catch.md
rules/test-mock-everything.md
rules/style-hyper-consistent.md

Each rule file contains:

References

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.