Agentsys deslop
Use when user wants to clean AI slop from code. Use for cleanup, remove debug statements, find ghost code, repo hygiene.
install
source · Clone the upstream repo
git clone https://github.com/agent-sh/agentsys
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/agent-sh/agentsys "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.kiro/skills/deslop" ~/.claude/skills/avifenesh-agentsys-deslop && rm -rf "$T"
manifest:
.kiro/skills/deslop/SKILL.mdsource content
deslop
Clean AI slop from code with certainty-based findings and auto-fixes.
Parse Arguments
const args = '$ARGUMENTS'.split(' ').filter(Boolean); const mode = args.find(a => ['report', 'apply'].includes(a)) || 'report'; const scope = args.find(a => a.startsWith('--scope='))?.split('=')[1] || 'all'; const thoroughness = args.find(a => a.startsWith('--thoroughness='))?.split('=')[1] || 'normal';
Input
Arguments:
[report|apply] [--scope=<path>|all|diff] [--thoroughness=quick|normal|deep]
- Mode:
(default) orreportapply - Scope: What to scan
(default): Entire codebaseall
: Only files changed in current branchdiff
: Specific directory or file<path>
- Thoroughness: Analysis depth (default:
)normal
: Regex patterns onlyquick
: + multi-pass analyzersnormal
: + CLI tools (jscpd, madge) if availabledeep
Detection Pipeline
Phase 1: Run Detection Script
The detection script is at
../../scripts/detect.js relative to this skill.
Run detection (use relative path from skill directory):
# Scripts are at plugin root: ../../scripts/ from skills/deslop/ node ../../scripts/detect.js . --thoroughness normal --compact --max 50
For diff scope (only changed files):
BASE=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' || echo "main") # Use newline-separated list to safely handle filenames with special chars git diff --name-only origin/${BASE}..HEAD | \ xargs -d '\n' node ../../scripts/detect.js --thoroughness normal --compact
Note: The relative path
../../scripts/detect.js navigates from skills/deslop/ up to the plugin root where scripts/ lives.
Phase 2: Repo-Map Enhancement (Optional)
If repo-map exists, enhance detection with AST-based analysis:
// Use relative path from skill directory to plugin lib // Path: skills/deslop/ -> ../../lib/repo-map const repoMap = require('../../lib/repo-map'); if (repoMap.exists(basePath)) { const map = repoMap.load(basePath); const usageIndex = repoMap.buildUsageIndex(map); // Find orphaned infrastructure with HIGH certainty const orphaned = repoMap.findOrphanedInfrastructure(map, usageIndex); for (const item of orphaned) { findings.push({ file: item.file, line: item.line, pattern: 'orphaned-infrastructure', message: `${item.name} (${item.type}) is never used`, certainty: 'HIGH', severity: 'high', autoFix: false }); } // Find unused exports const unusedExports = repoMap.findUnusedExports(map, usageIndex); for (const item of unusedExports) { findings.push({ file: item.file, line: item.line, pattern: 'unused-export', message: `Export '${item.name}' is never imported`, certainty: item.certainty, severity: 'medium', autoFix: false }); } }
Phase 3: Aggregate and Prioritize
Sort findings by:
- Certainty: HIGH before MEDIUM before LOW
- Severity: high before medium before low
- Fix complexity: auto-fixable before manual
Phase 4: Return Structured Results
Skill returns structured JSON - does NOT apply fixes (orchestrator handles that).
Output Format
JSON structure between markers:
=== DESLOP_RESULT === { "mode": "report|apply", "scope": "all|diff|path", "filesScanned": N, "findings": [ { "file": "src/api.js", "line": 42, "pattern": "debug-statement", "message": "console.log found", "certainty": "HIGH", "severity": "medium", "autoFix": true, "fixType": "remove-line" } ], "fixes": [ { "file": "src/api.js", "line": 42, "fixType": "remove-line", "pattern": "debug-statement" } ], "summary": { "high": N, "medium": N, "low": N, "autoFixable": N } } === END_RESULT ===
Certainty Levels
| Level | Meaning | Action |
|---|---|---|
| HIGH | Definitely slop, safe to auto-fix | Auto-fix via simple-fixer |
| MEDIUM | Likely slop, needs verification | Review first |
| LOW | Possible slop, context-dependent | Flag only |
Pattern Categories
HIGH Certainty (Auto-Fixable)
: console.log, console.debug, print, println!debug-statement
: Unused debug/logging importsdebug-import
: "Lorem ipsum", "TODO: implement"placeholder-text
: Empty catch blocks without commentempty-catch
: Trailing whitespacetrailing-whitespace
: Mixed tabs/spacesmixed-indentation
MEDIUM Certainty (Review Required)
: Comment/code ratio > 2:1excessive-comments
: JSDoc > 3x function bodydoc-code-ratio
: Returns placeholder value onlystub-function
: Unreachable after return/throwdead-code
: DB clients created but never usedinfrastructure-without-impl
LOW Certainty (Flag Only)
: File/export ratio > 20xover-engineering
: Claims without evidencebuzzword-inflation
: Files frequently change togethershotgun-surgery
Fix Types
| Fix Type | Action | Patterns |
|---|---|---|
| Delete line | debug-statement, debug-import |
| Add explanation | empty-catch |
| Delete code block | stub-function with TODO |
Error Handling
- Git not available: Skip git-dependent checks
- Invalid scope: Return error in JSON
- Parse errors: Skip file, continue scan
Integration
This skill is invoked by:
fordeslop-agent
command/deslop
Phase 8 (pre-review gates) with/next-taskscope=diff
The orchestrator spawns
simple-fixer to apply HIGH certainty fixes.