From beast-forge
Runs static tools like tsc, semgrep, knip to analyze codebase for dead code, test quality, duplicates, complexity, security, architecture. Full TS/JS support; limited Python/Go/Rust. Stores structured reports.
npx claudepluginhub malakhov-dmitrii/forgeThis skill uses the workspace's default tool permissions.
Persistent codebase health analysis. Runs static tools, interprets output, stores structured findings, suggests forge tasks for cleanup.
Assesses codebase health for legacy projects by analyzing complexity, dependencies, dead code, tech debt, and git hotspots. Produces module health scores and prioritized rescue plan.
Technical debt detection and remediation. Run at session end to find duplicated code, dead imports, security issues, and complexity hotspots. Triggers: 'find tech debt', 'scan for issues', 'check code quality', 'wrap up session', 'ready to commit', 'before merge', 'code review prep'. Always uses parallel subagents for fast analysis.
Runs 7-phase analysis of TypeScript codebases using typegraph-mcp tools like ts_dependency_tree and ts_import_cycles, producing architectural report for onboarding or overviews.
Share bugs, ideas, or general feedback.
Persistent codebase health analysis. Runs static tools, interprets output, stores structured findings, suggests forge tasks for cleanup.
package.json → TypeScript/JavaScript (primary, full tool support)pyproject.toml/setup.py → Python (semgrep + scc only)go.mod → Go (semgrep + scc only)Cargo.toml → Rust (semgrep + scc only)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:
<cmd> > .omc/hygiene/raw-<name>.json 2>&1jq '<path>[:50]' raw-<name>.json > <name>.json
Read raw-<name>.json with limit: 200head -100 raw-types.txt > types.txt<name>.json — NEVER read raw-* files into contextTools (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.
.omc/hygiene/snapshot.json exists → diff file hashes against current.ts/.js files changed since last run → skip tscINLINE mode — Claude does all analysis directly:
dead-code.json (knip output). If knip unavailable: grep for exports, cross-reference imports.Glob("**/*.test.{ts,tsx,js}", "**/*.spec.{ts,tsx,js}", "**/__tests__/**")expect(true).toBe(true), empty test body).skip, .todo, or always-failingcomplexity.json: high-complexity files with no tests = critical gap.git blame on .skip tests to find how long they've been disabled.dependencies.json: extract module dependency graph, generate mermaid diagram.complexity.json: identify hotspots (top-10 most complex files).architecture.md with mermaid flowchart + complexity heatmap./docs-refresh --scan-only — compose, don't duplicate.| 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:
dead-code-hunter (agents/dead-code-hunter.md, model: sonnet)
.omc/hygiene/dead-code.json + project root pathtest-analyst (agents/test-analyst.md, model: sonnet)
.omc/hygiene/complexity.json + test file glob resultshygiene-synthesizer (agents/hygiene-synthesizer.md, model: opus)
.omc/hygiene/*.json + agent outputs (1,2) + optional docs-refresh outputreport.md + architecture.md + severity-classified findingsreport.md to user with health score and finding counts./forge --spawn "refactor: [finding description]"--park them for later..omc/hygiene/ files (see Storage Schema below).snapshot.json with current source file SHA-256 hashes.raw-* files (keep with --keep-raw for debugging)..omc/hygiene/
├── _meta.json # run metadata, health score, tool list
├── dead-code.json # knip findings (summarized)
├── duplicates.json # jscpd clone pairs
├── dependencies.json # dependency-cruiser violations + graph
├── complexity.json # scc per-file scores (top-50)
├── tests.json # test quality classifications
├── security.json # semgrep findings
├── types.json # tsc errors (plain text, head -100)
├── architecture.md # mermaid diagrams, module map, data flow
├── report.md # human-readable triage (the deliverable)
└── snapshot.json # SHA-256 per source file for incremental
All JSON files carry _meta: { updated_at, tool, version } for staleness tracking.
/code-hygiene — full pipeline (adaptive mode)
/code-hygiene --module <path> — scope to specific directory
/code-hygiene --deep — include mutation testing (stryker, slow)
/code-hygiene --inline — force inline mode (no agents)
/code-hygiene --agents — force agent mode
/code-hygiene --keep-raw — keep raw-* tool output files
/forge --spawn..omc/hygiene/ files without user approval.