PR Test Plan
Generate a manual test plan for the changes in the current branch. The plan covers what a developer or reviewer needs to manually verify: real user flows, integration behavior, and observable outcomes.
Instructions
Step 1: Detect base branch
Try these methods in order without clobbering an earlier success:
BASE_BRANCH=$(gh repo view --json defaultBranchRef -q '.defaultBranchRef.name' 2>/dev/null)
[ -n "$BASE_BRANCH" ] || BASE_BRANCH=$(git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | xargs)
[ -n "$BASE_BRANCH" ] || BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
If all fail, ask the user. Fetch and resolve BASE_REF, preferring origin/$BASE_BRANCH, and ask the user if neither ref exists:
git fetch origin "$BASE_BRANCH" 2>/dev/null || true
BASE_REF=""
if git rev-parse --verify "origin/$BASE_BRANCH" >/dev/null 2>&1; then
BASE_REF="origin/$BASE_BRANCH"
elif git rev-parse --verify "$BASE_BRANCH" >/dev/null 2>&1; then
BASE_REF="$BASE_BRANCH"
fiStep 2: Gather change context
Run all of these and capture the results (excluding lockfiles from --stat so generated churn does not drown the real changes):
git diff "$BASE_REF"...HEAD --name-only
git diff "$BASE_REF"...HEAD --stat -- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml"
git log "$BASE_REF"..HEAD --onelineStep 3: Detect project tooling
Check what’s available in the project so you can reference real commands (not generic guesses):
- Task runner targets:
make help, or the targets inMakefile,justfile, orTaskfile.yml - Package manager: Look for
pyproject.toml(uv/pip),package.json(npm/pnpm),Cargo.toml(cargo),go.mod(go) - Test runners: Look for
pytest.ini,pyproject.toml [tool.pytest],jest.config.*,.mocharc.* - Project docs: Read
AGENTS.md,CONTRIBUTING.md, orREADME.mdfor project-specific test/build instructions - CI config: Check
.github/workflows/,Makefile, orTaskfile.ymlfor existing test commands
Prefer the project’s task runner targets and documented commands over raw tool invocations. If the project defines a test-unit target, use it instead of calling the test runner directly.
Step 4: Categorize changes and confirm with user
Group changed files into categories. Common categories (adapt based on actual changes):
- Feature code – new commands, API routes, services, UI components
- Configuration / docs – config files, markdown, schemas, manifests
- Tests – new or modified test files
- Build / deploy – Makefiles, CI, Dockerfiles, scripts
- Deletions – removed files or deprecated code
Present the detected categories to the user with a summary of what changed in each. Ask them to confirm or adjust before generating the full plan.
Example confirmation format:
I found 3 change areas in this branch:
1. Export command -- new --format flag on the export command (2 source files)
2. Docs restructuring -- README rewrite, new reference docs, deleted shell scripts
3. Test fixes -- E2E test stability improvements (4 test files)
Should I generate the test plan for all 3, or would you like to adjust?Step 5: Generate the test plan
For each confirmed category, write one test section. Read plan-format.md first and apply all of it: severity markers, step formatting, what to include and what to leave to unit tests, the closing quick smoke test, and style.
Step 6: Write output
- Write the plan to
TEST_PLAN.mdin the repo root, or to a path the user names. It is a review artifact: leave it uncommitted and say so in the summary. - Print a summary to the terminal showing the section count and a one-liner per section.
Terminal summary format:
Wrote TEST_PLAN.md (uncommitted) with 4 sections:
1. Export Command -- 4 test steps (🔴×2, 🟢×1, 🔵×1)
2. Docs Restructuring -- 3 test steps (🔴×1, 🟢×2)
3. Automated Tests -- 2 test steps (🟢×2)
4. Quick Smoke Test -- 3 commands