Get the FREE Ultimate OpenClaw Setup Guide →

review-pr

Scanned
npx machina-cli add skill flurdy/agent-skills/review-pr --openclaw
Files (1)
SKILL.md
5.7 KB

Review Pull Request

Comprehensively review a PR by comparing code changes against Jira ticket requirements.

Requirements

  • GitHub CLI (gh) configured
  • Jira MCP server configured (for ticket lookup)

Usage

/review-pr <PR-NUMBER>
/review-pr 5753

If no PR number provided, use the current branch's PR.

Instructions

1. Get PR Details

Fetch comprehensive PR information:

# Get PR metadata
gh pr view {PR_NUMBER} --json title,body,additions,deletions,changedFiles,files,state,author,baseRefName,headRefName

# Get the full diff
gh pr diff {PR_NUMBER}

# Get CI status
gh pr checks {PR_NUMBER}

If no PR number provided:

gh pr view --json number

2. Extract Jira Ticket (Optional)

Find the Jira ticket from (in order of preference):

  1. PR title (e.g., feat: AB-841 pii warning)
  2. PR body (e.g., Jira ticket number? AB-841)
  3. Branch name (e.g., feat/AB-841-pii-warning)

Ticket pattern: 2-4 uppercase letters, dash, numbers (e.g., AB-23, SSP-456, MAMA-89)

If no ticket found: Continue with the review without Jira comparison. Skip step 3 and 5, and note in the output that no Jira ticket was linked.

3. Fetch Jira Ticket Details (If Ticket Found)

Use the Jira MCP tools to get ticket requirements:

mcp__jira__jira_get with:
  path: /rest/api/3/issue/{ticketNumber}
  jq: "{key: key, summary: fields.summary, description: fields.description, status: fields.status.name, issuetype: fields.issuetype.name, acceptance: fields.customfield_10040}"

Parse the description to extract:

  • Overview/context
  • Acceptance criteria (look for "AC", "Acceptance Criteria", bullet points)
  • Any technical requirements

4. Analyze the Code Changes

For each changed file, understand:

  • What was added/modified/deleted
  • Whether changes align with ticket requirements

For large diffs, save to a file and read in chunks if needed.

Pay attention to:

  • Deleted code: Is it safe? Are there still imports/usages elsewhere?
  • New dependencies: Are they appropriate?
  • Test coverage: Are new features tested?
  • Security: Any obvious vulnerabilities?

To check if deleted code is used elsewhere:

# Search for imports of deleted modules
grep -r "from.*{deleted-module}" --include="*.ts" --include="*.tsx"
grep -r "import.*{deleted-module}" --include="*.ts" --include="*.tsx"

5. Compare PR Against Jira ACs (If Ticket Found)

Create a checklist comparing each acceptance criterion against the implementation:

