PR Creator Skill
You are a developer preparing changes for review. Your job is to commit changes, create a PR, monitor CI, fix any failures, and notify the user when the PR is ready for merge.
Process
Step 1: Check Git Status
Run these commands to understand the current state:
git status
git diff --stat
git log --oneline -5
Verify before proceeding:
- There are changes to commit (staged or unstaged)
- You're on a feature branch (not main/master) OR need to create one
- The branch is not already ahead with unpushed commits that have a PR
If no changes exist:
- Inform the user: "No changes detected. Nothing to commit."
- Stop here.
Step 2: Create Branch (if needed)
If currently on main/master:
git checkout -b <descriptive-branch-name>
Branch naming convention:
feat/short-descriptionfor featuresfix/short-descriptionfor bug fixesrefactor/short-descriptionfor refactoringdocs/short-descriptionfor documentation
Step 3: Stage and Commit Changes
# Stage all changes
git add -A
# Review what's staged
git diff --cached --stat
# Create commit with descriptive message
git commit -m "$(cat <<'EOF'
<type>: <short summary>
<optional longer description>
EOF
)"
Commit message guidelines:
- Use conventional commits:
feat:,fix:,refactor:,docs:,test:,chore: - First line: 50 chars max, imperative mood
- Body: wrap at 72 chars, explain what and why
Step 4: Push Branch
git push -u origin <branch-name>
Step 5: Create Pull Request
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<1-3 bullet points describing what this PR does>
## Changes
<list of key changes>
## Test Plan
<how to verify this works>
EOF
)"
Capture the PR URL from the output - you'll need it later.
Step 6: Monitor CI
Wait for CI to start, then monitor:
# List workflow runs for this PR
gh run list --branch <branch-name> --limit 5
# Watch a specific run (blocking)
gh run watch <run-id>
# Or check status without blocking
gh run view <run-id>
Poll every 30-60 seconds until CI completes.
Step 7: Handle CI Results
If CI Passes:
- STOP HERE - do not merge
- Report to user:
✅ PR is ready for review! **PR:** <url> **Branch:** <branch-name> **CI Status:** All checks passed The PR is ready to be reviewed and merged.
If CI Fails:
-
Get failure details:
gh run view <run-id> --log-failed -
Analyze the failure:
- Identify which job/step failed
- Read the error message
- Determine the fix
-
Fix the issue:
- Make necessary code changes
- Stage and commit the fix:
git add -A git commit -m "fix: <what was fixed>" git push
-
Return to Step 6 - monitor the new CI run
Repeat until CI passes.
Step 8: Final Report
When CI passes, provide a summary:
## PR Ready for Review
**PR:** [#<number> <title>](<url>)
**Branch:** `<branch-name>` → `main`
**Commits:** <count>
**CI Status:** ✅ All checks passed
### Changes Included
- <change 1>
- <change 2>
### CI Runs
- Run #1: ❌ Failed (lint errors)
- Run #2: ❌ Failed (test failures)
- Run #3: ✅ Passed
### Next Steps
1. Request review from team
2. Address any review feedback
3. Merge when approved
**Note:** This PR has NOT been merged. Please review and merge manually.
Important Rules
- NEVER merge the PR - only create it and ensure CI passes
- NEVER force push unless explicitly asked
- NEVER push to main/master directly
- Continue fixing until CI passes - don't give up after one failure
- Preserve commit history - don't squash unless asked
Error Handling
Authentication issues:
gh auth status
If not authenticated, inform user to run gh auth login.
Branch conflicts:
git fetch origin main
git rebase origin/main
# or
git merge origin/main
Resolve conflicts if any, then continue.
PR already exists:
gh pr view --web
Inform user a PR already exists for this branch.
CI Debugging Tips
Common failures and fixes:
| Failure | Likely Cause | Fix |
|---------|--------------|-----|
| Lint errors | Code style violations | Run npm run lint -- --fix or equivalent |
| Type errors | TypeScript issues | Fix type annotations |
| Test failures | Broken tests | Fix tests or update snapshots |
| Build failures | Compilation errors | Fix syntax/import errors |
| Timeout | Slow tests | Optimize or increase timeout |
Read the logs carefully - the error message usually tells you exactly what's wrong.