Reduce codebase slop by deleting code, flattening abstractions, and replacing custom helpers/types/assertions with native SDK/npm helpers or straightforward schemas (for example Zod). Use when asked to simplify, delete code, or "desloppify" TypeScript/Bun/Nuxt code.
Use this skill for refactor passes where the main target is less code and clearer boundaries.
Primary objective:
Trigger this skill when the user asks for:
Always follow repository-level agent rules (for example AGENTS.md) when they are stricter than this skill.
During a desloppify pass, use this priority order:
Interpretation:
Use one mode per pass:
Prioritize files with:
as assertions, especially double-casts (as unknown as)ref/useState) that can be derived from existing source stateApply these non-negotiables:
as, especially as unknown as)Core execution order:
duplicate helpers, assertions, manual mappings, mirrored state)Use this when touching sensitive or cross-layer behavior.
Choose one or more tracks before editing:
If multiple tracks apply, run in this order: API/boundary -> Data/Drizzle -> UI/state -> integration validation.
Before refactoring:
Confirm all are satisfied:
z.object, z.enum, preprocess, and transform for inbound payload normalizationz.infer) instead of parallel hand-written interfacestypeof table.$inferSelecttypeof table.$inferInsertDuring a desloppify pass, these are presumed wrong unless clearly justified:
Use this rule:
as unknown as, as any, broad structural casts to force compatibilityas const for literal narrowing?: and ?? around domain values are a signal to inspect boundaries; if code keeps defaulting or re-normalizing persisted/internal state, validate once at the edge insteadMap changed files to required test layers:
Before refactoring, run quick scans:
as, as unknown as, broad castsAfter code changes (non-markdown), run:
If any layer is blocked by environment, record the exact blocker and still run all remaining layers.
Treat the pass as failing its goal if any of these are true:
Report:
Core or Deep) and why