Create GitHub pull requests in NASA-PDS repositories with auto-detection of repo/branch, issue linking, reviewer assignment, and label management. Use when user requests to create, open, submit, or make a pull request, PR, merge request, or says "create a PR", "open a PR", "make a PR", "submit a PR", "push a PR", or any variation of creating a pull request in PDS repositories.
This skill creates GitHub pull requests in NASA-PDS repositories with intelligent defaults, automatic issue linking, and consistent formatting following PDS conventions.
gh) must be installed and authenticatedAuto-detect Repository and Branch:
# Get current repository
git remote get-url origin 2>/dev/null || git remote get-url upstream 2>/dev/null
# Get current branch
git branch --show-current
# Check if branch has commits ahead of base
git rev-list --count origin/main..HEAD 2>/dev/null || git rev-list --count upstream/main..HEAD 2>/dev/null
Edge Cases:
origin is a fork (personal namespace), use upstream for the base repositoryDetermine Base Branch:
# Check common base branch names
git branch -r | grep -E 'origin/(main|master|develop)' | head -1
Default to main, but ask user to confirm if uncertain.
Determine PR Type:
Use the AskUserQuestion tool to ask what type of PR this is:
enhancement)bug)bug, p.must-have)refactor)documentation)chore)Gather Required Information:
Ask the user for:
PR Title (if not auto-generated from commits)
Related Issues (strongly recommended)
gh issue list --repo NASA-PDS/<repo> --search "<keywords>" --limit 10
#123 (current repo)NASA-PDS/repo#456 (cross-repo)https://github.com/NASA-PDS/repo/issues/789Closes #123, Closes #456Description (what changed and why)
git log origin/main..HEAD --pretty=format:"- %s" --reverse
Reviewers (optional but recommended)
gh api repos/NASA-PDS/<repo>/contributors --jq '.[].login' | head -10
.github/CODEOWNERS if existsBreaking Changes (critical to identify)
Use Cached NASA-PDS PR Template:
Use the cached official NASA-PDS PR template from resources/templates/pull_request_template.md. If the template is not cached, run the caching script first:
cd creating-pds-pull-requests
node scripts/cache-pr-template.mjs
The cached template includes:
Template Refresh:
node scripts/cache-pr-template.mjs --forceresources/templates/pull_request_template.mdFill Template Sections:
PR Title (not in body, but critical)
🗒️ Summary Section
git log origin/<base-branch>..HEAD --pretty=format:"- %s" --reverse
🤖 AI Assistance Disclosure (REQUIRED)
⚙️ Test Data and/or Report (REQUIRED)
♻️ Related Issues
Fixes #123 or Resolves #456 for auto-close on mergeFixes NASA-PDS/repo#789Refs #101🤓 Reviewer Checklist
Customize Based on PR Type:
Security and Privacy - CRITICAL:
Push Branch (if needed):
# Check if branch is pushed
git branch -r | grep "origin/$(git branch --show-current)"
# If not pushed, push with upstream tracking
git push -u origin $(git branch --show-current)
Create PR with gh CLI:
# Save PR body to temporary file
cat > /tmp/pr-body.md << 'EOF'
<PR body content here>
EOF
# Create PR
gh pr create \
--repo NASA-PDS/<repo> \
--base <base-branch> \
--head <head-branch> \
--title "<PR title>" \
--body-file /tmp/pr-body.md \
--label "<label1>,<label2>" \
--reviewer "<reviewer1>,<reviewer2>" \
--assignee "@me"
# Clean up
rm /tmp/pr-body.md
Labels to Apply:
Based on PR type:
enhancement, requirementbugbug, p.must-have, hotfixbreaking-change, backwards-incompatibledocumentationrefactorsecurityAdditional Labels (conditional):
wip or create as draft PRquestion, discussionVerify Creation:
# Get PR URL and number
gh pr view --repo NASA-PDS/<repo> --json number,url,title
# Display to user
echo "✅ Pull request created successfully!"
echo "📍 URL: <pr-url>"
echo "🔢 Number: #<pr-number>"
Link to Issues (if not auto-linked):
If using Closes #123 syntax in PR body, GitHub auto-links. Otherwise, manually link:
# Add comment linking to issue
gh pr comment <pr-number> --repo NASA-PDS/<repo> --body "Related to #<issue-number>"
Draft PR Option:
If user indicates work-in-progress:
gh pr create --draft <other-options>
Mark as Ready:
gh pr ready <pr-number> --repo NASA-PDS/<repo>
Encourage semantic branch names:
feature/<short-description> - New featuresbugfix/<issue-number>-<short-description> - Bug fixeshotfix/<short-description> - Urgent fixesrefactor/<component> - Refactoring workdocs/<topic> - Documentation updatesIf branch name doesn't follow convention, suggest renaming:
git branch -m <old-name> <new-branch-name>
git push origin -u <new-branch-name>
git push origin --delete <old-name>
If recent commits have poor messages, suggest amending:
# View recent commits
git log origin/main..HEAD --oneline
# Interactive rebase to improve messages
git rebase -i origin/main
Before creating PR, check for conflicts:
# Fetch latest from base branch
git fetch origin <base-branch>
# Check for conflicts
git merge-base --is-ancestor origin/<base-branch> HEAD || echo "May have conflicts"
# Suggest rebasing if behind
git log HEAD..origin/<base-branch> --oneline | wc -l
If conflicts likely, suggest rebasing first:
git fetch origin <base-branch>
git rebase origin/<base-branch>
git push --force-with-lease origin $(git branch --show-current)
If PR has many commits or changed files:
# Count commits
git rev-list --count origin/<base-branch>..HEAD
# Count changed files
git diff --name-only origin/<base-branch>..HEAD | wc -l
If > 20 files or > 10 commits, suggest:
For changes affecting multiple PDS repositories:
Check if PR template exists in repo:
# Check for PR template
gh api repos/NASA-PDS/<repo>/contents/.github/PULL_REQUEST_TEMPLATE.md 2>/dev/null
If found, use it. Otherwise, use the standard PDS template above.
User: "Create a PR to fix the validation error I just committed"
Actions:
1. Detect repo: NASA-PDS/validate
2. Detect branch: bugfix/123-validation-error
3. Auto-generate title from commit: "Fix NullPointerException in TableValidator"
4. Search for related issue: #123
5. Create PR with bug fix template, linking to #123
6. Apply labels: bug
7. Assign to user
User: "Open a PR for the new authentication API"
Actions:
1. Detect repo: NASA-PDS/registry-api
2. Detect branch: feature/oauth-authentication
3. Ask for title: "Add OAuth 2.0 authentication support"
4. Ask about breaking changes: "Yes - removes basic auth"
5. Request migration guide from user
6. Create PR with breaking change warnings
7. Apply labels: enhancement, breaking-change, backwards-incompatible
8. Request reviewers
User: "Create a draft PR for my work so far"
Actions:
1. Detect current state
2. Ask: "This will be a draft PR - work in progress?"
3. Create draft PR with --draft flag
4. Add label: wip
5. Note: "Mark as ready when complete using: gh pr ready <number>"
Before creating PR, verify:
Issue: "gh: command not found"
Solution: Install GitHub CLI: brew install gh (macOS) or see https://cli.github.com
Issue: "gh: not authenticated"
Solution: Run gh auth login and follow prompts
Issue: "Permission denied" Solution: User needs write access to repository - check org membership
Issue: "No commits ahead of base" Solution: User needs to commit changes first - offer to help with commit
Issue: "Branch already has a PR" Solution: Ask if user wants to update existing PR or create new branch
Issue: "Conflicts with base branch"
Solution: Suggest rebasing: git rebase origin/<base-branch>
Note: This skill focuses on creating PRs. For generating release notes from merged PRs, use the generating-release-notes skill. For creating issues, use the creating-pds-issues skill.