code-hygiene

code-hygiene is a skill for Claude Code, Codex from malakhov-dmitrii/forge. It costs 34 tokens per session (2,347 once invoked), scanned A, original, MIT.

A codebase health review that scans for unused code, weak tests, duplicates, complexity, security issues, and architectural relationships. It uses available analysis tools and saves structured findings.

In plain words
What is it for?
Checking an unfamiliar codebase, reviewing code after a feature, preparing for a large refactor, and turning cleanup findings into Forge tasks.
Why use it?
It helps teams find technical debt—the maintenance work built up by older or messy code—before it makes changes harder or riskier.

Skill for Claude CodeCodex

Part of the beast-forge plugin — 3 skills, 2 commands, 21 agents, 3 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/malakhov-dmitrii/forge/code-hygiene
Any agent
npx skills add malakhov-dmitrii/forge --skill code-hygiene
Clone the repo
git clone --depth 1 https://github.com/malakhov-dmitrii/forge

Made for: Claude Code, Codex.

Or install beast-forge, the plugin that ships this one along with the rest of its 3 skills, 2 commands, 21 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-hygiene

README.md
[![agentmods](https://agentmods.dev/badge/skills/malakhov-dmitrii/forge/code-hygiene.svg)](https://agentmods.dev/skills/malakhov-dmitrii/forge/code-hygiene)
Your own site
<a href="https://agentmods.dev/skills/malakhov-dmitrii/forge/code-hygiene"><img src="https://agentmods.dev/badge/skills/malakhov-dmitrii/forge/code-hygiene.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,347 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00034 $0.02347
Opus 5 $0.00017 $0.01174
Sonnet 5 $0.00007 $0.00469
Haiku 4.5 $0.00003 $0.00235

Measured 4d ago against content hash cad70535bb48, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-hygiene scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-hygiene/SKILL.md · 189 lines

How it starts

The opening of the file, as written. The whole thing — 189 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Hygiene — Scan, Report, Integrate

Persistent codebase health analysis. Runs static tools, interprets output, stores structured findings, suggests forge tasks for cleanup.

When to Use

  • After shipping a feature (catch accumulated tech debt)
  • Periodic hygiene (every 1-2 sprints)
  • Before major refactoring (map current state first)
  • Onboarding to unfamiliar codebase (architecture overview)
  • User says "code hygiene", "tech debt", "почисти код", "найди мертвый код", "проверь тесты"

Pipeline: SCAN → REPORT → INTEGRATE → SAVE


Phase 1: SCAN

1a. Project Detection
  • 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)
  • Report honestly: "Full analysis available for TS/JS. Limited to semgrep+scc for [language]."
1b. Tool Detection

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
1c. Tool Execution

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
    • If jq unavailable: Read raw-<name>.json with limit: 200
    • tsc is plain text: head -100 raw-types.txt > types.txt
  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)

Read the full file on GitHub · 189 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 189 lines · 34 tokens per session scan A cad70535bb48

Subscribe to this mod's changes

code-hygiene is a skill published in the GitHub repository malakhov-dmitrii/forge (25 stars, last pushed 1mo ago), licensed MIT. It adds 34 tokens to every session and 2,347 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

new-skill

Scaffold a new brooks-lint analysis skill so it passes npm run validate and npm run evals on the first try — generates skills/{name}/SKILL.md (with the mandatory "Do NOT trigger for:" clause and a Process section citing guide step ranges) plus skills/{name}/{name}-guide.md (sequentially numbered steps), then appends…

hyhmrright/brooks-lint · 145 tokens

brooks-sweep

Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…

hyhmrright/brooks-lint · 178 tokens

brooks-test

Test quality review drawing on twelve classic engineering books — with primary focus on xUnit Test Patterns, The Art of Unit Testing, How Google Tests Software, and Working Effectively with Legacy Code — that diagnoses structural problems in an existing test suite: brittleness, mock abuse, coverage illusions, slow…

hyhmrright/brooks-lint · 161 tokens

procoder

Work like a senior developer in a repository governed by procoder: run the commit gate before calling anything done, format and lint through the binary, and drive the spec, plan, todo, backlog, and sprint chain in .procoder/. Use this skill when the repository contains a .procoder/ directory or an AGENTS.md naming…

azrtydxb/procoder · 101 tokens

status

Where is the work right now. Regenerates the projections and the kanban board from the journal and answers with the progress line, the agents still running, the open gates and the resume steps. Read-only. Use for /tyran:status or when asked what is going on.

jjanczur/tyran · 58 tokens

deslop

The optimization pass, defined - delete before you add, one smell class per pass, behaviour pinned by a test that ran BEFORE the edit. Lints a SKILL.md and prose by the same instinct. Use for the per-story optimization pass or when code has grown noisy without growing capable.

jjanczur/tyran · 58 tokens