Create a pull request — generate title and description from the ticket and diff, follow the repo's PR template, suggest reviewers, and link the Linear ticket.
Generate a PR with a title and description grounded in the actual diff and ticket context. Follow the repo's PR template, suggest reviewers, and link the Linear ticket.
TEAM=CDIN
LINEAR_TEAM=CDIN
LINEAR_URL_BASE=https://linear.app/klaviyo/issue
Check for uncommitted changes:
git status --porcelain
If there are uncommitted changes, warn: "You have uncommitted changes. Commit them first, or run /diff:diff-precommit."
Get the current branch and ensure it is not master/main:
git branch --show-current
Check if the branch is pushed:
git log origin/$(git branch --show-current)..HEAD --oneline 2>/dev/null || echo "NOT_PUSHED"
If not pushed or has unpushed commits:
git push -u origin $(git branch --show-current)
Check for a PR template in the repo:
REPO_ROOT=$(git rev-parse --show-toplevel)
Search for the template:
$REPO_ROOT/.github/pull_request_template.md$REPO_ROOT/.github/PULL_REQUEST_TEMPLATE.md$REPO_ROOT/docs/pull_request_template.mdRead the template if found. Follow its structure exactly — fill in each section.
If no template exists, use the default format in Step 4.
Get the full diff from base:
MERGE_BASE=$(git merge-base origin/master HEAD)
git diff $MERGE_BASE...HEAD --stat
git diff $MERGE_BASE...HEAD
Get the commit log:
git log $MERGE_BASE...HEAD --oneline
Get the ticket context (if ticket ID is known):
Tool: mcp__glean_default__chat
Question: "What are the title, description, and acceptance criteria for Linear ticket CDIN-{number}?"
For Terraform/infra PRs — check if there are .tf file changes. If yes, look for a terraform plan output. Include only the resource change summary (adds/changes/destroys), not the full plan.
{CDIN-number}: {concise description of what changes}[CDIN-{number}](https://linear.app/klaviyo/issue/CDIN-{number})If following a repo template, fill in each section. If no template, use:
## Summary
{2-3 sentences: what this PR does and why}
**Ticket:** [CDIN-{number}](https://linear.app/klaviyo/issue/CDIN-{number})
## Changes
- {Specific change 1: file path, function name, what it does}
- {Specific change 2}
- {Specific change 3}
## Non-Obvious Decisions
- {Why you chose approach X over Y}
- {Any workarounds or temporary solutions}
## Testing
- {How you tested: which test files, manual verification}
- {Test command: `pants test ...` or `make TEST=... docker-unit`}
## Rollback
- {Is this safe to revert? Any caveats?}
Use the glean-code:code-owners skill to find owners of the changed files:
Tool: Skill
Skill: glean-code:code-owners
Args: the primary module/directory that changed
Suggest 1-2 reviewers. Prefer:
Present the full PR preview:
**Title:** {title}
**Base:** master
**Reviewers:** {suggested reviewers}
---
{full PR description body}
---
Review the PR above. Confirm to create it, or suggest edits.
Wait for user confirmation. Do not create the PR until the user approves.
After confirmation:
gh pr create --title "{title}" --body "{body}" --base master
If reviewers were confirmed:
gh pr create --title "{title}" --body "{body}" --base master --reviewer "{reviewer1},{reviewer2}"
After creation, capture the PR URL and copy to clipboard:
gh pr view --json url --jq '.url' | pbcopy
Report:
PR created: {URL} (copied to clipboard) Reviewers: {reviewers} Ticket linked: CDIN-{number}