| name | deslop |
| description | Regression-safe cleanup of AI-generated bloat in C# code. Deletion-first, requires green tests |
| argument-hint | [path or feature to clean up] |
C# Code Cleanup (Deslop)
Regression-safe removal of AI-generated bloat in: $ARGUMENTS
Precondition: Tests Must Pass
./build.ps1 -RunTests -MinCoverage 80
If tests fail, STOP and fix first.
Step 1: Identify Bloat Patterns
| Pattern | Priority |
|---|
| Unused private methods | HIGH |
| Commented-out code blocks (5+ lines) | HIGH |
| Redundant null checks on constructor-injected services | HIGH |
| Empty catch blocks | HIGH |
Dead if (false) or unreachable branches | HIGH |
| Over-wrapping adapters (adapter wrapping another adapter) | MEDIUM |
| Verbose LINQ where a simple loop suffices | MEDIUM |
Unnecessary ?. on non-nullable types | MEDIUM |
Redundant ToString() on strings | MEDIUM |
| Comments restating the code | LOW |
var x = y; return x; instead of return y; | LOW |
Step 2: Delete (One Pattern at a Time)
- Delete the bloat
./build.ps1 -RunTests -MinCoverage 80
- Pass: keep. Fail: revert and skip.
Step 3: Report
DESLOP REPORT: [target]
========================
Removed: N instances
Skipped (load-bearing): N
Lines removed: N
Tests: PASS | Build: PASS
Important
- NEVER delete code that changes behavior without test coverage
- Deletion-first: remove before refactoring
- Do NOT add new abstractions