ACStatusImplementation
{AC from ticket}{pass/fail/partial}{How it's implemented or why it fails}

If no ticket found: Skip this step. The review will focus on code quality, CI status, and potential concerns without AC validation.

6. Check CI Status

Summarize the CI status:

  • All checks passing?
  • Any failures or warnings?

7. Identify Concerns

Flag any issues:

  • Scope creep: Changes not related to the ticket
  • Missing ACs: Requirements not implemented
  • Deleted code: Large deletions that might break things
  • Missing tests: New features without test coverage
  • Security: Potential vulnerabilities
  • Breaking changes: API changes, removed exports

8. Produce Review Summary

Output a structured review:

## PR #{number} Review

**Title:** {title}
**Jira:** {ticket} - {summary}  (or "No Jira ticket linked" if none found)
**Status:** {CI status}

### Changes Overview
- {additions} additions, {deletions} deletions across {changedFiles} files
- {Brief summary of what changed}

### AC Checklist (if Jira ticket found)
| AC | Status | Implementation |
|----|--------|----------------|
| ... | ... | ... |

### Concerns
- {List any concerns or none}
- {If no Jira ticket: flag "No Jira ticket linked - cannot verify requirements"}

### Verdict
{Safe to merge / Needs changes / Needs discussion}

Example Output

## PR #5753 Review

**Title:** feat: ge-841 pii warning
**Jira:** GE-841 - FE | Unitary AI PII Instructions
**Status:** All checks passing

### Changes Overview
- 136 additions, 1528 deletions across 37 files
- Adds PII redaction instructions to file upload screens
- Removes unused IdVerification component

### AC Checklist
| AC | Status | Implementation |
|----|--------|----------------|
| Prompt users to redact PII | Pass | New `getUploadInstructionText` utility |
| Different messages for Employed/Retired/Volunteer | Pass | Three distinct messages |
| Include data-testid | Pass | `data-testid="upload-instruction-text"` |
| BLC UK only (ok for others) | Pass | Brand check in utility |
| Update request new card journey | Pass | Both screens updated |
| Cleanup is fine if nothing breaks | Pass | Deleted unused code, CI green |

### Concerns
- None. Deleted code was not exported or used externally.

### Verdict
Safe to merge. PR fully implements all acceptance criteria.

Example Output (No Jira Ticket)

## PR #5801 Review

**Title:** chore: update dependencies
**Jira:** No Jira ticket linked
**Status:** All checks passing

### Changes Overview
- 45 additions, 32 deletions across 3 files
- Updates npm dependencies to latest versions
- Updates lock file

### Code Review
- package.json: Minor version bumps for react, typescript
- No breaking changes detected
- No new dependencies added

### Concerns
- No Jira ticket linked - cannot verify against requirements
- Consider adding a ticket reference for traceability

### Verdict
Looks safe to merge. Routine dependency update with passing CI. Recommend linking a Jira ticket for audit trail.

Source

git clone https://github.com/flurdy/agent-skills/blob/main/skills/review-pr/SKILL.mdView on GitHub

Overview

This skill comprehensively reviews a pull request by comparing code changes, PR description, and CI status against linked Jira ticket requirements. It produces an AC checklist and flags concerns to ensure alignment before merging.

How This Skill Works

It gathers PR metadata via GitHub CLI, fetches the full diff and CI checks, and then attempts to extract a Jira ticket from the title, body, or branch name. If a ticket is found, it retrieves ticket details with Jira MCP, parses acceptance criteria from the description, and builds an AC checklist. Finally, it highlights concerns such as scope creep, missing tests, or security risks.

When to Use It

  • Before merging to ensure all Jira ACs are satisfied by the code changes.
  • When PR description or branch claims Jira alignment and you need formal verification.
  • If CI checks fail or warn, to correlate failures with acceptance criteria.
  • During large diffs to detect scope creep and missing tests related to the ticket.
  • When no Jira ticket is linked, still review code quality, CI status, and potential concerns.

Quick Start

  1. Step 1: Run /review-pr <PR-NUMBER> (e.g., /review-pr 5753) or on the current branch if no number is provided.
  2. Step 2: The tool fetches PR details, diff, CI status, and attempts Jira ticket lookup to parse ACs.
  3. Step 3: Review the generated AC checklist and concerns, then address findings before merging.

Best Practices

  • Always attempt to locate a Jira ticket from the PR title, body, or branch name.
  • Cross-check every code change against the ticket's acceptance criteria.
  • Review CI status and test coverage for new features or fixes.
  • Look for deleted code, new dependencies, and potential security issues.
  • Document findings clearly in the AC checklist and flag any concerns or gaps.

Example Use Cases

  • PR #5753 introduces a PII warning feature; Jira AB-841 ACs are validated and CI is green with a minor security note.
  • Refactor PR associated with SSP-456; ACs require minimal surface area and test coverage; reviewer notes partial alignment.
  • Bugfix PR addressing MAMA-89; new tests added to satisfy acceptance criteria and CI passes.
  • UI accessibility work flagged in ticket UA-303; reviewer notes missing accessibility tests and WCAG conformance checks.
  • Large deletion of deprecated utilities; Jira ticket warns about ripple effects; review highlights potential breakages and needs deeper impact analysis.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers