validate-pr-playbook
БесплатноБез исполняемых скриптовНе проверен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.
от athola★ 358 звёзд на GitHubОб этом скилле
validate-pr: Diff-Derived Test Plan
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-prStep 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 minorwith only formatting or doc changes (no logic changed)- No diff available (clean branch, nothing changed)
--skip-validatepassed 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):
RUST_FILES=$(echo "$CHANGED" | rg '\.rs$|Cargo\.(toml|lock)$' || true)
PY_FILES=$(echo "$CHANGED" | rg '\.py$|pyproject\.toml$|requirements.*\.txt$' || true)
SH_FILES=$(echo "$CHANGED" | rg '\.sh$|\.githooks' || true)
GRAMMAR_FILES=$(echo "$CHANGED" | rg '\.(lark|peg|g4)$' || true)
Area routing table:
| Area | File patterns | Verification type |
|---|---|---|
| Rust | *.rs, Cargo.toml, Cargo.lock |
cargo build + per-crate test |
| Python | *.py, pyproject.toml |
pytest per changed module |
| Shell | *.sh, .githooks/* |
shellcheck |
| Grammar | *.lark, *.peg, *.g4 |
language-specific lint |
| Build/config | *.yaml, *.json, *.toml |
parse check |
Step 2: Generate and Execute Steps per Area
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 module
for 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
fi
done
# 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
Build/config parse check
# YAML files
for YML in $(echo "$CHANGED" | rg '\.ya?ml$' || true); do
-f "$YML" && python3 -c "import yaml; yaml.safe_load(open('$YML'))" \
&& echo "PASS: $YML" || echo "FAIL: $YML"
done
# JSON files
for JSON_F in $(echo "$CHANGED" | rg '\.json$' || true); do
-f "$JSON_F" && python3 -m json.tool "$JSON_F" > /dev/null \
&& echo "PASS: $JSON_F" || echo "FAIL: $JSON_F"
done
Step 3: Revert-Test Quality Check
Prove each behavior-changing hunk has a test that guards it. Two passes, cheap first.
Pass 1: run every new or changed test, not one representative, against the merge base. A worktree keeps the working tree out of it:
DEFAULT=$(git symbolic-ref --short refs/remotes/origin/HEAD)
BASE=$(git merge-base "$DEFAULT" HEAD)
WT=$(mktemp -d)
git worktree add -q "$WT" "$BASE"
# copy each added or modified test file from HEAD into the worktree
git diff --name-only --diff-filter=AM "$BASE" HEAD \
| grep -E '(^|/)tests?/|test_[^/]*$|_test\.[a-z]+$' \
| while read -r f; do mkdir -p "$WT/$(dirname "$f")"; git show "HEAD:$f" > "$WT/$f"; done
# run those tests in "$WT", then remove the worktree
git worktree remove --force "$WT"
A test of behavior that existed at the base, and passes there in a
commit that changes that behavior, is a FAIL row: it cannot tell the
old code from the new. A refactor commit is exempt, since its tests are
meant to pass on both. This pass says nothing about a test of new code,
which errors on the base, or about a Rust #[cfg(test)] module inside a
changed file, which cannot be copied there. Pass 2 covers both.
Pass 2: revert each behavior-changing hunk. One at a time, put the
hunk back to its base text, run the tests that cover the file, and
restore. A hunk whose revert leaves every test green has no guard: a
FAIL row. That is what a deleted check or a validator no test reaches
looks like. When there are
Установить validate-pr-playbook в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл validate-pr-playbook?
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.
Как установить скилл validate-pr-playbook?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл validate-pr-playbook запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic