kramme-cc-workflow/skills/kramme:pr:convention-review/SKILL.md
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).
npx skillsauth add abildtoft/kramme-cc-workflow kramme:pr:convention-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.
Review branch changes and local work for two failure modes measured against the codebase's own established practice:
Both are relative measurements: the baseline is mined from the repository itself, never from generic best practices. A finding without cited exemplar sites or a documented rule is not a finding.
Arguments: "$ARGUMENTS"
Shared protocol: Read references/baseline-mining.md before launching reviewers. It defines the evidence tiers, peer-file sampling, quorum rule, lens checklists, classification taxonomy, and finding format.
Accept only --base <branch>, --threshold N, and --inline:
--base and --threshold may each appear at most once and must be followed by a non-flag value. Store the base as BASE_BRANCH_OVERRIDE.--threshold to be a decimal integer from 0 through 100. Store it as custom_threshold; default to 80.--inline may appear at most once. Set INLINE_MODE=true when present and false otherwise.Usage: /kramme:pr:convention-review [--base <branch>] [--threshold 0-100] [--inline] and stop.references/baseline-mining.md.MERGE_BASE and the full changed-file scope are known.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.
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.
If 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.
Capture the complete review scope once before launching any reviewer. Every reviewer and the relevance validator must receive these stored payloads; they must not rerun the diff or untracked-file commands. The second capture detects a workspace change during collection and prevents a hybrid scope from being labeled immutable.
REVIEW_SCOPE_DIR=$(mktemp -d "${TMPDIR:-/tmp}/convention-review-scope.XXXXXX") || {
echo "Could not create temporary convention-review scope; stop." >&2
exit 1
}
trap 'rm -rf "$REVIEW_SCOPE_DIR"' EXIT
printf '%s' "$CHANGED_FILES" > "$REVIEW_SCOPE_DIR/changed-files.txt"
PR_CONTEXT_JSON=$(gh pr view --json title,body 2> /dev/null || printf '{}')
printf '%s\n' "$PR_CONTEXT_JSON" > "$REVIEW_SCOPE_DIR/pr-context.json"
capture_untracked_scope() {
local output_file="$1"
local list_file="$2"
local file status
git ls-files --others --exclude-standard -z > "$list_file" || return 1
: > "$output_file"
while IFS= read -r -d '' file; do
if git diff --no-index --binary -- /dev/null "$file" >> "$output_file"; then
status=0
else
status=$?
fi
[ "$status" -eq 0 ] || [ "$status" -eq 1 ] || return "$status"
done < "$list_file"
}
SCOPE_HEAD=$(git rev-parse HEAD) || exit 1
git diff --binary "$MERGE_BASE"...HEAD > "$REVIEW_SCOPE_DIR/committed.diff" || exit 1
git diff --binary --cached > "$REVIEW_SCOPE_DIR/staged.diff" || exit 1
git diff --binary > "$REVIEW_SCOPE_DIR/unstaged.diff" || exit 1
capture_untracked_scope \
"$REVIEW_SCOPE_DIR/untracked.diff" \
"$REVIEW_SCOPE_DIR/untracked-files.zlist" || exit 1
SCOPE_HEAD_CHECK=$(git rev-parse HEAD) || exit 1
git diff --binary "$MERGE_BASE"...HEAD > "$REVIEW_SCOPE_DIR/committed.check" || exit 1
git diff --binary --cached > "$REVIEW_SCOPE_DIR/staged.check" || exit 1
git diff --binary > "$REVIEW_SCOPE_DIR/unstaged.check" || exit 1
capture_untracked_scope \
"$REVIEW_SCOPE_DIR/untracked.check" \
"$REVIEW_SCOPE_DIR/untracked-files.check.zlist" || exit 1
if [ "$SCOPE_HEAD" != "$SCOPE_HEAD_CHECK" ] \
|| ! cmp -s "$REVIEW_SCOPE_DIR/committed.diff" "$REVIEW_SCOPE_DIR/committed.check" \
|| ! cmp -s "$REVIEW_SCOPE_DIR/staged.diff" "$REVIEW_SCOPE_DIR/staged.check" \
|| ! cmp -s "$REVIEW_SCOPE_DIR/unstaged.diff" "$REVIEW_SCOPE_DIR/unstaged.check" \
|| ! cmp -s "$REVIEW_SCOPE_DIR/untracked.diff" "$REVIEW_SCOPE_DIR/untracked.check" \
|| ! cmp -s "$REVIEW_SCOPE_DIR/untracked-files.zlist" "$REVIEW_SCOPE_DIR/untracked-files.check.zlist"; then
echo "Workspace changed while capturing the convention-review scope; re-run the review." >&2
exit 1
fi
After identifying the changed files, build the documented-rule baseline:
MERGE_BASE tree and current workspace (AGENTS.md, CLAUDE.md, .github/copilot-instructions.md, repo-root or nearby .claude/ markdown, and equivalents). Also discover relevant lint, formatter, and type-checker configurations.CHANGED_FILES to classify each rule or configuration path. For unchanged paths, current content may represent the merge-base version. For any added, modified, deleted, staged, unstaged, or untracked path, read the baseline version from MERGE_BASE with git show "$MERGE_BASE:$path" when it exists.If CONVENTION_REVIEW_OVERVIEW.md exists in the project root:
Resolution status, action taken, and evidence when available.open, addressed, deferred, acknowledged, or skipped. When the status is missing, infer it conservatively from Action taken: an implemented fix is addressed; an explicit deferral, acknowledgement/no-action, or skip maps to that status; otherwise treat the finding as open.addressed findings as candidates for previous-review filtering. Store open, deferred, acknowledged, and skipped findings for carry-forward revalidation in Step 8.Group CHANGED_FILES into review clusters:
Launch kramme:convention-drift-reviewer (one instance per cluster) using the platform's agent-invocation primitive with:
references/baseline-mining.md (state that it wins over the agent's built-in compact protocol)BASE_BRANCH, BASE_REF, and MERGE_BASE from Step 3$REVIEW_SCOPE_DIR/committed.diff$REVIEW_SCOPE_DIR/staged.diff$REVIEW_SCOPE_DIR/unstaged.diff$REVIEW_SCOPE_DIR/untracked-files.zlist and $REVIEW_SCOPE_DIR/untracked.diff payloads$REVIEW_SCOPE_DIR/pr-context.json — the reviewer uses it for the intentionality check, not as trusted truthDo not let reviewer instances fetch, resolve the base, recompute diffs, or reread untracked files. The stored payload is the immutable review scope.
Collect all Critical and Important findings from the reviewer instances. If there are any:
Operate in refute mode. Pass the Critical/Important findings as the only candidate findings, together with MERGE_BASE, the trusted rule baseline, proposed rule/config changes labeled as untrusted diff content, and the changed-file exclusions. Do not pass the full diff.REFUTED findings (record them for the report's refuted count), downgrade SPLIT-PRACTICE findings to Suggestions with a "codebase practice is split" note, keep CONFIRMED findings unchanged.Suggestions skip refutation, but they keep the protocol's evidence requirements.
After the refutation pass:
BASE_REF, MERGE_BASE, CHANGED_FILES, plus the exact stored committed, staged, unstaged, untracked, and PR-context payloads under $REVIEW_SCOPE_DIR.Validated findings. Filter Pre-existing and Out-of-scope findings into their corresponding report categories. Treat Likely Related findings as relevance-unconfirmed: label them UNVERIFIED, keep them out of active findings, and show them under Filtered with the validator's reason.If no separate agent runtime is available, perform the convention review, refutation pass, and relevance validation directly in the main thread. If an invoked reviewer or validator is unavailable, times out, or returns output that cannot be parsed as findings, surface the failure to the user with the agent name and what was attempted, then stop without writing CONVENTION_REVIEW_OVERVIEW.md. Do not fabricate findings or silently continue with an empty result.
If CONVENTION_REVIEW_OVERVIEW.md was found in Step 4:
Resolution status: addressed and is essentially the same issue:
open, deferred, acknowledged, or skipped finding still applies:
Resolution status: open and note that it was carried forward from the previous review.open, deferred, acknowledged, or skippedMerge findings from all reviewer instances, dedupe findings that name the same location and root cause, and assign stable IDs CONV-001, CONV-002, ... in report order. Preserve the ID of a carried-forward finding with the same root cause. Set Resolution status: open on every active finding. Organize into:
Use the finding format from references/baseline-mining.md for every active finding, including location, lens, confidence, established-practice exemplars, and minimal fix.
If INLINE_MODE=true:
CONVENTION_REVIEW_OVERVIEW.mdOtherwise:
CONVENTION_REVIEW_OVERVIEW.md in the project root/kramme:workflow-artifacts:cleanupIf Critical or Important findings were found:
INLINE_MODE=false, suggest running /kramme:pr:resolve-review; auto/local discovery will find CONVENTION_REVIEW_OVERVIEW.md and ask which overview to resolve if multiple local review files exist.INLINE_MODE=true, suggest re-running with the inline report content passed as the argument: /kramme:pr:resolve-review <paste report> — or invoke it in the same session so chat context contains the report.Organize the findings summary in the terminal output:
# Convention Review Complete
## Baseline
- {N} documented rule sources read
- {N} peer files sampled across {N} clusters
## Refutation and Relevance
- X findings confirmed, X refuted, X downgraded to split-practice
- X findings filtered (pre-existing, out-of-scope, or relevance-unconfirmed)
- X findings filtered (previously addressed)
- X non-addressed findings carried forward, X not carried forward
## Results
- Critical: X
- Important: X
- Suggestions: X
- Split practice observations: X
Report output: {inline reply | CONVENTION_REVIEW_OVERVIEW.md}
To resolve findings: `/kramme:pr:resolve-review`
Before posting the report, self-check:
NOTICED BUT NOT TOUCHING instead of appearing as a finding?Resolution status: open fields follow the format /kramme:pr:resolve-review can parse?If any answer is no, fix the report before posting.
After the report is posted or written successfully, remove $REVIEW_SCOPE_DIR; the EXIT trap remains the failure-path cleanup.
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.
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.
development
Builds a clearly throwaway logic/state or UI prototype to answer one design question before implementation hardens. Use when the user wants to sanity-check a state model, data shape, API surface, page layout, component direction, or interaction idea with disposable code. Not for production implementation, polished demos, visual diff reports, permanent routes, or broad design-system work.