kramme-cc-workflow/skills/kramme:pr:code-review/SKILL.md
Analyze code quality of branch changes using specialized review agents (tests, errors, types, security, performance, slop, lean deletion, refactor fit, simplification). Outputs REVIEW_OVERVIEW.md with actionable findings, or replies inline with --inline. Use --team for multi-agent cross-validation. Not for UX, visual, or accessibility review -- use kramme:pr:ux-review for those.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:pr:code-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.
Run a comprehensive pull request review using multiple specialized agents, each focusing on a different aspect of code quality.
Review Aspects (optional): "$ARGUMENTS"
If $ARGUMENTS contains --team, remove that flag, read references/team-mode.md, and follow that workflow instead of the standard workflow below. Pass the remaining arguments through as the team-mode arguments.
Determine Review Scope
--base <branch> flag → store as BASE_BRANCH_OVERRIDE--previous-review <path> flag → store as PREVIOUS_REVIEW_PATH and remove it and its value from the aspect list. Reject the flag if the path is missing, points to a directory, or cannot be read. Do not silently fall back to REVIEW_OVERVIEW.md when an explicit previous-review path is invalid.--inline flag → set INLINE_MODE=true and remove it from the aspect list--team flag → use Team Mode and remove it from the aspect list--parallel appears anywhere in $ARGUMENTS → set LAUNCH_MODE=parallel and remove it from the aspect list. Default is LAUNCH_MODE=sequential.parallel appears anywhere in $ARGUMENTS → set LAUNCH_MODE=parallel, remove it from the aspect list, and treat it as a deprecated alias for --parallel.--emphasize <dim>... flag → store dimension names in EMPHASIZED_DIMENSIONS list and remove from aspect list. Consume all tokens after --emphasize until the next -- flag, --parallel, parallel, or end of arguments. Each token must be a valid aspect name (comments, tests, errors, types, code, slop, security, performance, removal, lean, refactor, simplify). Reject --emphasize all (emphasizing everything is a no-op). Cleanup emphasis (lean, refactor, simplify) never overrides the precedence pass or the action-class normalization rule that optional cleanup stays advisory.all. If any token is not a recognized aspect, stop with an error naming the unrecognized token and listing valid aspects. Do not silently fall through to "run all applicable reviews."all, every emphasized dimension must also appear in that list. If any emphasized dimension was excluded by the user's aspect filter, stop with an error instead of re-ranking unrelated findings.all): Run all applicable reviews, including the cleanup dimensions lean, refactor, and simplify. These cleanup dimensions are lower-priority than unresolved correctness, security, error-handling, and test findings when recommendations collide; the precedence pass in Step 11 suppresses or demotes cleanup advice that would undermine an open higher-priority finding.Resolve Base Branch and Collect Review Diff
Use the shared plugin script to resolve the base branch and build the unified change scope (committed PR diff + staged + unstaged + untracked). It uses the same 3-tier strategy: explicit --base, PR target branch, then origin/HEAD/origin/main/origin/master. It runs in strict mode, so fetch failures stop the workflow with the script's stderr message.
[ -x "${CLAUDE_PLUGIN_ROOT:-}/scripts/collect-review-diff.sh" ] || {
echo "collect-review-diff.sh not found under CLAUDE_PLUGIN_ROOT — is the kramme-cc-workflow plugin installed?" >&2
exit 1
}
COLLECT_ARGS=(--strict --format json)
[ -n "${BASE_BRANCH_OVERRIDE:-}" ] && COLLECT_ARGS+=(--base "$BASE_BRANCH_OVERRIDE")
RESOLVED=$("${CLAUDE_PLUGIN_ROOT}/scripts/collect-review-diff.sh" "${COLLECT_ARGS[@]}") || {
echo "Base/diff collection failed; see the message above and stop." >&2
exit 1
}
REVIEW_DIFF_FIELDS=$(mktemp "${TMPDIR:-/tmp}/review-diff.XXXXXX") || {
echo "Could not create temporary review-diff file; stop." >&2
exit 1
}
"${CLAUDE_PLUGIN_ROOT}/scripts/collect-review-diff.sh" --decode-json \
<<< "$RESOLVED" > "$REVIEW_DIFF_FIELDS" || {
rm -f "$REVIEW_DIFF_FIELDS"
echo "Base/diff decoding failed; see the message above and stop." >&2
exit 1
}
if ! {
IFS= read -r -d '' BASE_REF \
&& IFS= read -r -d '' BASE_BRANCH \
&& IFS= read -r -d '' MERGE_BASE \
&& IFS= read -r -d '' CHANGED_FILES
} < "$REVIEW_DIFF_FIELDS"; then
rm -f "$REVIEW_DIFF_FIELDS"
echo "Decoded review-diff fields were incomplete; stop." >&2
exit 1
fi
rm -f "$REVIEW_DIFF_FIELDS"
The shared JSON decoder sets BASE_REF, BASE_BRANCH, MERGE_BASE, and newline-delimited CHANGED_FILES. Use BASE_REF/MERGE_BASE for committed diff commands and BASE_BRANCH for display or when invoking sibling review skills.
Available Review Aspects:
lean, refactor, and simplify (default)Identify Changed Files and PR Description
CHANGED_FILES set by Step 2 as the unified change scope.CHANGED_FILES is empty, stop with: No changes detected against $BASE_REF. If this is wrong, re-run with --base <branch>. Do not launch reviewers against an empty scope.PR_CONTEXT_JSON=$(gh pr view --json number,url,title,body,baseRefName,headRefName 2> /dev/null || printf '{}')
PR_CONTEXT_JSON without special-casing empty strings.PR description.Check for Previous Review Context
Determine the previous-review source:
PREVIOUS_REVIEW_PATH was set in Step 1, use that exact file.REVIEW_OVERVIEW.md in the project root when it exists..context, other workspaces, or alternate filenames unless the user passed --previous-review <path>; implicit discovery beyond the project root is too likely to pick up stale review state.If a previous-review source exists:
file:line, review-scope, or PR description), issue description, resolution status, action taken, and evidence when available.- Location: field, **Location:**, and legacy **File:** labels when parsing existing entries, and normalize any of them to the same location field.Resolution status: and **Resolution status:** when present. Normalize values to one of: open, addressed, deferred, acknowledged, or skipped.Action taken: describing an implemented fix → addressedAction taken: Deferred ... or Reason deferred: → deferredAction taken: Acknowledged ... or Action taken: No action ... → acknowledgedAction taken: Skipped ... → skippedopendeferred, acknowledged, skipped, and open as not addressed. They may be carried forward if still relevant; they must not be filtered as previously addressed.--previous-review <path> that is unreadable or invalid.Previous Review Context report section.Parseable previous findings have the preferred format:
- Finding ID: CR-001- Location: path/to/file.ts:123, review-scope, or PR description**Location:** path/to/file.ts:123 and **File:** path/to/file.ts:123 should be treated the same as the structured Location field- Resolution status: open|addressed|deferred|acknowledged|skippedDetermine Applicable Reviews
Select reviewers with this taxonomy. The taxonomy applies to default all reviews; explicit aspect filters still narrow the active set to the requested dimensions.
Always-on reviewers (run for default all because they catch broad regressions across stack types):
kramme:code-reviewer — general quality, project instruction compliance, and PR-description driftkramme:silent-failure-hunter — swallowed errors, weak propagation, and misleading fallback behaviorkramme:deslop-reviewer — AI slop patterns, unnecessary defensive noise, and weak type workaroundsCross-cutting conditional reviewers (activate when the changed files or diff semantics match):
kramme:pr-test-analyzer — if test files changed, new behavior was added, or coverage claims appear in the PR descriptionkramme:comment-analyzer — if comments, docstrings, docs, or explanation-heavy inline text changedkramme:type-design-analyzer — if types, schemas, interfaces, data models, or invariants changedkramme:removal-planner — if code was deleted, deprecated, consolidated, or refactored enough that safe removal needs verificationkramme:lean-reviewer — for default all reviews or when lean is explicitly listed. It finds code the PR can avoid owning: deletions, existing-helper reuse, stdlib/native replacements, avoidable dependencies, and YAGNI abstractions.kramme:code-simplifier — for default all reviews or when refactor or simplify is explicitly listed. Record the active dimension as refactor, simplify, or both based on the requested tokens; for default all, record both. Use refactor for review-only reuse/composition/codebase-fit findings; use simplify for broader clarity and maintainability simplification suggestions.Stack-specific conditional reviewers (activate only when the touched stack has the relevant risk surface):
kramme:performance-oracle — data-heavy paths, loops over large collections, DB queries, caching, hot paths, rendering bottlenecks, or expensive client bundleskramme:injection-reviewer, kramme:auth-reviewer, kramme:data-reviewer, and kramme:logic-reviewer together.Build ACTIVE_REVIEW_DIMENSIONS from the agents that will actually run after aspect filtering and applicability checks. If any emphasized dimension has no active agent in this set, stop with an error telling the user which emphasized dimensions are inactive. Do not cap unrelated findings when the emphasized review never ran.
Launch Review Agents
Pass the resolved BASE_BRANCH, BASE_REF, MERGE_BASE, and PR context from Steps 2 and 4 to all agents so they use the correct diff scope and understand the stated intent of the change. Instruct each agent to review the same unified scope:
git diff "$MERGE_BASE"...HEADgit diff --cachedgit diffgit ls-files --others --exclude-standardPR_CONTEXT_JSON, if presentInstruct agents to use the PR description in two ways:
PR description and a concrete correction.Instruct every reviewer to apply this Codebase Calibration Rule before making a finding or recommending a fix:
NOTICED BUT NOT TOUCHING instead of making it a required finding.UNVERIFIED or CONFUSION and keep the recommendation optional.Instruct every reviewer to apply this Overengineering Check alongside the calibration rule:
advisory. Classify one as Important only when the unnecessary complexity has concrete present cost: it conceals or invites a bug, materially obscures the change under review, or creates a public surface other code must adopt.OVERENGINEERING on its own line so aggregation can apply cleanup precedence independently of the source reviewer.Instruct each spawned reviewer to label findings with the output markers documented in references/review-discipline.md (UNVERIFIED, NOTICED BUT NOT TOUCHING, CONFUSION, MISSING REQUIREMENT, OVERENGINEERING) so the aggregated report is parseable.
If any of code, refactor, or simplify is active, read references/fowler-smell-baseline.md once and pass it only to the corresponding kramme:code-reviewer and/or kramme:code-simplifier reviewers as advisory vocabulary after documented repo standards, the Codebase Calibration Rule, and concrete diff evidence. Each smell finding must name the smell, cite the changed location, explain why it matters in this diff, and recommend the smallest local fix; do not report smells as hard violations, duplicate tooling-enforced issues, or promote optional cleanup unless it creates concrete blocking impact under the action-class rules.
If lean activated kramme:lean-reviewer, instruct it to operate as a deletion-focused reviewer:
delete, stdlib, native, existing, dependency, yagni, and shrink findings.COLLIDES WITH CORRECTNESS/SECURITY, keep it advisory, and state that the higher-priority finding must be resolved first.If refactor or simplify activated kramme:code-simplifier, instruct it to operate as a review-only cleanup reviewer:
COLLIDES WITH CORRECTNESS/SECURITY, keep it advisory, and state that the higher-priority finding must be resolved first.Instruct every reviewer to return these fields for each finding:
CR-001, CR-002, ... IDs after dedupereferences/review-discipline.mdpath/to/file:line, review-scope, or PR description{0-100}. During the transition, if a reviewer returns high, medium, or low, map it before aggregation as high=80, medium=60, low=30. Remove this mapping shim once all bundled review agents emit numeric 0-100 confidence natively.gated_auto, manual, or advisory from references/review-discipline.md; Critical/Important findings may use only gated_auto or manual, while Suggestions/FYI use advisory. Treat the raw reviewer action class as provisional: the aggregator performs the final action-class normalization in Step 11.UNVERIFIEDLaunch the agents resolved in Step 6 using LAUNCH_MODE from Step 1:
LAUNCH_MODE=sequential (default): launch one agent, wait for its report, then launch the next. Use this for interactive review where each report should be readable before the next runs.LAUNCH_MODE=parallel: launch all applicable agents simultaneously and collect results together. Use this when the user passed --parallel or the deprecated bare parallel alias.Agent failure handling. If a selected reviewer agent is unavailable, times out, or returns output that cannot be parsed as findings, record the failed agent name, review dimension, and what was attempted. Continue only if at least one selected reviewer succeeded, and include a degraded-coverage banner in the final report: Coverage degraded: <agent names> failed; findings below exclude <dimensions>. If all selected reviewers fail, or if the relevance validator fails, stop without writing REVIEW_OVERVIEW.md. Do not fabricate findings or present a partial review as complete. If the slop meta-review fails after primary reviewers succeeded, continue with a degraded-coverage banner that names the failed meta-review and notes that slop warnings may be incomplete.
Validate Relevance
After collecting findings from all agents:
BASE_BRANCH, and PR_CONTEXT_JSON if presentOVERENGINEERING; the validator may only add its relevance classification and evidence before returning findings caused by this review scope.Slop Meta-Review
After relevance validation, review agent suggestions for slop:
Operate in meta-review mode. and pass the list of validated findings/suggestions as the only input -- do not pass a diff. The agent's description documents both modes; the input shape and this directive together select meta-review mode.Apply Previous Review Context
If a previous-review source was found in Step 5:
Resolution status: addressed and the current finding is essentially the same issue:
review-scope findings: both findings use location review-scopePR descriptionResolution status: open, deferred, acknowledged, or skipped still applies to the current diff:
Resolution status: open in the active finding and adding evidence that it was carried forward from the previous-review source.Previous Review Context instead of treating it as resolved.Filtered (Previously Addressed).Filtered (Previously Addressed).Previous Review Context.After validation, slop meta-review, and previous-review processing, dedupe and merge findings before applying emphasis:
manual; if the contradiction blocks approval, place it in Critical or Important based on impact.UNVERIFIED can be retained, but they must keep confidence below 60 and use manual or advisory unless the concrete risk is separately proven.Then apply the correctness/security precedence pass before emphasis:
kramme:lean-reviewer and cleanup-mode kramme:code-simplifier as cleanup-dimension findings (lean, refactor, simplify). Treat findings labeled OVERENGINEERING by any reviewer the same way.kramme:code-reviewer, kramme:silent-failure-hunter, kramme:pr-test-analyzer, kramme:type-design-analyzer, kramme:injection-reviewer, kramme:auth-reviewer, kramme:data-reviewer, and kramme:logic-reviewer as higher-priority correctness/security findings when they are still active after previous-review processing.--emphasize.gated_auto.Blocked by the matching correctness/security finding; revisit after that finding is resolved. After final IDs are assigned, reference the blocking CR-XXX in the cleanup finding's evidence.CONFUSION manual finding instead of silently choosing the cleanup path.After validation, slop meta-review, and previous-review processing, apply emphasis adjustments if EMPHASIZED_DIMENSIONS is non-empty. Only use findings from agents that actually ran in Step 7 when deciding what is emphasized vs non-emphasized.
Dimension-to-agent mapping: security → injection-reviewer, auth-reviewer, data-reviewer, logic-reviewer | errors → silent-failure-hunter | tests → pr-test-analyzer | comments → comment-analyzer | types → type-design-analyzer | code → code-reviewer | slop → deslop-reviewer | performance → performance-oracle | removal → removal-planner | lean → lean-reviewer | refactor → code-simplifier in review-only refactor-fit mode | simplify → code-simplifier
Promotion rules (per finding, based on source agent):
lean, refactor, simplify) may be promoted only provisionally. The action-class normalization pass below wins: if the cleanup finding is optional, stylistic, low-confidence, or lacks concrete merge-blocking impact, move it back to Suggestions with action class advisory.Track the count of promoted findings for the report.
After emphasis adjustments, run an action-class normalization pass. The goal is to make /kramme:pr:resolve-review receive every finding it can safely fix, while keeping genuinely human-dependent work explicit.
Action class, Owner, and any manual-follow-up fields in the report.gated_auto with owner resolver when all of these are true:
Location is a concrete path/to/file:lineConfidence is at least 70manual only when a blocker applies under the manual blocker tests in references/review-discipline.md (maintainer judgment with named competing options, uninferable missing/contradictory requirement, non-code state, cross-team/external ownership, unresolved contradiction, resource-blocked incomplete trace/UNVERIFIED, or dead-code approval). manual is the exception, not the safe default.gated_auto, but a finding matching a named blocker never fits both — a low-confidence dead-code finding stays manual until the ask is answered, while a high-confidence, fully traced dead-code finding (confidence at least 70, no remaining references, no UNVERIFIED) is gated_auto.Manual blocker: <one of the blocker categories above>Next human decision: <the specific decision, approval, access, or clarification needed>gated_auto.advisory instead of Critical/Important with manual.manual, re-test each one against the blocker list above. A manual-heavy report usually means blockers were named loosely, not that the PR needs that much human intervention.Assign stable Finding ID values to every active finding after dedupe, filtering, and emphasis are complete:
CR-001, CR-002, etc. in final report order, starting with Critical, then Important, then Suggestions./kramme:pr:resolve-review.Resolution status: open on every active finding emitted by this review. Only /kramme:pr:resolve-review or a human follow-up should change that status to addressed, deferred, acknowledged, or skipped.CR-XXX ID. Do not promote or reclassify cleanup findings during this ID reconciliation.Then summarize:
gated_auto Critical/Important findings and manual Critical/Important findings, grouped by manual blocker reasonEvery active finding must include its finding ID, location, confidence, action class, owner, resolution status, and evidence in the final report:
gated_auto — code-backed Critical/Important finding with a concrete file/line, a clear fix, and enough confidence for /kramme:pr:resolve-review to attempt it.manual — requires a named human decision, product/process judgment, PR-description update, cross-team ownership, external access, unresolved trace, or explicit approval before a fix is safe. Every manual Critical/Important finding must include Manual blocker and Next human decision. When a finding plausibly fits both gated_auto and manual, use gated_auto.advisory — optional suggestion, FYI, low-confidence observation, or quality improvement that should not block merge. Do not use this class for Critical or Important findings.PR description findings should use the same severity rules as code findings. A materially false claim that would mislead merge approval, release notes, rollback planning, or QA is Important or Critical depending on impact. Minor missing detail is at most a Suggestion and should usually be omitted.
For diffs that change a versioned artifact surface or durable public contract, a missing version/changelog/migration story is a release coordination finding, not a code fix. Use action class manual, location PR description or review-scope, and name the next human decision: intended SemVer level, changelog/release-note wording, migration guidance, or confirmation that there is no versioned consumer contract.
The recommended fix for a PR description finding is always to update the title/body to match the diff. The diff is the source of truth; the description is the suspect (PR descriptions drift, get written ahead of the final code, or are copied from earlier iterations). If a reviewer believes the code itself is wrong because it does not match the description's stated intent, raise that as a separate code-level finding with a file:line location.
Severity prefix grammar and dead-code ask shape — label every finding within each bucket using the severity prefix grammar, and emit removal-planner findings using the verbatim dead-code ask shape; both are defined in references/review-discipline.md. The section headers (## Critical Issues, ## Important Issues, ## Suggestions) remain — the prefix is the finer-grained label inside each section.
If INLINE_MODE=true:
references/output-template.md verbatimREVIEW_OVERVIEW.md/kramme:pr:resolve-review will need the user to save or paste the review content if they want to resolve it later without re-running the reviewOtherwise:
REVIEW_OVERVIEW.md in the project root, using the template in references/output-template.md/kramme:workflow-artifacts:cleanupIf eligible gated_auto Critical or Important code-backed issues were found, include a suggestion to run /kramme:pr:resolve-review to automatically address them. Manual findings must remain human follow-up in the report, with manual blockers and next decisions named. Advisory findings stay optional in the report; /kramme:pr:resolve-review applies its own safe-advisory test when deciding whether to pick one up. The template in references/output-template.md already includes the Auto-resolution Readiness, Recommended Action, and Approval Standard sections; do not omit them.
Before posting (whether to REVIEW_OVERVIEW.md or inline), run the pre-posting verification checklist in references/review-discipline.md (severity prefixes, dead-code ask shape, Approval Standard line, NOTICED BUT NOT TOUCHING labels on out-of-scope notes, emphasized-dimension coverage, UNVERIFIED labels on untraced findings).
For command examples covering default, aspect-filtered, parallel, emphasized, custom-base, and inline modes, read references/usage-examples.md. Keep argument behavior governed by Step 1 and do not treat examples as additional accepted syntax.
references/review-discipline.md holds the reviewer-craft conventions used by every spawned reviewer and by the orchestrator's final-check pass: the output markers (UNVERIFIED, NOTICED BUT NOT TOUCHING, CONFUSION, MISSING REQUIREMENT, OVERENGINEERING), the common rationalizations to watch for, the red-flag stop list, and the pre-posting verification checklist.
tools
Requires Linear MCP. Implements one Linear issue end to end, selects applicable code-review, convention, and PR-refactor gates, runs them to bounded convergence, verifies, and optionally opens the PR and iterates on CI and review feedback until green. Use when the user wants a single Linear issue taken from implementation through a clean Pull Request. Not for implementation-only work, SIW-tracked issues, stacked PRs, existing PR updates, or post-merge rollout.
development
Reviews PR and local changes for convention drift and overcaution against documented rules and mined peer-file practice. Use for new patterns, dependencies, abstractions, or defensive complexity that departs from established practice; every finding cites evidence. Supports --inline. Not for general code quality (use kramme:pr:code-review) or spec review (use kramme:siw:spec-audit --team).
testing
Charts huge or foggy initiatives into a local `.context` decision map and resolves one typed frontier ticket per session until the work is ready for SIW or another execution workflow. Use when the route to a destination cannot fit in one agent session or parallel workspaces need coordinated planning state. Not for clear specs, ordinary issue decomposition, implementation, or Linear-native tracking.
development
Investigates a question against primary sources and saves one cited Markdown artifact. Use for reading legwork: official docs/API facts, source-code or spec checks, standards, and first-party service behavior before planning or implementation. Not for making product or architecture decisions, implementing code, broad web search, secondary blog summaries, or uncited answers.