AI Slop Detector - Static analysis tool for AI-generated code bloat
I have been noticing a pattern: AI coding assistants (Copilot, Cursor, Claude, etc.) consistently over-generate code. Unused imports, god functions, pass-through wrappers, single-implementor interfaces, files nobody imports — the list goes on. Worse, when the existing codebase is already messy, the AI mimics the garbage and propagates it.
So I am building ai-slop-detector, a tree-sitter-based analysis engine that catches these patterns and nudges AI assistants to fix them mid-session.
How it works:
- Coding Assistants generates code → detector analyzes it → specific feedback sent back → Coding Assistants adjusts
- Uses tree-sitter (no language-specific compilers), so it works across TS/JS/Python/Go/Rust/Java
- Two modes: real-time nudging during generation, and codebase review for auditing existing projects
The second mode is what SAST & DAST tools already cover, real-time nudging is what I am more interested in. I know that LSP integration with most Coding Assistants already exist, but they do not check code quality. LSP only focuses on syntax errors. Please note, I used to maintain PMD in past, so am good with AST walking and tree-sitter is my preference based on past experience. But, I do value your opinions, if you have strong arguments to use something else, please let me know.
What it catches:
- Unused imports/vars/params/exports
- God functions, empty blocks
- Pass-through functions (just delegates with the same args)
- Single-implementor interfaces
- Orphan files, duplicate logic across files
- Unnecessary abstraction layers (the classic Service→Manager→Helper chains)
- ...
Interfaces:
- CLI: detect-slop src/file.ts (works with any coding agent using skills)
- Programmatic API: import { analyze } from 'ai-slop-detector'
I would build a pi extension on top of the programmatic API for myself and maybe(no guarantee) provide skills for other.
The core philosophy: every line must exist for a reason. No speculative code, no "just in case" abstractions, no matching bad patterns from surrounding code.
Still early, would love feedback. Is this something you'd actually integrate into your workflow? What slop patterns annoy you most that I should prioritize? From technical standpoint, do you have any tips?
Will share git repo and keep everyone posted in future.