$npx -y skills add thtskaran/claude-skills --skill deslopAudit and harden existing codebases (especially AI-generated / vibe-coded ones) for production readiness. Use when the user asks to review, audit, clean up, harden, deslop, refactor, or fix quality issues across an existing codebase. Works in two phases — first a thorough multi-p
| 1 | # Deslop — Code Hardening Skill |
| 2 | |
| 3 | Systematically audit and harden an existing codebase for production. Designed for AI-generated ("vibe coded") codebases that work superficially but are fragile, sloppy, or insecure under real-world conditions. |
| 4 | |
| 5 | **This skill operates in two strict phases. Never mix them.** |
| 6 | |
| 7 | ``` |
| 8 | Phase 1: AUDIT → produces AUDIT.md (human-reviewable, machine-parseable) |
| 9 | Phase 2: FIX → consumes AUDIT.md → applies fixes in safety order |
| 10 | ``` |
| 11 | |
| 12 | The user provides a codebase (directory path or repo). They may specify focus areas, exclusions, or constraints. If not specified, audit everything. |
| 13 | |
| 14 | --- |
| 15 | |
| 16 | ## Phase 1: AUDIT |
| 17 | |
| 18 | **MANDATORY before starting**: Read the full audit checklist and format spec: |
| 19 | ``` |
| 20 | Read ~/.claude/skills/deslop/references/checklist.md # 15-category audit checklist with specific patterns |
| 21 | Read ~/.claude/skills/deslop/references/audit-format.md # Structured finding format for AUDIT.md |
| 22 | ``` |
| 23 | |
| 24 | The audit runs five sequential passes. Each pass builds on the previous. Never skip a pass — thoroughness matters more than speed. |
| 25 | |
| 26 | ### Pass 0 — Reconnaissance |
| 27 | |
| 28 | Map the codebase before judging anything. Do NOT write findings yet. |
| 29 | |
| 30 | 1. **Generate file tree**: `find . -type f | head -500` or equivalent. Understand the shape. |
| 31 | 2. **Classify files**: Source, tests, configs, migrations, infra, docs, generated, vendored. |
| 32 | 3. **Identify the stack**: Language(s), framework(s), package manager, build system, runtime. |
| 33 | 4. **Build dependency map**: Which files import from which. Use `grep -rn "import\|require\|from\|include"` or language-specific tooling. |
| 34 | 5. **Identify entry points**: Main files, route handlers, API endpoints, CLI entry points, event handlers. |
| 35 | 6. **Detect existing tooling**: Check for `.eslintrc`, `pyproject.toml`, `tsconfig.json`, `.prettierrc`, `Makefile`, CI configs, etc. |
| 36 | 7. **Run available linters**: If linters are configured, run them and capture output. If not, note this as a finding. Common commands: |
| 37 | - JS/TS: `npx eslint . --format json 2>/dev/null` or `npx tsc --noEmit 2>&1` |
| 38 | - Python: `python -m pylint **/*.py --output-format=json 2>/dev/null` or `python -m flake8 . 2>&1` |
| 39 | - Go: `go vet ./... 2>&1` |
| 40 | - Rust: `cargo clippy --message-format=json 2>/dev/null` |
| 41 | - If no linter is configured, skip — don't install new tooling unless asked. |
| 42 | 8. **Produce the codebase map**: Write a structured summary to the top of `AUDIT.md`: |
| 43 | - Stack summary (language, framework, runtime) |
| 44 | - File count by category |
| 45 | - Module/directory architecture |
| 46 | - Entry points |
| 47 | - High-coupling modules (most imports in + out) |
| 48 | - Linter output summary (if available) |
| 49 | |
| 50 | **Output of Pass 0**: The "Codebase Overview" section of `AUDIT.md`. No findings yet. |
| 51 | |
| 52 | ### Pass 1 — Patterns & Consistency |
| 53 | |
| 54 | Scan for mechanical quality issues that don't require deep semantic understanding. Process file-by-file, prioritizing high-coupling modules first (from Pass 0's dependency map). |
| 55 | |
| 56 | **What to scan** (load `~/.claude/skills/deslop/references/checklist.md` categories 8-14): |
| 57 | - Naming convention violations and inconsistencies |
| 58 | - DRY violations — duplicated logic blocks, copy-pasted code |
| 59 | - Dead code — unused functions, unreachable branches, commented-out code, unused imports |
| 60 | - Magic numbers and hardcoded values |
| 61 | - Missing type annotations (for typed languages) |
| 62 | - Inconsistent patterns (e.g., callbacks in one file, promises in another) |
| 63 | - KISS/YAGNI violations — unnecessary abstractions, premature optimization |
| 64 | - Dependency issues — unused deps, circular imports |
| 65 | |
| 66 | **Chunking strategy for large files (>500 lines)**: Read in function/class-sized chunks. Never split in the middle of a function. When analyzing a chunk, re-read the file's import header for context. |
| 67 | |
| 68 | **For each finding**: Write it to `AUDIT.md` using the format from `~/.claude/skills/deslop/references/audit-format.md`. |
| 69 | |
| 70 | ### Pass 2 — Logic & Resilience |
| 71 | |
| 72 | Trace critical paths through the code. This pass requires cross-file context. |
| 73 | |
| 74 | **Start from entry points** identified in Pass 0. For each critical path: |
| 75 | 1. Trace the happy path from input to output. |
| 76 | 2. Then ask: what happens when each step fails? |
| 77 | 3. Check every error handling point: is the error caught? Logged? Re-thrown? Swallowed? |
| 78 | 4. Check edge cases: null/undefined inputs, empty collections, boundary values, concurrent access. |
| 79 | 5. Check data validation at trust boundaries (user input, API responses, file reads, env vars). |
| 80 | |
| 81 | **What to scan** (load `~/.claude/skills/deslop/references/checklist.md` categories 2-4): |
| 82 | - Correctness bu |