modrexio/modrex / .agents/skills/deslop
deslop
VerifiedRemove AI-generated code slop from a diff, path, branch, or repository
deslop
Use this skill to clean AI-shaped code before a commit, PR, or final answer.
Start with the five dangerous patterns from .agents/rules/ai-danger-patterns.md. These are worse than cosmetic slop because they can hide real bugs.
Mode
Determine the target based on the argument passed:
- No argument — scan uncommitted changes only (
git diff HEAD) - Path argument (e.g.
apps/desktop/src/renderer/) — scan that path only --diff— scan the diff of the current branch against main (git diff main...HEAD)--all— scan the full codebase (apps/desktop/src/andapps/desktop/src-tauri/src/)
Fix each issue you find, then report a 1-3 sentence summary of what you changed.
Required reads
Before editing, read:
.agents/rules/ai-danger-patterns.md- the repository-root
AGENTS.md - the nearest
AGENTS.mdabove each touched path
Priority order
Fix dangerous AI patterns first:
- Silent catch / silent fallback
- Generic helpers replacing game-specific logic
- Defensive checks that hide broken invariants
- Deep
if/elsenesting - Fake abstractions / speculative future-proofing
Then clean cosmetic AI slop:
- comments explaining what the code already says
- casts to
anyto work around type issues — fix the types instead - unnecessary
useCallbackoruseMemo - derived state stored in React state without reason
- renamed
_unusedvariables that should just be removed - comments like
// removed,// old,// TODO: maybe laterwithout an issue - unrelated formatting or file churn
- non-standard symbols in comments or strings (
→,←,⇒,✓,✗) — use plain words: "to", "becomes", "returns", "yes", "no"
Silent catch / fallback cleanup
Replace silent failure with either:
- no local catch, letting the caller handle it
- a catch that adds context and shows useful feedback
- a documented domain fallback
Bad:
try {
return await api.getInstalledMods()
} catch {
return []
}
Better:
return await api.getInstalledMods()
or:
try {
return await api.getInstalledMods()
} catch (error) {
logger.error("Failed to load installed mods", { error })
throw error
}
Generic helper cleanup
Do not simplify domain-specific code into generic helpers.
If a helper hides game-specific behavior, restore explicit domain branching or rename it to the real domain rule.
Defensive check cleanup
Remove impossible-state checks from trusted code.
Do not widen types to include null or undefined unless the domain really allows it.
Validate at boundaries instead.
Control-flow cleanup
Flatten nested conditions. Use guard clauses and early returns. Remove else after return, throw, continue, or break.
Abstraction cleanup
Delete future-facing options, flags, helpers, managers, factories, and adapters unless they are needed by current behavior.
Inline one-use helpers when they do not name a real domain concept.
Structural comment protection
Do not remove useful file-level or section-level comments.
Keep comments that explain: reference implementations, file formats, algorithm provenance, archive format behavior, security-sensitive path assumptions, game-specific loader rules, why a port must remain byte-compatible, test scenario intent.
The structural comments in pdmod.rs (.pdmod format description, Bob Jenkins hash provenance, hashlist reference) are load-bearing domain knowledge — never remove them.
Only remove comments that repeat nearby code or describe basic syntax.
Project-specific violations
Fix these when found:
- hardcoded Tailwind color classes (
zinc-*,red-*,gray-*) — use semantic tokens fromsrc/renderer/src/index.css - bare markdown-it rendering — use
components/MarkdownContent.tsx - native
<select>— usecomponents/Select.tsx - bare string literals in JSX — use
t('key')from../i18n - direct
api.getMod,api.listModFiles, orapi.listModLinkscalls in renderer components — usegetCachedMod,getCachedModFiles, orgetCachedModLinks - direct
api.getThumbnailcalls — usegetLocalThumbnailorgetCachedThumbnailUrl - new Tauri commands not wired in all three required places: Rust implementation,
generate_handler![...], andsrc/renderer/src/api.ts - debug
console.logorconsole.warn
Procedure
- Inspect the target diff or files.
- Fix the five dangerous patterns first.
- Fix remaining AI-shaped code.
- Do not change behavior unless the slop is itself a bug.
- Run the narrowest useful check if available.
- Report what was cleaned in 1-3 sentences.
Stop conditions
Stop and ask for direction only if cleanup would require a behavior decision.
Do not ask before removing obvious comments, flattening obvious control flow, or deleting unrelated generated noise.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |