docs-refresh
Full documentation hygiene pass: memory, CLAUDE.md, lessons, references, guides. Audit freshness, delete stale, update outdated,…
Codebase health analysis: dead code, test quality, duplicates, complexity, security, architecture mapping. Tool-first, structured storage, forge integration.
Claude Code
$ npx -y skills add malakhov-dmitrii/forge --skill code-hygiene --agent claude-code
Codex
$ npx skills add malakhov-dmitrii/forge --skill code-hygiene -a codex -y
Cursor
$ npx skills add malakhov-dmitrii/forge --skill code-hygiene -a cursor -y
Gemini CLI
$ npx skills add malakhov-dmitrii/forge --skill code-hygiene -a gemini-cli -y
GitHub Copilot
$ npx skills add malakhov-dmitrii/forge --skill code-hygiene -a github-copilot -y
OpenCode
$ npx skills add malakhov-dmitrii/forge --skill code-hygiene -a opencode -y
Windsurf
$ npx skills add malakhov-dmitrii/forge --skill code-hygiene -a windsurf -y
name: code-hygiene description: "Codebase health analysis: dead code, test quality, duplicates, complexity, security, architecture mapping. Tool-first, structured storage, forge integration."
Persistent codebase health analysis. Runs static tools, interprets output, stores structured findings, suggests forge tasks for cleanup.
---
Check availability, report what's missing:
Global: which tsc semgrep scc jq Local: grep devDependencies package.json for knip, jscpd, dependency-cruiser, stryker Missing: suggest `npm i -D knip jscpd dependency-cruiser` for full coverage
Run available tools. ALL output goes to files first — NEVER read raw output into context.
**3-step pattern for every tool:** 1. **Redirect:** `<cmd> > .omc/hygiene/raw-<name>.json 2>&1` 2. **Summarize:** `jq '<path>[:50]' raw-<name>.json > <name>.json`
3. **Read:** Read `<name>.json` — NEVER read `raw-*` files into context
**Tools (run in parallel via background Bash):**
| Tool | Command | Output file | Summary jq path | |------|---------|-------------|-----------------| | tsc | `tsc --noEmit 2>&1 > raw-types.txt` | types.txt | `head -100` (plain text) | | scc | `scc --by-file --format json src/ > raw-complexity.json` | complexity.json | `sort_by(.Complexity) \| reverse \| .[:50]` | | semgrep | `semgrep scan --config auto --json . > raw-security.json` | security.json | `.results[:50]` | | knip | `npx knip --reporter json > raw-dead-code.json` | dead-code.json | `.files[:50] + .exports[:50]` (if in devDeps) | | jscpd | `npx jscpd src/ --reporters json -o /tmp/jscpd > raw-duplicates.json` | duplicates.json | `.duplicates[:50]` (if installed) | | dep-cruiser | `npx dependency-cruiser src --include-only "^src" --output-type json > raw-dependencies.json` | dependencies.json | `.summary.violations[:50]` (if installed) | | stryker | `npx stryker run --reporters json > raw-mutations.json` | mutations.json | `.files \| to_entries[:20]` (only with `--deep`) |
After SCAN completes, count source files analyzed:
source_files < 50 → INLINE mode (Claude interprets all tool outputs directly) source_files >= 50 → AGENT mode (spawn focused agents per concern area)
User can override: `--inline` forces inline, `--agents` forces agents.
---
**INLINE mode** — Claude does all analysis directly:
| Severity | Criteria | Action | |----------|----------|--------| | **P0** | Type errors (tsc), security critical (semgrep high), broken tests | Fix this sprint | | **P1** | Dead code (high confidence), unused deps, circular deps, complexity >25 | Plan fix | | **P2** | Suspected dead code, duplicates >30 lines, complexity 15-25, weak tests | Backlog | | **P3** | Minor duplicates, style issues, low-priority items | Nice to have |
Weighted 0-100: types (25%) + dead code (20%) + tests (20%) + security (15%) + complexity (10%) + deps (10%). Per-category: 100 = zero findings, 0 = critical issues. Deduct per finding by severity.
**AGENT mode** — spawn 3 focused agents sequentially:
1. **dead-code-hunter** (`agents/dead-code-hunter.md`, model: s
Ore in, steel out. A blacksmith doesn't blame the ore. It smelts, shapes, tempers, and quenches — until what comes out holds an edge.
Full documentation hygiene pass: memory, CLAUDE.md, lessons, references, guides. Audit freshness, delete stale, update outdated,…
Ore in, steel out. Planning pipeline with independent verification, persistent memory, and compounding knowledge. Use for 3+…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.