Generates and self-executes a diff-derived test plan for a PR. Use when validating PR changes before merge. Do not use for code review; use sanctum:pr-review.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Generates and self-executes a diff-derived test plan for a PR. Use when validating PR changes before merge. Do not use for code review; use sanctum:pr-review.
Generate and self-execute a validation plan matched to what actually changed
in a PR. Replaces generic "tests pass" with area-targeted evidence and
revert-test quality checks that prove tests catch regressions.
When To Use
End of /fix-pr Step 5 (Validate), before Step 6 (Complete)
Standalone after any PR fix, to generate targeted validation evidence
When you need proof that revert-tests are genuine guards
When NOT To Use
--scope minor with only formatting or doc changes (no logic changed)
No diff available (clean branch, nothing changed)
--skip-validate passed to /fix-pr
Algorithm
fetch diff -> group by area -> generate steps -> execute -> revert-test -> table
Step 1: Fetch Diff and Detect Areas
# Get changed file list from the PR
PR_NUMBER=<number from invocation or current branch>
CHANGED=$(gh pr diff "$PR_NUMBER" --name-only)
# Fallback when no PR number:# CHANGED=$(git diff "origin/$(git rev-parse --abbrev-ref HEAD@{upstream})...HEAD" \# --name-only 2>/dev/null)
Group changed files into areas using ripgrep (grep if rg unavailable):
For each non-empty area, generate and run at least one verification step.
Assign [E1], [E2], ... labels to each captured output.
Rust
# Build with default features
cargo build --workspace 2>&1
# Evidence: [En] → "0 errors, 0 warnings"# Build with --all-features
cargo build --workspace --all-features 2>&1
# Evidence: [En+1]# Per-crate test for each changed crate# Extract crate directory from changed path, e.g. crates/token-types/src/lib.rs
CHANGED_CRATES=$(echo"$RUST_FILES" \
| rg -o '(?:crates|src)/[^/]+' \
| sort -u \
| xargs -I{} basename {})
for CRATE in$CHANGED_CRATES; do
cargo test -p "$CRATE" 2>&1
done
Python
# Targeted test per changed modulefor PY_FILE in$PY_FILES; do
MODULE=$(basename"${PY_FILE%.py}")
TEST_FILE="tests/test_${MODULE}.py"if [[ -f "$TEST_FILE" ]]; then
uv run pytest "$TEST_FILE" -v 2>&1
fidone# Or project-specific runner if Makefile target exists
make test 2>&1 || uv run pytest tests/ -v 2>&1
Shell
for SH_FILE in$SH_FILES; do
[[ -f "$SH_FILE" ]] && shellcheck "$SH_FILE" 2>&1
done
Prove at least one test is a genuine guard, not a dead assertion.
Safety: abort if the working tree has uncommitted changes.
if ! git diff --exit-code > /dev/null 2>&1; thenecho"[RT] SKIP: working tree dirty: revert-test unsafe"# Mark INCONCLUSIVE and continuefi
Algorithm (one representative fix):
From the changed source files, find one that has a corresponding test.
Rust: a #[test] in the same crate that exercises a changed function.
Python: tests/test_<module>.py for a changed <module>.py.
Shell: a test harness that invokes the changed script.
Identify the specific changed line or block from the diff.
Edit that line to revert the fix to its broken state.
Run the targeted test: confirm it FAILS with exit code 1
specifically. A pytest usage error (4) or an empty collection (5)
is also non-zero, so a harness that only checks "not zero" reports a
dead assertion as a genuine guard.
Restore: git checkout -- <file> (git-based restore, safe on interrupt).
Run the targeted test again: confirm it PASSES.
If any step cannot complete, mark INCONCLUSIVE with the reason.
Content tests assert on prose, and this repo wraps prose at 80 columns,
so any anchor phrase long enough to be meaningful eventually straddles a
line break. Collapse whitespace before matching. Otherwise a pure reflow
turns the test red and tempts an author to "fix" it by unwrapping the
line.
Normalizing reintroduces the hazard the revert test exists to catch: a
rejoined anchor can also appear elsewhere in the file, so deleting the
paragraph the test guards leaves it green. Anchor on a full clause that
is unique to that paragraph, then delete the paragraph and confirm the
test goes red. A DDD paradigm test passed its revert check this way in
PR #612 while guarding nothing.
When no covering test exists:
Revert-test: INCONCLUSIVE: no covering test for <changed area>
Recommendation: add a test for <changed function or behaviour>
Step 4: Final Full-Suite Run
After all area checks and the revert-test:
# Rust workspace
cargo test --workspace 2>&1
# Python project
uv run pytest tests/ -v 2>&1
# Mixed project: run both
cargo test --workspace 2>&1 && uv run pytest tests/ -v 2>&1