Pull Request Diff Analyzer
Analyze a git diff or PR to detect the change type and extract acceptance criteria for manual testing. Analysis only — never modify code.
Step 1: Detect Branch Context and Scope
Get the current branch:
git branch --show-current
Detect the base branch, in order:
- From PR context (preferred). If a PR number is known:
gh pr view {PR_NUMBER} --json baseRefName
baseRefName in the response is the PR's base branch.
- If the base branch cannot be detected, ask the user to specify it.
Get changed files:
git diff {BASE_BRANCH}...HEAD --name-only
For uncommitted local changes only:
git diff --name-only
For a GitHub PR with full diff view:
gh pr diff {PR_NUMBER}
Skip to Step 3 with a short summary only (no acceptance criteria) if:
- Current branch is
master, main, stable, or the detected default branch in baseRefName.
- No files changed.
- All changes are non-source-code updates:
- documentation/requirements (
*.md, docs/**)
- test updates and test docs (
*.test.md, test-flows/**, tests/e2e)
- CI/CD and infrastructure config (
.github/workflows/**, Jenkinsfile)
- lint/formatter/tooling configs
- dependency version bumps without behavior changes
- No application/source code behavior changed.
Proceed to Step 2 if source code changed (src/**, lib/**, app/**, or root .ts/.js/.tsx/.jsx/.java/.py/.go/.rb/.php/.cs/.kt/.swift/.rs, etc).
Step 2: Analyze PR Context and Files
Get PR details:
gh pr view {PR_NUMBER} --json title,body,comments,reviews,issues
Extract testing-relevant info:
- Title — feature/fix name, affected component.
- Description — criteria, test scenarios.
- Comments — test notes, edge cases, reproductions.
Analyze source code files only:
- Directories:
src/**, lib/**, app/**, controllers/**, services/**, models/**, pages/**, components/**, handlers/**, modules/**, etc.
- Extensions:
.ts, .js, .tsx, .jsx, .java, .py, .go, .rb, .php, .cs, .kt, .swift, .rs
- Skip configs, dependencies, tests, docs, migrations, and other files not related to source code.
Detect PR type:
- Feature — new files, endpoints, components, modules.
- Fix — bug fixes, patches, hotfixes (check commits for "fix", "bug", "hotfix").
- Refactor — code restructure without behavior change.
Optional: scan-automation-project
Do not run scan-automation-project by default. Run it only when extra project context adds clear value before writing acceptance criteria.
Run it if:
- The PR introduces new functionality or a significant feature change.
- You need to check whether similar manual tests already exist.
- The user explicitly asks ("check for duplicates", "what tests already exist", or similar).
Skip it if:
- The PR is a small fix or minor UI/component update.
- The diff already gives enough context to write ACs confidently.
- Changes are limited to docs, requirements, tests, configs, or non-source-code updates.
- The project does not appear to contain manual tests.
- Existing test inventory is not relevant for the requested task.
If it is unavailable:
- Continue without checking existing tests.
- Add this note to the AC output:
Manual test inventory not checked — verify existing tests manually if needed.
Use scan results only to:
- Avoid duplicating existing manual test cases.
- Understand project structure, frameworks, and test organization.
- Improve relevance and consistency of generated acceptance criteria.
Step 3: Summary with Acceptance Criteria
Output format:
## PR Diff Summary
**PR Type:** ... (feature | fix | refactor)
**Branch:** ... (branch name, e.g. feature/user-auth)
**Changes:** ... (one sentence describing the overall purpose of this PR)
**Affected Files:**
- ... (bullet list of all affected files in this PR)
**Impacted Areas:**
- ... (1-3 bullets, only real impacted files/areas in the PR)
**Acceptance Criteria:**
- action to perform → expected result
- ...
Summary rules:
- Keep the summary concise and high-level.
- "Changes" is ONE sentence. Not a paragraph.
- "Impacted Areas" lists only meaningful business or technical impact.
- Omit empty sections instead of writing
None or N/A.
- Acceptance criteria MUST be testable and user-oriented.
- Avoid generic statements like "code cleanup", "minor fixes", or "various improvements".
- Do NOT describe implementation details line-by-line.
1---2name: pull-request-diff-analyzer3description: Analyze git diff/pull request changes to detect feature implementations and fixes, extract acceptance criteria, and identify related tickets. Use this skill when the user wants to understand what changed in a PR/branch, determine if it's a feature or bug fix, and get acceptance criteria for manual test case generation.4license: MIT5---67# Pull Request Diff Analyzer89Analyze a git diff or PR to detect the change type and extract acceptance criteria for manual testing. **Analysis only** — never modify code.1011## Step 1: Detect Branch Context and Scope1213Get the current branch:1415```bash16git branch --show-current17```1819Detect the base branch, in order:20211. From PR context (preferred). If a PR number is known:2223```bash24gh pr view {PR_NUMBER} --json baseRefName25```2627`baseRefName` in the response is the PR's base branch.2829- If the base branch cannot be detected, ask the user to specify it.3031Get changed files:3233```bash34git diff {BASE_BRANCH}...HEAD --name-only35```3637For uncommitted local changes only:3839```bash40git diff --name-only41```4243For a GitHub PR with full diff view:4445```bash46gh pr diff {PR_NUMBER}47```4849**Skip to Step 3 with a short summary only (no acceptance criteria)** if:50- Current branch is `master`, `main`, `stable`, or the detected default branch in `baseRefName`.51- No files changed.52- All changes are non-source-code updates:53 - documentation/requirements (`*.md`, `docs/**`)54 - test updates and test docs (`*.test.md`, `test-flows/**`, `tests/e2e`)55 - CI/CD and infrastructure config (`.github/workflows/**`, `Jenkinsfile`)56 - lint/formatter/tooling configs57 - dependency version bumps without behavior changes58- No application/source code behavior changed.5960**Proceed to Step 2** if source code changed (`src/**`, `lib/**`, `app/**`, or root `.ts`/`.js`/`.tsx`/`.jsx`/`.java`/`.py`/`.go`/`.rb`/`.php`/`.cs`/`.kt`/`.swift`/`.rs`, etc).6162## Step 2: Analyze PR Context and Files6364Get PR details:6566```bash67gh pr view {PR_NUMBER} --json title,body,comments,reviews,issues68```6970Extract testing-relevant info:71- Title — feature/fix name, affected component.72- Description — criteria, test scenarios.73- Comments — test notes, edge cases, reproductions.7475Analyze **source code files only**:76- Directories: `src/**`, `lib/**`, `app/**`, `controllers/**`, `services/**`, `models/**`, `pages/**`, `components/**`, `handlers/**`, `modules/**`, etc.77- Extensions: `.ts`, `.js`, `.tsx`, `.jsx`, `.java`, `.py`, `.go`, `.rb`, `.php`, `.cs`, `.kt`, `.swift`, `.rs`78- Skip configs, dependencies, tests, docs, migrations, and other files not related to source code.7980Detect PR type:81- Feature — new files, endpoints, components, modules.82- Fix — bug fixes, patches, hotfixes (check commits for "fix", "bug", "hotfix").83- Refactor — code restructure without behavior change.8485### Optional: scan-automation-project8687**Do not run `scan-automation-project` by default.** Run it only when extra project context adds clear value before writing acceptance criteria.8889Run it if:90- The PR introduces new functionality or a significant feature change.91- You need to check whether similar manual tests already exist.92- The user explicitly asks ("check for duplicates", "what tests already exist", or similar).9394Skip it if:95- The PR is a small fix or minor UI/component update.96- The diff already gives enough context to write ACs confidently.97- Changes are limited to docs, requirements, tests, configs, or non-source-code updates.98- The project does not appear to contain manual tests.99- Existing test inventory is not relevant for the requested task.100101If it is unavailable:102- Continue without checking existing tests.103- Add this note to the AC output: `Manual test inventory not checked — verify existing tests manually if needed.`104105Use scan results only to:106- Avoid duplicating existing manual test cases.107- Understand project structure, frameworks, and test organization.108- Improve relevance and consistency of generated acceptance criteria.109110## Step 3: Summary with Acceptance Criteria111112Output format:113114```md115## PR Diff Summary116117**PR Type:** ... (feature | fix | refactor)118**Branch:** ... (branch name, e.g. feature/user-auth)119**Changes:** ... (one sentence describing the overall purpose of this PR)120**Affected Files:**121- ... (bullet list of all affected files in this PR)122123**Impacted Areas:**124- ... (1-3 bullets, only real impacted files/areas in the PR)125126**Acceptance Criteria:**127- action to perform → expected result128- ...129```130131Summary rules:132- Keep the summary concise and high-level.133- "Changes" is ONE sentence. Not a paragraph.134- "Impacted Areas" lists only meaningful business or technical impact.135- Omit empty sections instead of writing `None` or `N/A`.136- **Acceptance criteria MUST be testable and user-oriented.**137- Avoid generic statements like "code cleanup", "minor fixes", or "various improvements".138- Do NOT describe implementation details line-by-line.