Pr draft

From forcedotcom/salesforcedx-vscode · View interactive version

Pr draft is an AI agent skill from the GitHub repository forcedotcom/salesforcedx-vscode. Draft PRs with trailing " - W-XXXXXXXX" in titles, conventional commit-style before it, GUS refs in body. Use when drafting PRs, PR titles, PR descriptions, opening PRs, or Git2Gus workflows.

How to use this skill

Skill file

PR Draft

Draft PR titles and bodies per salesforcedx-vscode conventions. Requires a Gus work item number.

Work item

Confirmation required: Never create or update work items without explicit user confirmation. Present proposed fields (Subject, Epic, Details, etc.) and wait for user to approve before any sf data create record or sf data update record.

Safety never use --no-verify

  1. If branch name contains W-XXXXX, confirm it exists in GUS, resembles the work done on the branch, and use that
  2. Else ask: "Do you have a Gus work item (W-XXXXX) for this PR?"
  3. If yes → try to find it using gus-cli/SKILL.md. Confirm with the user that you got it right, or ask them to choose if several could be right.
  4. If no → offer to create via Gus. Follow gus-cli/SKILL.md. Before creating: show user Subject, Epic, Details, assignee. Ask: "Create this work item?" Do not run sf data create record until user says yes. If user declines creation and still wants to proceed with the PR, include [skip-validate-pr] in the PR body.
  5. Before creating PR: inspect gh pr view --json headRefName,baseRefName,url 2>/dev/null || true, git config --get "branch.$(git branch --show-current).github-pr-base-branch", and gh stack view. If the PR base or stored base is neither develop nor main, use gh stack push; otherwise use git push -u origin $(git branch --show-current). Never push to develop/main.
  6. After PR created: update work item Details__c with PR link. Query current Details__c, append "\nPR: <url>" (or prepend if empty). Before updating: show user the new Details__c. Ask: "Update work item with PR link?" Do not run sf data update record until user says yes.
  7. After PR created: offer Ready for Review. If the user opts in, run the reviewer-pick → WI update → GitHub reassignment → Slack ping handoff in review-handoff.md.

Target branch

Stacked PRs

Treat a branch whose PR base or stored github-pr-base-branch is neither develop nor main as stacked.

Title format

type(scope): description - W-XXXXXXXX

GitHub issues & discussions

Before finalizing body, fetch and analyze:

  1. Issues: gh issue list --state open --limit 200 --json number,title,body,comments
  2. Discussions: gh api graphql — fetch all open discussions (title, number, url, body)
  3. LLM relevance pass: read PR diff/commits + all issue/discussion titles+bodies; identify candidates
  4. Auto-include any issue where a comment contains the PR's W-XXXXX (e.g. W-12345) — no prompt needed; Git2Gus already established the link
  5. Show remaining candidates (issues and discussions the LLM flagged as related); ask user which to include
  6. Stripped-href anchors in WI Details__c: SF empties external hrefs on save (the why + stored forms live in gus-cli), leaving <a href="">discussions/NNN</a> — text survives, href empty. Scan Details__c for such anchors with discussions/NNN|issues/NNN text, EXCLUDE anchors with a populated real href, and auto-include the reconstructed https://github.com/forcedotcom/salesforcedx-vscode/<path> URL — no prompt.
  7. Format: issues as #<number>, discussions as full URL — both in the "What issues does this PR fix or reference?" section

Body format

### What issues does this PR fix or reference?
#<GitHub Issue>, @W-XXXXX@
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.