본문으로 건너뛰기
cccskills
무료GitHub에 공개

validate-pr

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구GitHub
설치 방법 보기

포함된 파일(1)

  • SKILL.md8.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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-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):

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:

AreaFile patternsVerification type
Rust*.rs, Cargo.toml, Cargo.lockcargo build + per-crate test
Python*.py, pyproject.tomlpytest per changed module
Shell*.sh, .githooks/*shellcheck
Grammar*.lark, *.peg, *.g4language-specific lint
Build/config*.yaml, *.json, *.tomlparse 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 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; then
  echo "[RT] SKIP: working tree dirty: revert-test unsafe"
  # Mark INCONCLUSIVE and continue
fi

Algorithm (one representative fix):

  1. 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.
  2. Identify the specific changed line or block from the diff.
  3. Edit that line to revert the fix to its broken state.
  4. 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.
  5. Restore: git checkout -- <file> (git-based restore, safe on interrupt).
  6. Run the targeted test again: confirm it PASSES.
  7. If any step cannot complete, mark INCONCLUSIVE with the reason.

Revert-test output format:

[RT-1] Target: <file>:<line>: <description of fix>
[RT-2] Broke fix: <edit description>
[RT-3] Ran: <test command> → <test name> FAILED (expected)
[RT-4] Restored: git checkout -- <file>
[RT-5] Ran: <test command> → <test name> PASSED
Result: PASS: test is a genuine guard

Reverting a test that guards document content:

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

Capture full output as final evidence [En].

Step 5: Produce Summary Table

### validate-pr: <PR title or number>

| Area | Step | Evidence | Result |
|------|------|----------|--------|
| Rust: token-types | cargo build --workspace | [E1] 0 errors | PASS |
| Rust: token-types | cargo test -p token-types | [E2] 12 passed | PASS |
| Rust: token-types | cargo build --all-features | [E3] 0 errors | PASS |
| Shell: hooks/pre-commit | shellcheck | [E4] 0 issues | PASS |
| Revert-test: lib.rs:45 | break/fail/restore | [RT-1..5] genuine guard | PASS |
| Final: cargo test --workspace | full suite | [E5] 694 passed, 0 failed | PASS |

**Totals**: 6 steps: 6 PASS, 0 FAIL, 0 INCONCLUSIVE

Step 6: Posting (--post flag only)

When --post is given, post the summary table as a PR comment:

gh pr comment "$PR_NUMBER" --body "$(cat /tmp/validate-pr-summary.md)"

Skip posting when invoked from /fix-pr: results feed into the Gate 3 summary comment instead.

Failure Behaviour

When any step produces FAIL:

  • Surface the failures in the summary table with the evidence reference.
  • When called from /fix-pr: halt before Step 6 (Complete). The user must fix the failures or pass --skip-validate to /fix-pr to bypass.
  • When called standalone: report failures and exit with non-zero status.

INCONCLUSIVE results are reported but do not halt the workflow.

Exit Criteria

  • gh pr diff --name-only returned a non-empty file list (diff fetched)
  • Every detected area has at least one row in the summary table
  • Every row shows an Evidence reference ([E1], [E2], etc.) with the actual command output, not fabricated
  • Revert-test attempted for at least one area with a covering test, or documented as INCONCLUSIVE with reason
  • Final full-suite run appears in the summary table
  • Summary table is present with columns: Area, Step, Evidence, Result
  • Any FAIL result halts /fix-pr before Step 6 when called from fix-pr
  • Working tree is clean after skill completes (git checkout restore confirmed successful for any revert-test mutation)

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Shapes turns action-first: action leads, steps numbered, state restated. Use for ADHD-friendly output. Do not use to trim tokens; use response-compression.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

athola/claude-night-market3432026년 10월 17일 업데이트

Inverts burden of proof for code additions. Use when reviewing PRs, planning refactors, or running unbloat to challenge every addition's necessity.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

athola/claude-night-market3432026년 10월 17일 업데이트

Tracks per-agent token usage and flags waste in parallel dispatch. Use when evaluating parallel agent efficiency or after a multi-agent run.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

athola/claude-night-market3432026년 10월 17일 업데이트

Coordinates Claude agent teams via filesystem protocol. Use when orchestrating parallel agents with task dependencies. Do not use for single-agent tasks.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

athola/claude-night-market3432026년 10월 17일 업데이트

Evaluates API surface design, consistency, and exemplar alignment. Use when reviewing public API changes or before releasing a new API surface.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

athola/claude-night-market3432026년 10월 17일 업데이트

Selects architecture paradigm via research before scaffolding. Use when architecture is undecided and the choice needs justification and documentation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

athola/claude-night-market3432026년 10월 17일 업데이트

athola의 스킬 모두 보기

이 스킬의 문제 신고