home / skills / lambda-curry / devagent / pr-review-integration

pr-review-integration skill

/.cursor/skills/pr-review-integration

This skill helps you validate PRs against Linear requirements by integrating GitHub and Linear MCP to produce actionable reviews.

npx playbooks add skill lambda-curry/devagent --skill pr-review-integration

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
4.4 KB
---
name: PR Review Integration
description: >-
  Review pull requests by integrating GitHub operations with Linear issue
  tracking. Use when: (1) Validating PR changes against Linear issue
  requirements, (2) Checking if PR addresses all acceptance criteria from Linear
  issues, (3) Creating comprehensive PR reviews that link code changes to
  project requirements, (4) Identifying gaps between PR changes and issue
  requirements, or (5) Posting review findings to both GitHub PRs and Linear
  issues. Combines GitHub CLI operations with Linear MCP functions for end-to-end
  PR review workflows.
---

# PR Review Integration

Review pull requests by integrating GitHub operations with Linear issue tracking. Validate code changes against project requirements and provide comprehensive reviews.

## Prerequisites

- GitHub CLI (`gh`) installed and authenticated
- Linear MCP server configured and available
- Access to both GitHub repository and Linear workspace

## Complete PR Review Workflow

### Step 1: Extract Context from PR

Get PR details:
```bash
gh pr view <pr-number> --json title,body,author,state,baseRefName,headRefName
```

Get changed files:
```bash
gh pr view <pr-number> --json files --jq '.files[].path'
```

Get PR diff:
```bash
gh pr diff <pr-number>
```

Extract Linear issue references:
```bash
gh pr view <pr-number> --json body --jq '.body' | grep -oE 'LIN-[0-9]+'
```

### Step 2: Fetch Linear Issue Requirements

Get issue details:
```typescript
mcp_Linear_get_issue({
  id: "LIN-123", // extracted from PR
  includeRelations: true // get related/blocking issues
})
```

Extract requirements from issue:
- Parse issue `description` for acceptance criteria
- Check `labels` for feature tags
- Review `comments` for additional context
- Check `relatedTo` and `blocks` for dependencies

### Step 3: Analyze PR Changes

Review code changes:
```bash
gh pr diff <pr-number>
gh pr diff <pr-number> -- path/to/file
gh pr view <pr-number> --json files --jq '.files[] | "\(.path): +\(.additions) -\(.deletions)"'
```

Check PR status:
```bash
gh pr checks <pr-number>
gh pr view <pr-number> --json mergeable,mergeStateStatus
```

### Step 4: Validate Against Requirements

Compare PR changes to issue requirements:

1. **Check Feature Completeness:**
   - Does PR implement all acceptance criteria?
   - Are all required features present?
   - Are edge cases handled?

2. **Check Code Quality:**
   - Follows project standards (AGENTS.md, Cursor rules)
   - Proper error handling
   - Tests included (if required)
   - Documentation updated

3. **Check Dependencies:**
   - Related issues addressed?
   - Blocking issues resolved?
   - Integration points considered?

4. **Identify Gaps:**
   - Missing requirements
   - Incomplete implementations
   - Additional work needed

### Step 5: Document Review Findings

**Option A: GitHub PR Comment**
```bash
gh pr comment <pr-number> --body "
## PR Review Summary

### ✅ Requirements Met
- [Requirement 1] - Implemented in [file]
- [Requirement 2] - Complete

### ⚠️ Gaps Identified
- [Gap 1] - Missing from issue LIN-123
- [Gap 2] - Needs additional work

### 📝 Code Quality
- Follows project standards
- [Additional notes]

### 🔗 Related Issues
- LIN-123 (main issue)
- LIN-124 (related)
"
```

**Option B: Linear Issue Comment**
```typescript
mcp_Linear_create_comment({
  issueId: "LIN-123",
  body: `
## PR Review: #${prNumber}

### Status: ${reviewStatus}

### Requirements Coverage
${requirementsChecklist}

### Code Quality
${qualityNotes}

### Next Steps
${nextSteps}
  `
})
```

**Option C: Update Linear Issue**
```typescript
mcp_Linear_update_issue({
  id: "LIN-123",
  state: "In Review", // or appropriate status
})
```

## Best Practices

1. **Always link PRs to Linear issues** for traceability
2. **Extract issue IDs early** to fetch requirements
3. **Validate against requirements first**, then code quality
4. **Document gaps clearly** with specific file/line references
5. **Update Linear issues** with review findings
6. **Use consistent review format** for readability
7. **Handle edge cases gracefully** (no issue, multiple issues, etc.)

## Reference Documentation

- **Review Patterns**: See [patterns.md](references/patterns.md) for detailed patterns, edge cases, and checklist templates
- **GitHub CLI Operations**: `.codex/skills/github-cli-operations/SKILL.md` - GitHub CLI patterns
- **Linear MCP Integration**: `.codex/skills/linear-mcp-integration/SKILL.md` - Linear MCP functions

Overview

This skill automates end-to-end PR reviews by tying GitHub pull request data to Linear issue requirements. It validates PR changes against acceptance criteria, identifies gaps, and posts review findings back to both GitHub and Linear. Use it to keep code changes aligned with project requirements and to maintain traceability between code and issues.

How this skill works

The skill extracts PR context using GitHub CLI commands (title, body, changed files, diffs, checks) and parses the PR for Linear issue references. It fetches Linear issue details via the Linear MCP functions to obtain acceptance criteria, labels, comments, and related/dependent issues. The tool compares PR changes to the extracted requirements, evaluates code quality and tests, then generates a structured review that can be posted as a GitHub PR comment and/or a Linear issue comment or update.

When to use it

  • Validating that a PR implements all acceptance criteria from a Linear issue
  • Checking for missing requirements or incomplete implementation before merging
  • Linking code changes to Linear issues for audit and traceability
  • Posting consolidated review findings to both GitHub PR and the corresponding Linear issue
  • Assessing dependencies and blocking issues related to the PR

Best practices

  • Always extract Linear issue IDs from the PR body or branch name as an early step
  • Validate requirements coverage before performing detailed code-style checks
  • Include file and line references when documenting gaps to make fixes actionable
  • Keep a consistent review format so automated comments are easy to scan
  • Update Linear issue state and comments to reflect review status and next steps
  • Handle cases with multiple or missing issue links explicitly in the review

Example use cases

  • A reviewer runs the workflow to confirm a feature branch satisfies all acceptance criteria and posts the summary to the PR and Linear ticket
  • A release engineer checks that multiple dependent issues referenced in a PR are resolved before approving merge
  • An automated CI job generates a requirements-coverage report and posts it as a comment on the PR
  • Product managers receive a Linear comment summarizing missing acceptance items and next steps after code review

FAQ

What prerequisites are required to run this review workflow?

You need GitHub CLI authenticated for the repo, access to the Linear workspace, and a configured Linear MCP endpoint or client.

How does the skill find which Linear issue a PR targets?

It scans the PR body (and optionally branch names) for Linear issue IDs, then uses those IDs to fetch issue details and acceptance criteria.