cmd-pr-description
Generate a PR title and description, then commit, create/update the PR on approval
What this skill does
# Quick PR Description <!-- omit in toc --> Generate a concise PR description by analyzing the diff against a base branch. Output the result in a markdown file named `PR_DESCRIPTION.md`. Copy to clipboard: `cat PR_DESCRIPTION.md | pbcopy` - [Determine Scope](#determine-scope) - [Instructions](#instructions) - [1. Determine the base branch](#1-determine-the-base-branch) - [2. Analyze the changes](#2-analyze-the-changes) - [3. Generate the title and description using the format below](#3-generate-the-title-and-description-using-the-format-below) - [4. Ask user to approve, edit, or reject](#4-ask-user-to-approve-edit-or-reject) - [5. On approval: commit, create/update PR](#5-on-approval-commit-createupdate-pr) - [Title Format](#title-format) - [Output Format](#output-format) - [Section Rules](#section-rules) - [tl;dr](#tldr) - [Summary](#summary) - [Feature Diff](#feature-diff) - [Details](#details) - [General Details](#general-details) - [Example Output](#example-output) ## Determine Scope **Default (no scope specified):** diff the current branch against the repo's base branch. Detect the base branch in order — stop at the first success: 1. `gh repo view --json defaultBranchRef -q '.defaultBranchRef.name' 2>/dev/null` 2. `git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | xargs` 3. `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'` Do **not** assume `main` or `master`. If all methods fail, ask the user. Once resolved, run: ```bash git diff <base>...HEAD -- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml" ":(exclude)package.json" ``` **If the user specifies a scope**, use the corresponding command instead: | Scope | Command | What it covers | |---|---|---| | `unstaged` | `git diff HEAD -- <excludes>` | All uncommitted changes (staged + unstaged) | | `last commit` / `last 1 commit` | `git diff HEAD~1...HEAD -- <excludes>` | Changes in the most recent commit | | `last N commits` | `git diff HEAD~N...HEAD -- <excludes>` | Changes in the last N commits | | `entire repo` | `git ls-files \| grep -vE "\.(lock\|snap)$\|package-lock\.json\|pnpm-lock\.yaml"` | All tracked source files — generate a **codebase overview description** instead of a diff-based PR description | For all diff commands, apply: `-- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml" ":(exclude)package.json"` ## Instructions ### 1. Determine the base branch **If the user passed a branch name as an argument** (e.g. `/cmd-pr-description feature-branch`), use that as `BASE_BRANCH`. Skip auto-detection entirely. **For `entire repo` scope:** skip diff analysis; use `git ls-files` and the repo's README/entry points to generate a codebase overview description. Jump directly to Step 3 with that as your source material. **Otherwise**, use the detection methods in **Determine Scope** above to set `BASE_BRANCH`. **Validation:** Verify `BASE_BRANCH` exists before proceeding: ```bash git rev-parse --verify "$BASE_BRANCH" 2>/dev/null || git rev-parse --verify "origin/$BASE_BRANCH" 2>/dev/null ``` If the branch does not exist locally or on the remote, stop and ask the user to confirm the branch name. ### 2. Analyze the changes ```bash git diff $BASE_BRANCH...HEAD --stat -- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml" ":(exclude)package.json" git log $BASE_BRANCH..HEAD --oneline ``` ### 3. Generate the title and description using the format below Generate both a **PR title** (see [Title Format](#title-format)) and the full description body (see [Output Format](#output-format)). Write the description to `PR_DESCRIPTION.md` and display both the title and description to the user. ### 4. Ask user to approve, edit, or reject Use `AskUserQuestion` to present the generated title and description. Prefix the prompt with an emoji (e.g., `⏳`, `🤔`, or `📝`) and use square-bracketed numeric option labels so the user can reply with `[1]`, `[2]`, or `[3]`: > ⏳ Please review and choose one: > > - **[1] Approve** as-is > - **[2] Request changes** (provide feedback, re-generate) > - **[3] Reject** (stop here) Do NOT proceed to step 5 until the user explicitly approves. ### 5. On approval: commit, create/update PR Once the user approves, execute the following steps in order: **Step 5a — Commit unstaged changes (if any):** ```bash git add -A && git commit -m "<generated title>" ``` If there are no unstaged/staged changes, skip this step. **Step 5b — Push the branch:** ```bash git push -u origin HEAD ``` **Step 5c — Create or update the PR:** Check if a PR already exists for the current branch: ```bash gh pr view --json number 2>/dev/null ``` If a PR exists, update it: ```bash gh pr edit --title "<generated title>" --body "$(cat PR_DESCRIPTION.md)" ``` If no PR exists, create one. Always pass `--base` so the PR targets the correct branch (especially important when the base is not the repo default): ```bash gh pr create --base "$BASE_BRANCH" --title "<generated title>" --body "$(cat PR_DESCRIPTION.md)" ``` ## Title Format PR titles must follow this format: ``` [KEYWORD] Summary ``` **Rules:** - `KEYWORD` is an uppercase word that best categorizes the PR — not a fixed list. Common examples: `FEAT`, `FEATURE`, `FIX`, `BUG`, `REFACTOR`, `TECHDEBT`, `DOCS`, `TEST`, `CHORE`, `PERF`, `PERFORMANCE`, `CI`, `BUILD`, `STYLE`, `CLI`, `CONFIG`, `MIGRATION`, `SECURITY`, `API`, `UI`, `INFRA` - Pick whichever keyword most accurately describes the PR — invent a new one if none of the above fit - `Summary` is a concise imperative phrase (e.g., "Add session-based auth", "Fix null pointer in user lookup") - Max 70 characters total - No period at the end **Examples:** - `[FEAT] Add session-based authentication` - `[FIX] Resolve race condition in queue worker` - `[REFACTOR] Simplify middleware chain` - `[DOCS] Update API reference for v2 endpoints` ## Output Format ```markdown _tl;dr Single sentence, 120 characters max, summarizing the most important outcome of this PR._ ## Summary - **Subject/topic**: < 100 character explanation - ... - ... ## Feature Diff | S | Component | Before | After | | ---- | ---------------------------------- | ------------------------------------------ | ---------------------------------------- | | 🟢/🔴/… | 1-3 words describing the component | 1 sentence describing how it worked before | 1 sentence describing how it works after | | … | ... | ... | ... | > 🔴 Critical fix · 🟡 Improvement · 🟢 New feature · ⚪ Neutral · ⚙️ Infra/tooling · ⚠️ Breaking ## Details <details> <summary>Technical Details</summary> ### Subsection Title - **Subject/topic**: < 100 character explanation - ... ### Another Subsection - **Subject/topic**: < 100 character explanation - ... </details> ``` ## GitHub Admonitions Use [GitHub admonitions](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) at the **very top** of the description (before the tl;dr) when the PR has important context that reviewers need upfront. Do NOT use admonitions by default — only when one of the situations below applies. **Syntax:** ```markdown > [!NOTE] > Useful information that users should know, even when skimming content. > [!TIP] > Helpful advice for doing things better or more easily. > [!IMPORTANT] > Key information users need to know to achieve their goal. > [!WARNING] > Urgent info that needs immediate user attention to avoid problems. > [!CAUTION] > Advises about risks or negative outcomes of certain actions. ``` **When to use each type:** | Type | When to use | |------|-------------| | `NOTE` | PR is a follow-up/review o
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.