/lessloc:lessloc [setup | audit [path] | review [git ref] | consolidate | find <words>]from lessloc
Finds, reviews, and removes unnecessary code (duplicates, dead code, needless abstractions) without changing behavior. Use for audits, consolidation, and LOC reduction.
Ships in lessloc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The CLI is node "${CLAUDE_PLUGIN_ROOT}/lessloc.mjs". Its numbers are facts; do not recount by hand.
init. It writes nothing into the repository, only git hooks for this clone. Show the user the test command it found: a passing run of it is what marks an agent's final state verified. Offer init --rules (rules in AGENTS.md for other AI tools) only if the user uses tools without lessloc's hooks, and say that the file is shared with everyone who works on the project. Finish with doctor, in plain words. remove undoes init; the snapshots of the working tree stay in .git/objects, never pushed, until git gc prunes them.find <what it does> lists existing definitions that may already do it, by name; then search for code named differently too.audit <path> --json --tools (--tools adds knip, vulture, cargo-machete, deadcode and installed vulnerability scanners). Then find what the tool cannot see: code the standard library or an installed dependency already provides, defensive code for cases that cannot happen, responsibilities split across folders that always change together, made-up APIs and unpinned versions, over-mocked tests, answers hard-coded to fixtures, data shapes duplicated with renamed fields, and dead code kept behind a guard or flag. Similar-looking code is a duplicate only if it serves the same responsibility.check --base <ref> --json (no ref: the uncommitted work), then the same semantic pass on the changed code and its callers.audit --json, take the biggest safe cuts (duplicate blocks, definitions with the same body, unreferenced definitions after checking dynamic use, if-chains a table replaces, swallowed errors, comment blocks whose decisions belong in DECISIONS.md), in small steps with test after each, then rerun the audit. Shrink without removing tests, logging or error handling. Stop when the next cut needs a tradeoff or cannot be verified; "nothing further justified" is a valid result. Finish with baseline so the ratchet locks the gain in.Every finding names a location, the concrete cut, the lines saved, and why behavior stays the same. Never cut what RULES.md says never to cut: correctness, security, tests or anything the user asked for (see "What lessloc never pushes an agent toward" in PATTERNS.md). No style taste. Report numbered findings, biggest safe saving first, one line each: N. path:lines: cut → −X lines (risk), ending with Total: −X lines, −Y files, −Z dependencies and what you did not check. For audit and review, change nothing until the user picks numbers.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-audit, dead-code, duplicate-code, refactoring, code-cleanup
npx claudepluginhub starswallow/lessloc --plugin lesslocOther plugins' skills for the same job