# Create Pr

> Create a pull request with automatic Linear + Vercel integration. Links to issue, attaches preview deployment, and updates Linear status.

- **Type:** Skill
- **Install:** `agentstack add skill-imtaegan-claude-saas-flow-create-pr`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ImTaegan](https://agentstack.voostack.com/s/imtaegan)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ImTaegan](https://github.com/ImTaegan)
- **Source:** https://github.com/ImTaegan/claude-saas-flow/tree/main/skills/create-pr

## Install

```sh
agentstack add skill-imtaegan-claude-saas-flow-create-pr
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Create Pull Request with Linear + Vercel

Automates PR creation with full integration between GitHub, Linear, and Vercel.

## Instructions for Claude

### Step 0: Load Project Configuration

```bash
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
CONFIG_FILE="$PROJECT_ROOT/.claude/project.json"

if [ ! -f "$CONFIG_FILE" ]; then
  echo "❌ No project configuration found"
  echo "Run /setup-project to create one."
  exit 1
fi
```

Read the config and extract:
- `projectName`
- `linear.teamId`, `linear.projectId`
- `github.owner`, `github.repo`, `github.defaultBranch`
- `vercel.teamId`, `vercel.projectId`, `vercel.teamSlug`, `vercel.projectName`

### Step 1: Get Current Branch and Extract Issue ID

```bash
git branch --show-current
```

Expected pattern: `feature/ABC-XXX-title` or `bugfix/ABC-XXX-title`

Extract the issue ID (e.g., `ABC-11` from `feature/ABC-11-stripe-integration`).

**If no issue ID found:**
```
❌ Current branch doesn't follow naming convention.

Branch: [branch-name]

Expected: feature/ABC-XXX-description or bugfix/ABC-XXX-description

The issue ID is needed to link to Linear. Please rename your branch:
`git branch -m feature/ABC-XXX-new-name`
```

### Step 2: Fetch Issue Details from Linear

```
Use mcp__linear__get_issue with the extracted issue ID
```

Collect: issue title, description, URL, sub-issues + statuses.

**If issue not found:**
```
❌ Linear issue [ID] not found.

Make sure:
1. The issue exists in Linear
2. The branch name has the correct issue ID
```

### Step 3: Check Vercel Preview Deployment

```
Use mcp__vercel__list_deployments with:
- teamId: [from config.vercel.teamId]
- projectId: [from config.vercel.projectId]

Filter for deployments matching current branch
```

Expected URL format: `https://[config.vercel.projectName]-git-[branch-name]-[config.vercel.teamSlug].vercel.app`

**If no deployment found yet:**
```
⚠️  No Vercel preview deployment found yet.

Possible reasons:
1. You haven't pushed to GitHub yet
2. Vercel is still building
3. Vercel integration needs setup

I'll create the PR without the Vercel link, and you can add it manually.
```

### Step 4: Generate PR Title and Description

**PR Title:** Use the Linear issue title as-is.

**PR Description (parent with sub-issues):**
```markdown
## Summary
[Issue description from Linear]

## Changes
[List completed sub-issues with checkmarks]

## Sub-issues Completed
- [x] ABC-12: [sub-issue title]
- [x] ABC-13: [sub-issue title]
- [ ] ABC-14: [if not all complete]

**Progress**: X of Y sub-issues completed

## Testing
- [x] Tested on Vercel preview: [Preview URL]
- [ ] All sub-issues verified

## Linear
Issue: [Linear URL]
```

**PR Description (standalone):**
```markdown
## Summary
[Issue description from Linear]

## Changes
[Brief description of what was implemented/fixed]

## Testing
- [x] Tested on Vercel preview: [Preview URL]
- [ ] Manual testing completed

## Linear
Issue: [Linear URL]
```

### Step 5: Run Build Validation

Before creating PR, verify the build works using `buildCommand` from config (default: `npm run build`):

```bash
npm run build
```

**If build succeeds:**
```
✅ Build successful! Continuing with PR creation...
```

**If build fails:**
```
❌ Build failed! Please fix the following errors before creating PR:

[Show build error output]

Common fixes:
- Check for TypeScript errors
- Verify all imports are correct
- Make sure dependencies are installed
- Check for missing environment variables

Fix the errors, commit, push, then run /create-pr again.
```

### Step 6: Verify Git Status

```bash
git status
```

**Check:**
1. All changes are committed
2. Branch is pushed to origin

**If uncommitted changes:**
```
⚠️  You have uncommitted changes.

Commit or stash them before creating the PR:
- git add .
- git commit -m "your message"
- git push

Then run /create-pr again.
```

**If not pushed:**
```
⚠️  Branch not pushed to GitHub yet.

Push your branch:
git push -u origin [branch-name]

Then run /create-pr again.
```

### Step 7: Create the Pull Request

```bash
gh pr create \
  --title "[Generated Title]" \
  --body "[Generated Description]" \
  --base [config.github.defaultBranch]
```

**After PR creation:**
- The Linear-GitHub integration auto-links the PR to the issue
- Linear auto-moves issue to "In Review" (if configured)

### Step 8: Display Success Message

```
✅ Pull Request Created!

**PR**: [GitHub PR URL]
**Linear Issue**: [Linear URL]
**Vercel Preview**: [Preview URL]

## Next Steps:
1. Review code on GitHub: [PR URL]
2. Test on Vercel preview: [Preview URL]
3. Request review

## The PR will automatically:
- Show up in Linear issue ABC-XX
- Update issue status to "In Review"
- Deploy preview on Vercel
```

## Advanced Features

### Check if PR Already Exists

```bash
gh pr list --head [branch-name]
```

**If PR exists:**
```
ℹ️  A PR already exists for this branch:
[PR URL]

Would you like to:
1. Update the PR description
2. View the PR
3. Cancel
```

### Handle Vercel Deployment Status

**Building:**
```
🔄 Vercel is still building...

Status: BUILDING

Options:
1. Wait and I'll check again
2. Create PR now (add preview link later)
3. Cancel
```

**Failed:**
```
❌ Vercel deployment failed

Check the logs in Vercel dashboard.
Fix the build errors, then run /create-pr again.
```

### Parent Issue Completion Check

If creating PR for a parent issue, check sub-issue completion:

**Not all sub-issues done:**
```
⚠️  Not all sub-issues are complete

Completed: X of Y
Remaining:
- ABC-14: [sub-issue] (In Progress)
- ABC-15: [sub-issue] (Todo)

Are you sure you want to create the PR now?

Options:
1. Create PR anyway (for partial review)
2. Go back and finish remaining sub-issues
3. Cancel
```

## Integration Notes

**Linear ↔ GitHub:**
- PR auto-attaches to Linear issue based on branch name
- Issue status updates automatically (if configured)
- PR comments sync to Linear

**Vercel:**
- Each branch gets its own preview deployment
- Preview URL is predictable based on branch name

## Error Handling

**GitHub CLI not authenticated:**
```
❌ GitHub CLI not authenticated

Run: gh auth login
```

**No Linear API access:**
```
❌ Cannot access Linear

Check MCP server configuration for Linear access.
```

**Vercel API issues:**
```
⚠️  Cannot fetch Vercel deployment status

Creating PR without Vercel link. Add it manually to the PR description.
```

## Best Practices

1. **Always push before creating PR** — Ensures Vercel has started building
2. **Build validation is automatic** — `npm run build` runs first
3. **Wait for Vercel build** — Verify preview works before requesting review
4. **Complete all sub-issues** — For parent issues, finish all tasks first
5. **Test locally first** — Make sure code works before creating PR

## Related Skills

- **Before PR**: `/new-feature` to start work
- **Status check**: `/project-status`

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ImTaegan](https://github.com/ImTaegan)
- **Source:** [ImTaegan/claude-saas-flow](https://github.com/ImTaegan/claude-saas-flow)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-imtaegan-claude-saas-flow-create-pr
- Seller: https://agentstack.voostack.com/s/imtaegan
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
