review-dirty
Review dirty code changes using Claude Code Agent tool. When user say to "review" or "review changes" or "review dirty code"
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review dirty code changes using Claude Code Agent tool. When user say to "review" or "review changes" or "review dirty code"
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Picks up after /build to publish a GitHub release. Pre-flights the staged artifacts, drafts release_notes.md from commits since the last tag, tags master, then hands the gh release create upload command to the user. Stops short of running the upload — that's user-driven.
Spawn a fresh-context Opus 4.7 agent to give an independent take when Claude and the user are talking past each other on a contested logic interpretation, OR to validate behavioral self-observations from /session-recap Step 0. User-triggered or claude self-proposed at impasse.
End-of-session recap — codify learnings synchronously into their canonical homes; daily logs hold narrative continuity only.
Review dirty code and fix iteratively using Ralph loop pattern. When user say to "loop to fix dirty" or "review+fix"
Sanity-scan the production codebase for cruft that piles up after AI-assisted feature work — duplicated logic, dead helpers, half-finished implementations, speculative architecture, stale comments. Discussion-first, item-by-item; smoke-tests every fix.
| name | review-dirty |
| description | Review dirty code changes using Claude Code Agent tool. When user say to "review" or "review changes" or "review dirty code" |
| triggers | ["/review-dirty","review","review changes","review dirty code"] |
You are a code reviewer analyzing dirty changes in a repository.
This project runs on Windows. Prefer PowerShell over bash for every shell command — git, ls, cat, everything. The Git-for-Windows bash shell on this machine crashes intermittently with fatal error - add_item ("\??\C:\Program Files\Git", "/", ...) failed, errno 1, which aborts the review mid-flight. PowerShell does not have this issue.
Apply this to both the coordinator and the reviewer subagent: run git commands via the PowerShell tool; do NOT use the Bash tool even when a bash code block appears in this document — those blocks are illustrative syntax, not a directive to use bash.
Two scope axes. WHICH FILES is set by the caller (or review-plus-fix-relentlessly's safety-scope). WHICH LINES within a file has a mode:
VERSION = "0.5.4" sat as unchanged history for weeks while every dirty-diff review was structurally blind to it.--tims→--classic default flip, a picker/tutorial/consent screen added or dropped, a flow-routing if edited): auto-escalate to FULL scope on the touched flow module(s) AND run the integration-residue checklist — re-walk EVERY state-gated branch (if not settings.get(...), if X not in ..., if not path.exists()) and EVERY reachable screen, asking per item: still reachable? still needed? now redundant beside a sibling feature? A change reviewed only along its OWN axis (the flag it flips) is blind to a screen made redundant on an ORTHOGONAL axis (persisted state) — the v0.6.0 language picker survived its own graduation commit exactly this way (critical_lessons §6). A DUTY, not a user opt-in: recognize the trigger and escalate even from a DIRTY-mode call.In FULL mode: (1) embed the WHOLE in-scope files in the reviewer payload, not git diff; (2) the reviewer runs the deterministic scanners over the whole module FIRST (see Derivation-bypass scan), then the lenses over every line. A stated full scope is LITERAL — never silently narrow it to the diff.
Gather git status information using PowerShell:
git status --short
git diff --name-only
git diff --unified=3
Spawn a reviewer agent using the Agent tool:
Agent({
description: "Review dirty code changes",
subagent_type: "general-purpose",
model: "opus",
name: "CodeReviewer",
prompt: "
You are a code reviewer analyzing dirty changes in a repository.
Use PowerShell for ALL shell commands. Do NOT use bash. The Git-for-Windows bash shell on this machine crashes with fatal error - add_item ... errno 1, which will kill your review. Run git status, git diff, directory listings, etc. via the PowerShell tool.
This project has codified rules and dormant-scaffolding patterns; surface findings need that context to be accurate. Do the standard project Session Startup before reviewing:
CLAUDE.md — project framing, mental model, file-placement table, deployment-framememory/YYYY-MM-DD.md — recent decisions, in-flight workmemory/MEMORY.md — long-term curated index.claude/rules/critical_lessons.md, conventions.md, principles.md — codified rules to apply.claude/skills/vibe-check/SKILL.md Step 2 — the 10 smell categories you will apply as Lens 2DISPLAY.md, DATA_FORMAT.md, auto_input/README.md), read its EDIT-CONTRACT block at the topA hardcoded literal that re-states a value which owns a single canonical source drifts silently — it is correct-at-authoring, so neither an eyeball nor a dirty-diff review catches it (a hardcoded \"0.5.4\" shipped while the build was 0.6.0). Two halves:
(1) Deterministic — run the linter over the in-scope .py files (re-checks committed code the diff never shows; read-only, safe):
python _dev_scripts/lint_primitives.py --derivable <in-scope .py files>
python _dev_scripts/lint_primitives.py <in-scope .py files>
(2) Semantic — the sub-classes a linter CANNOT reason about. Check each in-scope file for a hardcoded literal that should instead DERIVE from a source:
== \"_mock\" where startswith(\"_\") is meant; one route/model/station name special-cased instead of its category). → the general predicate.tims_chrome PALETTE value, typed inline instead of the constant. → the constant.surf.get_height() or a param.i18n.t(key).stop.get(\"X\") or default in a renderer. → filled in the finalize_route closure (principles.md § "JSON is input grammar").Report each finding as a Lens-3 item (rule: conventions.md § Tooling "canonical-source duplication") with file:line · the literal · the canonical source it should derive from.
sta terminology not 'departure_melody')sys.frozen, sys._MEIPASS, sys.executable, Path(__file__) for behavior-dependent paths), threading primitives, file-I/O timing assumptions, library API behavior that differs between dev and frozen, OR any code where "correctness" depends on runtime conditions not visible from reading the file — verify against primary source (the build script's actual copy logic, the library's runtime-hook source, official docs, or actual exercise of the deployed artifact). Don't accept "intentional / standard / the way it's always done" claims from memory. The 2026-05-05 release-crash trace had a prior reviewer defend i18n.app_root's _MEIPASS usage as "intentional semantics" — wrong, because the defense reasoned from generic PyInstaller mythology rather than checking THIS project's build script (which doesn't use --add-data, so _MEIPASS is empty). Per principles.md § "Verify deployment-frame and external-runtime semantics from primary source."Apply ALL 13 categories from .claude/skills/vibe-check/SKILL.md Step 2:
# NOTE: deliberately NOT called from ... yet block — DO NOT flag)displays/) importing from _*/ pathsapp_paths.py / displays/utils.py / constants.py / i18n.py). Per principles.md § "Search before authoring common utility code."sys._MEIPASS, sys.frozen, sys.executable, Path(__file__) for behavior-dependent paths, if frozen: branching outside app_paths.py; OR threading / I/O timing patterns without a comment explaining the invariant). Per principles.md § "Verify deployment-frame and external-runtime semantics from primary source." Sibling to Lens 1 verification — Lens 1 fires on the diff; Lens 2 fires on the standing pattern.critical_lessons.md §6. Verification: for each first-run / onboarding screen, confirm a live entry path AND that no sibling feature already owns its job (the v0.6.0 picker was redundant beside the TIMS home's language knobs).On Lens 2 categories #11 + #12 — pre-flight grep: when reviewing a diff that introduces a small utility helper or a deployment-frame primitive, do a grep -rn cross-codebase pass for sibling implementations BEFORE approving. The duplication isn't visible from the diff alone — it's visible only from the codebase view.
If uncertain whether a finding is a real smell or known-dead-feature / dormant-scaffolding, flag at severity info and ASK rather than confidently red-flagging.
Cite specific rules from the pre-read. When a finding violates:
conventions.md (e.g. _* prefix hard rule, .otf-only, contract pointers convention, dormant-scaffolding marker convention)critical_lessons.md (e.g. 'runtime-required materials must be committed', 'lazy import != optional dep')principles.md (e.g. discussion-first, verify before claiming, causal depth, tighten before appending)CLAUDE.md mental-model section or session-recap SKILL.md...cite the rule by name. Generic findings without rule citations are weaker than rule-grounded ones; the citation forces you to consult the rules instead of pattern-matching from training.
The project carries a real test suite (_tests/, tier map in _tests/README.md). Review the CHANGE against it on three axes:
_tests/README.md "Coherence ≠ correctness") — assert the deepest invariant, not a derived restatement._tests/README.md "Fixture ≠ tier"). Rendering is exempt (by-eye by design). Regression-test-per-incident is the project's first-fill rule.resolve_language extraction that made the first-run language path testable). Untestable logic is how a bug class stays uncovered.Severity: a stale / false-green test → critical (it actively misleads); a missing test on a regression-worthy path, or untestable-as-written logic → warning.
architectural-critical — Lens 3 with rule citation, OR Lens 2 #10 (production imports of _*/), OR similar deploy-frame issue. Loop must NOT stop while these exist.critical — bug that breaks a code path under realistic usewarning — Lens 2 smell that is not on the exception list, OR Lens 1 issue that does not break anything but should be fixedinfo — uncertain findings, ASK-before-confidently-flagging items, low-confidence smells$(git status --short)
$(git diff --unified=3 -- $(git diff --name-only | head -10))
$ARGUMENTS
{
\"issues_found\": true/false,
\"issues\": [
{
\"file\": \"path/to/file.py\",
\"line\": 42,
\"lens\": 1,
\"issue\": \"Brief description\",
\"severity\": \"architectural-critical\",
\"rule_citation\": \"<doc section> or null\",
\"suggestion\": \"Specific fix suggestion\"
}
],
\"summary\": \"Overall assessment, grouped by lens\"
}
```"
})
model: "opus" — project favors deeper architectural reasoning over cost; required for the three-lens review structure (call-graph tracing, multi-file rule application, distinguishing dormant scaffolding from real dead code)