skills/forge-review/SKILL.md
[writes] Quality review for changed files or the whole codebase. Subcommands via flags: --scope=changed|all, --fix, --dry-run. Use when reviewing staged work before commit (--scope=changed), auditing the codebase (--scope=all), or iteratively fixing all quality issues (--scope=all --fix).
npx skillsauth add quantumbitcz/dev-pipeline forge-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill unifies what Phase 1 shipped as three separate skills. One dispatch, three behavioral modes.
Follow shared/skill-subcommand-pattern.md. This skill uses flags (not positional subcommands) because the distinction between "review changed files" and "audit whole codebase" is semantically a scope selection.
Dispatch rules:
$ARGUMENTS.--scope=<changed|all>, --fix, --dry-run, --full, --files <pattern>, --range <base>..<head>, --max-iterations <N>, --yes, --help.--help is present: print the usage block below and exit 0.--scope: changed--fix: ON when --scope=changed; OFF when --scope=all (see exception in Mode C).(scope, fix) pair:
(changed, true) → ### Subcommand: changed --fix (the default)(changed, false) → ### Subcommand: changed (same as above, fix phase skipped)(all, false) → ### Subcommand: all(all, true) → ### Subcommand: all --fix (destructive, gated — see Mode C)--scope=<bad> value: print Unknown --scope. Valid: changed | all. and exit 2.changed = last commit + uncommitted + staged. all = every tracked source file.changed, OFF for all.--scope=all --fix (autonomous CI/cron usage)--scope=changed, dispatch the full reviewer roster (up to 8 agents) instead of the quick 2--scope=changed, override the git range (default HEAD~1..HEAD + uncommitted)--scope=changed, glob-filter the file setchanged, 5 for all --fix)See shared/skill-contract.md §3 for the standard exit-code table.
Before any subcommand, verify:
git rev-parse --show-toplevel 2>/dev/null. If fails: report "Not a git repository. Navigate to a project directory." and STOP..claude/forge.local.md exists. If not: report "Forge not initialized. Run /forge-init first." and STOP.Reads from .claude/forge-config.md (if present):
max_iterations — iteration cap (default: 3 for changed, 5 for all --fix)pass_threshold — minimum quality score (default: 80)autonomous — if true, skip user confirmation between iterations AND skip the Mode C safety gateconvergence.oscillation_tolerance — score delta considered "no progress"quality_gate.* — reviewer selection overridesNo new config keys are introduced by this phase.
Default when $ARGUMENTS is empty or starts with a flag. Review recently-changed source files and (when --fix is ON, the default) fix findings in a loop.
Additional prerequisite: git diff --name-only HEAD returns at least one file. If empty: report "No changed files to review." and STOP.
Compute the file list:
Default (no --range, no --files):
PROJECT_ROOT=$(git rev-parse --show-toplevel)
COMMITTED=$(git diff --name-only HEAD~1..HEAD 2>/dev/null || git diff --name-only HEAD 2>/dev/null || echo "")
UNCOMMITTED=$(git diff --name-only 2>/dev/null)
STAGED=$(git diff --name-only --cached 2>/dev/null)
FILES=$(echo -e "$COMMITTED\n$UNCOMMITTED\n$STAGED" | sort -u | grep -v '^$')
With --range: FILES=$(git diff --name-only {base}..{head})
With --files: glob against project root.
Filter to source extensions:
echo "$FILES" | grep -E '\.(kt|kts|java|ts|tsx|js|jsx|py|go|rs|c|h|cs|cpp|swift|rb|php|dart|ex|scala|vue|svelte|html|css|scss)$'
Also include .md files if --full is set (for fg-418-docs-consistency-reviewer).
If zero files remain: report "No changed source files to review. PERFECT." and STOP.
Report: "Reviewing {count} files in {mode} mode."
Quick mode (default): Always dispatch these 2:
forge:fg-410-code-reviewerforge:fg-411-security-reviewerFull mode (--full): Quick 2 + forge:fg-412-architecture-reviewer + conditional agents based on file types present:
| Agent | Dispatch condition |
|---|---|
| forge:fg-418-docs-consistency-reviewer | Any .md files in scope |
| forge:fg-413-frontend-reviewer (mode: full) | Any .tsx, .jsx, .vue, .svelte, .html, .css, .scss, .styled.* files |
| forge:fg-416-performance-reviewer | Any .kt, .java, .py, .go, .rs, .cs files |
| forge:fg-417-dependency-reviewer | Any package.json, build.gradle.kts, go.mod, Cargo.toml, *.csproj, pyproject.toml, lock files |
| forge:fg-419-infra-deploy-reviewer | Any Dockerfile, docker-compose.*, *.yaml/*.yml with k8s markers, Helm charts |
Report: "Dispatching {count} review agents: {agent_names}"
ITERATION = 0
MAX_ITERATIONS = --max-iterations value or 3
TOTAL_FIXED = 0
SCOPE_FILES = initial file list
LOOP:
ITERATION += 1
Create task: "Review iteration {ITERATION}/{MAX_ITERATIONS}"
--- Step A: DISPATCH ---
Dispatch selected agents in parallel (max 3 concurrent via Agent tool).
Each agent receives:
- File list: SCOPE_FILES (full paths)
- Conventions: path to .claude/forge.local.md (if exists, else omit)
- Instruction: "Review these files. Report ALL findings — CRITICAL, WARNING, and INFO.
Format each finding as: file:line | CATEGORY | SEVERITY | message | fix_hint
Do not fix anything — report only."
--- Step B: COLLECT & SCORE ---
Deduplicate by (file, line, category) — keep highest severity.
Score: max(0, 100 - 20*CRITICAL - 5*WARNING - 2*INFO)
Report: "Iteration {ITERATION}: {count} findings, score {score}/100"
--- Step C: CHECK ---
If score == 100: BREAK → report PERFECT
If ITERATION >= MAX_ITERATIONS: BREAK → report final verdict with remaining findings
If --fix is OFF (user passed --scope=changed without --fix): BREAK after first iteration
--- Step D: FIX (only if --fix is ON) ---
For each finding (CRITICAL first, then WARNING, then INFO):
1. Read affected file + context (±20 lines).
2. Challenge: is there a better solution? Consider project conventions.
3. Fix using Edit tool. Follow existing patterns.
4. Track: add to FIXED list. TOTAL_FIXED += 1
After fixes: run commands.build, commands.test, commands.lint from forge.local.md.
If any fail: revert last fix (`git checkout -- <file>`), mark as unfixable.
--- Step E: NARROW SCOPE ---
SCOPE_FILES = files touched by fixes.
GOTO LOOP
Final report (verdict table, terse caveman-mode format, severity markers):
## Forge Review -- {PERFECT|PASS|CONCERNS|FAIL} (Score: {score}/100)
Mode: changed{--fix} | Files: {count} | Agents: {count}
Iterations: {ITERATION}/{MAX_ITERATIONS} | Fixed: {TOTAL_FIXED} | Remaining: {remaining}
### Fixed ({TOTAL_FIXED})
- `file:line` | CATEGORY | SEVERITY | what was fixed
### Remaining ({remaining}) [omit if PERFECT]
- `file:line` | CATEGORY | SEVERITY | message | reason unfixable
### Verdict
{PERFECT: Clean — score 100.}
{PASS: Score {N}/100. {remaining} findings could not be resolved in {MAX_ITERATIONS} iterations.}
{CONCERNS: Score {N}/100. Manual intervention recommended.}
{FAIL: Score {N}/100. Critical issues remain.}
Verdict thresholds: PERFECT = 100; PASS ≥ 80 and 0 CRITICALs; CONCERNS 60-79 and 0 CRITICALs; FAIL < 60 OR any CRITICAL remaining.
When .forge/caveman-mode exists and is not off, compress the final report using text markers ([CRIT], [WARN], [INFO], [PASS]). The finding data is unchanged — only the presentation format is compressed.
Do NOT create PRs, tickets, commits, or state files. This subcommand does not commit.
Read-only full-codebase audit via the check engine. Does not fix. Replaces the old /forge-review.
PROJECT_ROOT=$(git rev-parse --show-toplevel)
SOURCE_FILES=$(git -C "$PROJECT_ROOT" ls-files --cached --others --exclude-standard | grep -E '\.(kt|kts|java|ts|tsx|js|jsx|py|go|rs|c|h|cs|csx|cpp|cc|cxx|hpp|swift|rb|php|dart|ex|exs|scala|sc)$')
Count and report: "Found {count} source files to scan."
echo "$SOURCE_FILES" | while read -r f; do
"${CLAUDE_PLUGIN_ROOT}/shared/checks/engine.sh" --review --project-root "$PROJECT_ROOT" --files-changed "$PROJECT_ROOT/$f"
done
If the engine is not executable or not found: "Check engine not available. Verify the forge plugin is installed." and STOP.
Parse pipe-delimited findings: file:line | CATEGORY | SEVERITY | message | fix_hint. Count by severity and category prefix. Score with max(0, 100 - 20*CRITICAL - 5*WARNING - 2*INFO). Verdict: PASS (≥80, no CRITICAL), CONCERNS (60-79, no CRITICAL), FAIL (<60 or any CRITICAL).
Produce a ## Codebase Health Report block (categories table, top 10 issues, etc.) replacing the old /forge-review --scope=all body.
Write the full report to .forge/health-report.md (preserved path for tooling that greps it). This is the ONLY file this subcommand writes.
Do NOT fix issues. If the user wants fixes, they must re-run with --scope=all --fix.
Iterative fix loop across the whole codebase with per-iteration commits. Replaces the old /forge-review --scope=all --fix. Destructive — commits are real; a bad fix is on HEAD.
Before any file modification or commit, this subcommand MUST present an AskUserQuestion gate unless ONE of the following is true:
--yes flag is present on the command line, OR.claude/forge-config.md sets autonomous: true, OR--dry-run flag is present (preview only, never commits)Gate prompt:
If the user picks "Abort": report "Aborted — no changes made." and exit 4 (user-aborted; see skill-contract §3).
Under autonomous: true or --yes, log a one-line [AUTO-CONFIRM] Safety gate bypassed by <reason> and proceed.
PROJECT_ROOT=$(git rev-parse --show-toplevel)
FILES=$(git diff --name-only $(git merge-base origin/master HEAD 2>/dev/null || echo HEAD~10)..HEAD 2>/dev/null)
[ -z "$FILES" ] && FILES=$(git ls-files --cached --exclude-standard | grep -E '\.(kt|kts|java|ts|tsx|js|jsx|py|go|rs|c|h|cs|cpp|swift|rb|php|dart|ex|scala|vue|svelte|html|css|scss)$')
echo "$FILES" | while read -r f; do
"${CLAUDE_PLUGIN_ROOT}/shared/checks/engine.sh" --review --project-root "$PROJECT_ROOT" --files-changed "$PROJECT_ROOT/$f" 2>/dev/null
done
Record baseline score. ITERATION_BASE_SHA=$(git rev-parse HEAD).
Same loop as the old /forge-review --scope=all --fix. Dispatch reviewer roster (selected by file types), collect findings, triage by severity, fix with project conventions, run build/test/lint, revert regressions, re-dispatch to verify, and commit with a conventional-commit message once the iteration is clean.
Inner verification loop hard cap: 3 passes per iteration.
Iteration cap: --max-iterations override or config max_iterations (default 5).
After the loop ends, dispatch all reviewers one final time against the full diff FULL_BASE..HEAD to catch cross-iteration inconsistencies.
Save to .forge/forge-review-report.md (preserved path). Format:
## Deep Health Complete
Iterations: {N}
Issues fixed: {M} ({critical} critical, {warning} warnings, {info} info)
Final score: {S}/100
Commits: {list of SHAs + messages}
### Remaining (if any)
- {issue}: {reason — out of scope / intentional / accepted trade-off}
| Condition | Action |
|---|---|
| Shared prerequisites fail | Report specific error message and STOP |
| No changed files (scope=changed) | Report "No changed files to review." and STOP |
| No source files (scope=all) | Report "No source files found in the repository." and STOP |
| Check engine not available (scope=all) | Report "Check engine not available. Verify the forge plugin is installed." and STOP |
| Agent dispatch failure | Skip failed agent, continue. If ALL fail, report ERROR and STOP |
| Fix introduces regression | Revert the fix (git checkout -- <file>), mark as "unfixable: fix caused regression", continue |
| Safety gate declined (scope=all --fix) | Report "Aborted — no changes made." and exit 4 |
| Score stagnation | Report remaining findings, exit loop |
| State corruption | This skill does not depend on state.json — it runs independently |
/forge-verify --build — Quick build + lint + test check (no review agents)/forge-security-audit — Focused security vulnerability scanning/forge-run — Full pipeline including review as part of the workflowdevelopment
[writes] Build, fix, deploy, review, or modify code in this project. Universal entry for the forge pipeline. Auto-bootstraps on first run; brainstorms before planning when given a feature description. Use when you want to take any productive action: implementing features, fixing bugs, reviewing branches, deploying, committing, running migrations.
tools
[writes] Manage forge state and configuration: recovery, abort, config edits, session handoff, automations, playbooks, output compression, knowledge graph maintenance. Use when you need to recover from broken pipeline state, edit settings, or manage long-lived state.
development
[writes] Create, list, show, resume, or search forge session handoffs. Use when context is getting heavy and you want to transfer a forge run or conversation into a fresh Claude Code session, or to resume from a prior handoff artefact. Subcommands - no args (write), list, show, resume, search.
development
[writes] Manage the Neo4j knowledge graph. Subcommands: init, rebuild (writes); status, query <cypher>, debug (read-only). Requires Docker. No default — an explicit subcommand is required. Use when setting up the graph for the first time, rebuilding after major refactors, checking graph health, or running ad-hoc Cypher diagnostics.