/lstack:code-reviewfrom lstack
Reviews or improves code in four modes: bug/security review (default), performance, clean-code audit, or slop cleanup. Read-only for analysis; cleanup mode writes code.
Ships in lstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
One skill for reviewing and improving code quality. Pick a mode by intent (or pass an explicit
mode: parameter); each mode is a full, self-contained workflow in references/. Load only the
mode you need — this protects the agent's context budget.
| Mode | Use when the user wants to... | Reads / writes | Output | Workflow |
|---|---|---|---|---|
| review (default) | find bugs, security holes, quality issues, or weakened tests and gates in a diff/PR | read-only | prioritized findings, each introduced or pre-existing | references/review-mode.md |
| perf | make code faster — bottlenecks, leaks, algorithmic waste | read-only | performance findings report | references/perf-mode.md |
| clean | audit readability/standards vs the bbv Clean Code cheat sheet | read-only | CLEAN_CODE_AUDIT.md | references/clean-mode.md |
| cleanup | actually refactor out AI slop, dead code, duplication, cruft | WRITES CODE | modified source files | references/cleanup-mode.md |
mode:review|perf|clean|cleanup (or --mode <name>), use it.review, perf, and clean are source-read-only: they analyze and report without touching
source files. Review and perf may write only the named report artifact their mode specifies
(CODE_REVIEW.md for review; perf returns its report in the response). During review/perf analysis,
they must not otherwise mutate the index, refs, stash, branch, worktree, or remote state.
clean retains its own report-writing and sync contract. cleanup modifies files. Therefore:
cleanup by weak inference. Run it only when the user explicitly asks to
refactor / clean up the codebase (or passes mode:cleanup). A plain "review my code" must never
rewrite files — stay in a read-only mode.git rev-parse HEAD, git status, and local tracking
observations without claiming remote freshness. They do not fetch, stash, pull, rebase,
checkout/switch, create or delete branches/worktrees, or apply source fixes. A separately
approved mutation workflow owns its own freshness check and sync gates.CODE_REVIEW.md to the full head SHA and the base it compared against, a
local base disclosed as not fetched. A report whose head is not the current HEAD is stale
wherever it is used or validated (references/review-mode.md, Review Binding).REVIEW.md from the base commit, never from the working tree or the
change, applies only rules whose trigger matches the diff, and re-checks an earlier report's open
findings first (Review Rules, Earlier Round).Uncertainty say
self-review, not independent (Independent Review).cleanup, and follow that mode's own gating.Applies to clean (writes CLEAN_CODE_AUDIT.md) and cleanup (writes source) only. review and
perf never sync (see the Safety section). Before the first write in either mode:
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
clean, stash first, sync, then pop the stash.cleanup, stop and ask the user to commit or stash first.origin is missing, or the pull or stash pop conflicts, stop and ask the user. Do not write any file.clean skips the sync and notes that in its report.The full step is in references/clean-mode.md (with stash recovery commands) and references/cleanup-mode.md.
Read the selected mode's reference file and execute its steps exactly. Supporting files each mode uses (already colocated under this skill):
references/review-mode.md — agents agents/reviewer.md, agents/file-reviewer.md, agents/report-assembler.md; refs references/subagent-architecture.md, references/code-smells.mdreferences/perf-mode.md — ref references/language-checks.mdreferences/clean-mode.md — refs references/clean-code-checklist.md, references/tdd-checklist.md, references/html-report-guide.mdreferences/cleanup-mode.md — the 8 cleaner agents in agents/ (deduplicator.md, type-consolidator.md, unused-code-killer.md, circular-dep-untangler.md, weak-type-strengthener.md, defensive-programming-remover.md, legacy-code-remover.md, slop-comment-cleaner.md)If the Agent tool is available, modes that use subagents (review, cleanup) spawn them per their workflow — fresh-context validation and parallel work. If it is unavailable (e.g., Claude.ai), execute each mode's phases inline (less rigorous, but functional).
Modes compose: a common flow is clean (audit → CLEAN_CODE_AUDIT.md) then cleanup (apply the
refactors), or review/perf to find issues before fixing. Run one mode at a time; confirm with
the user before switching into the code-writing cleanup mode.
clean or cleanup, follow that mode's sync, backup, dry-run, confirmation, and rollback steps
in order. If a sync or safety check fails, stop before the first write.Verify every run against the selected mode's own acceptance criteria, then assert all of these router criteria:
git diff when applicable.Also check that a reader can use the final response:
Mode: states the result and PASS, PARTIAL, or FAIL.Uncertainty.file:line, a command output, or a report section.
An intermediate step passing does not count as the whole run passing.Decision names the approval needed (for example, starting cleanup),
or says "No approval needed", and lists any remaining user action.Agent inspection cannot confirm that a human understood the output. If no human feedback was given, report human understanding as unconfirmed; do not count it as a failure or a pass.
Every mode's final response carries these five items, in this order. Keep each item to one or two lines; the mode's report artifact holds the detail.
Mode: review
Result: PARTIAL — 1 critical, 2 major, 0 minor findings; reviewer pass incomplete for 3 files
Evidence: CODE_REVIEW.md written; reviewer agent validated 41/44 files; `git diff --stat -- src/` empty
Uncertainty: 3 generated files skipped (listed in CODE_REVIEW.md); no tests were run
Decision: No approval needed. To apply fixes, ask for a separate `cleanup` run.
After routing and after the selected workflow, emit a compact report:
◆ Code Review ([mode])
Mode selection: √ pass
Workflow criteria: √ pass
Output verified: √ pass
Safety boundary: √ pass
Result: PASS | FAIL | PARTIAL
Use × fail — reason for any unmet check. Never report PASS while a selected-mode acceptance
criterion, expected output, required test, or safety guardrail is unresolved.
mode: value → reject it and list the four valid modes.cleanup run.Optional and propose-only. After the run's result is delivered, run this check:
git command, diff base, or linter failed and a workaround worked.references/ (the directory holding this SKILL.md). Bump the patch number of metadata.version. If the skill is an installed copy or tracked in git, say so. Commit nothing unless the user asks.Off — the user opted out.agents/circular-dep-untangler.md (opens in a new tab)agents/deduplicator.md (opens in a new tab)agents/defensive-programming-remover.md (opens in a new tab)agents/file-reviewer.md (opens in a new tab)agents/legacy-code-remover.md (opens in a new tab)agents/report-assembler.md (opens in a new tab)agents/reviewer.md (opens in a new tab)agents/slop-comment-cleaner.md (opens in a new tab)agents/type-consolidator.md (opens in a new tab)agents/unused-code-killer.md (opens in a new tab)agents/weak-type-strengthener.md (opens in a new tab)references/clean-code-checklist.md (opens in a new tab)references/clean-mode.md (opens in a new tab)references/cleanup-mode.md (opens in a new tab)references/code-smells.md (opens in a new tab)references/html-report-guide.md (opens in a new tab)references/language-checks.md (opens in a new tab)references/perf-mode.md (opens in a new tab)references/review-mode.md (opens in a new tab)references/subagent-architecture.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
20 skills in this plugin
/agent-configCreate, update, or audit AGENTS.md (default) or CLAUDE.md agent instructions: set up, prune, add a rule, or merge CLAUDE.md or .cursorrules into one file Claude Code, Codex, and Cursor all read. Don't use for READMEs, skills, or subagents./auto-pushGenerate a commit message, stage all changes, and push to remote after scanning for secrets, large files, and protected-branch risks. Skip for opening PRs, code review, or cutting releases/tags./cleanup-projectPrepare a git repo before new work: review uncommitted changes, fix .gitignore, delete merged branches, end on clean main, or inspect one branch before deciding. Don't use for dead code, commit-and-push, releases, LICENSE files, or git how-tos.npx claudepluginhub luongnv89/skills --plugin lstackOther plugins' skills for the same job