Desloppify Harnesses AI Agents to Sculpt Sloppy Code into Beautiful Engineering
This Python tool blends mechanical analysis and LLM judgment for persistent, prioritized codebase refactoring across 28 languages.
In an age where AI coding agents churn out functional but often messy "slop code," desloppify emerges as a game-changing harness, empowering those agents to systematically elevate codebases to professional polish. Created by peteromallet, this 20-day-old Python project provides the scaffolding for AI tools like Claude, Cursor, or Copilot to detect issues, prioritize fixes, and iterate toward a quantifiable measure of beauty—without the fluff or false positives that plague traditional linters.
At its core, desloppify tackles the full spectrum of code quality woes. It starts with mechanical detection for objective flaws: dead code, duplication, cyclomatic complexity, and more, leveraging tree-sitter parsers and linters tailored to 28 languages. Full plugin depth shines in TypeScript, Python, C#, Dart, GDScript, and Go, while generic support covers Rust, Ruby, Java, Kotlin, and others. But it doesn't stop at syntax—subjective LLM review layers in human-like critique on naming conventions, abstraction levels, and module boundaries, ensuring the code feels architecturally sound.
What sets desloppify apart is its agent-friendly workflow, designed as a "north-star" for autonomous improvement. Users paste a simple prompt into their AI agent, install via pip install --upgrade "desloppify[full]", and kick off with desloppify update-skill claude (or your preferred model). A scan with desloppify scan --path . generates a strict score—resistant to gaming through weighted, multi-faceted metrics—that persists across sessions. Scores above 98 correlate with code a seasoned engineer would praise as beautiful, complete with a GitHub scorecard badge for READMEs or profiles.
The magic unfolds in the prioritized fix loop:
desloppify next --path .identifies the highest-impact issue, specifies the file, and suggests targeted changes.- The agent implements the fix.
desloppify resolveverifies and updates progress, chipping away methodically.
Stateful persistence means interruptions don't reset efforts; it picks up where it left off. Exclusion rules handle vendor dirs, build artifacts, or generated code via desloppify exclude, with agent-human consultation for edge cases. Tricks like anti-regression checks and fix validation keep the process honest, preventing superficial tweaks from inflating scores.
Technically, desloppify is intriguing for its hybrid architecture: deterministic tools provide reliability, while LLM integration adds nuance—yet the score's robustness ensures real engineering gains. It's for developers weary of AI's raw output, those maintaining legacy slop, or teams chasing elite quality at scale. As AI agents proliferate, this harness shifts them from code generators to code curators, promising codebases that are not just working, but exemplary.
Gaining explosive traction with over 1,200 stars in weeks underscores its timeliness, but the real story is how desloppify democratizes high-caliber refactoring, making "beautiful code" an achievable target rather than an elusive art.
(Word count: 468)