kramme-cc-workflow/skills/kramme:pr:generate-description/SKILL.md
Write a structured PR title and body from git diff, commit log, and Linear context. Outputs markdown for copy-paste or, when explicitly invoked with --auto, updates an existing PR.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:pr:generate-descriptionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Parse $ARGUMENTS for flags:
--auto: Preferred hands-off mode for explicit user invocation. Skip clarification prompts (Phase 2.5) and the save-to-file prompt (Phase 4). If a PR already exists for the current branch, update its title/body directly. If no PR exists yet, generate the title and description for copy-paste without pausing for user input.--visual: Auto-detect a running dev server and capture screenshots to embed in the PR description. Requires an available browser automation capability; if none is available, continue with the placeholder Screenshots/Videos section.--base <ref>: Use <ref> as the base branch for diff computation instead of auto-detecting.If --auto is present, set AUTO_MODE=true and NON_INTERACTIVE=true, and remove the flag from remaining arguments. If --visual is present, set VISUAL_MODE=true and remove the flag from remaining arguments. If --base <ref> is present, set BASE_BRANCH_OVERRIDE=<ref> and remove the flag and value from remaining arguments.
Use this skill when:
When NOT to use this skill:
High-quality PR descriptions are essential for:
This skill automates the process of gathering context from multiple sources (git history, Linear issues, code changes) and generating a structured, focused description following best practices for Pull Requests.
Read the guideline keyword glossary from references/guideline-keywords.md.
ALWAYS confirm the current branch:
git branch --show-current
ALWAYS detect and identify the base/target branch dynamically using a 3-tier strategy:
Tier 1: Explicit override If BASE_BRANCH_OVERRIDE was set from --base, use that value directly.
Tier 2: PR target branch detection
BASE_BRANCH=$(gh pr view --json baseRefName --jq '.baseRefName' 2> /dev/null)
Tier 3: Fallback
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2> /dev/null | sed 's@^refs/remotes/origin/@@')
[ -z "$BASE_BRANCH" ] && BASE_BRANCH=$(git branch -r | grep -E 'origin/(main|master)$' | head -1 | sed 's@.*origin/@@')
Normalize before using origin/$BASE_BRANCH:
BASE_BRANCH=${BASE_BRANCH#refs/heads/}
BASE_BRANCH=${BASE_BRANCH#refs/remotes/origin/}
BASE_BRANCH=${BASE_BRANCH#origin/}
if [ -z "$BASE_BRANCH" ]; then
echo "Error: Could not determine base branch. Re-run with --base <ref>." >&2
exit 1
fi
if ! git check-ref-format --branch "$BASE_BRANCH" > /dev/null 2>&1; then
echo "Error: Base branch '$BASE_BRANCH' is not a valid branch name. Re-run with --base <ref>." >&2
exit 1
fi
if ! git fetch origin "refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH}" 2> /dev/null; then
echo "Error: Failed to fetch origin/$BASE_BRANCH. Check remote access and re-run with --base <ref>." >&2
exit 1
fi
if ! git rev-parse --verify --quiet "origin/$BASE_BRANCH" > /dev/null; then
echo "Error: Base branch 'origin/$BASE_BRANCH' not found. Re-run with --base <ref>." >&2
exit 1
fi
echo "Base branch: $BASE_BRANCH"
If AUTO_MODE=true, check whether a PR exists for the current branch:
gh pr view --json number,url
If a PR exists, set DIRECT_UPDATE=true and capture the PR URL for Phase 4.
If no PR exists, continue in generated-output mode:
NON_INTERACTIVE=true if auto mode is enabledDIRECT_UPDATE=falseRead the context-gathering procedure from references/context-gathering.md and apply every step in that document before continuing. It covers:
origin/$BASE_BRANCH, file categorization, optional GitHub tool use.Skip this phase entirely if NON_INTERACTIVE=true. Proceed directly to Phase 3.
ALWAYS pause after gathering context and before generating the description:
Present initial analysis:
Ask clarification questions:
Example clarification prompt:
I've analyzed the changes and identified this as a [type] that [brief summary].
Key decisions I found:
- [Decision 1]
- [Decision 2]
Divergences from Linear issue (if any):
- [Divergence 1 and why]
- [Divergence 2 and why]
Before generating the description:
- Is there anything specific you'd like me to emphasize or explain in detail?
- Are there any concerns, limitations, or trade-offs reviewers should be aware of?
- Should I highlight any particular aspects of the implementation?
- Should I explain any divergences from the original Linear issue in more detail?
Wait for user response before proceeding to Phase 3
Skip this phase if VISUAL_MODE is not set. Proceed directly to Phase 3.
If VISUAL_MODE=true, read references/visual-capture.md and follow Phase 2.6 in that document to detect an available browser automation capability and discover the running dev server URL.
Before drafting, evaluate whether any MISSING REQUIREMENT conditions hold (see the Output markers section below). Emit a MISSING REQUIREMENT: … line in the skill's conversation output whenever:
Surface the marker even when NON_INTERACTIVE=true; do not prompt the user, but make the gap visible in the run output so it appears alongside the generated description.
If any blocking missing requirement is present, set DIRECT_UPDATE=false even when --auto found an existing PR. Continue by generating copy-paste output so the user can supply the missing context before publication. Do not publish a PR body that invents migration rationale, rollback plans, or rollout context.
(Phase 1 already aborts hard when the base branch cannot be resolved, so there is no Phase 3 trigger for that case.)
ALWAYS generate a structured PR title and description after that check.
Generate a PR title using Conventional Commits format: <type>(<scope>): <description>
Types (based on Phase 2.4 analysis):
| feat | fix | refactor | docs | test | build/ci | chore | perf | style | revert |
Rules:
auth, platform-picker). Omit if changes span multiple areas.Examples: feat(auth): add OAuth2 support · fix: resolve null pointer in user lookup · refactor(api): extract validation utilities
ALWAYS include:
What changed (1-2 sentences, high-level, user/business-focused)
Why it changed (1-2 sentences, business context)
Link to Linear issue (if available):
Fixes, Closes, Resolves (marks issue as done when PR merges)Related to, Refs, References (links without auto-closing)Format options:
Fixes WAN-521
or
Closes https://linear.app/consensusaps/issue/WAN-521/title
or (for related but not closing):
Related to WAN-521
Fixes or Closes when the PR completes the work for the issueRelated to when the PR is partial work or tangentially relatedRead the section templates and worked examples from assets/section-templates.md. It covers Summary, Technical Details (implementation approach, scope changes, optional area notes, reviewer landmarks), Test Plan, and Breaking Changes — each with structural guidance and a complete example.
When drafting the Test Plan, make it a reviewer/QA execution plan first:
npm test, lint, typecheck, build, etc.) for the manual steps needed to validate the PR.### Automated verification as optional evidence, not a transcript of local commands.### Automated verification when it would only repeat routine checks already covered by CI, such as format, lint, typecheck, build, or the normal unit-test suite.### Automated verification subsection after the scenarios when they add PR-specific signal beyond CI, such as a targeted regression command not run by CI, a migration dry-run, a local smoke test requiring seeded data, or visual capture verification.### Automated verification (for example, "No unit-test target exists"). If the missing target creates a real coverage risk, surface it in ### Potential concerns or the Manual QA rationale; otherwise omit it.### Manual QA with a concrete reason and the closest reviewer-run validation path, then list automated verification separately.Before drafting the body, decide what the PR description adds beyond GitHub's review UI.
ALWAYS include context GitHub cannot infer from the diff browser:
NEVER include description content whose main value is already provided by GitHub:
git diff --stat summariesIf a section would merely prove that files changed, omit it or replace it with one or two review-relevant notes that explain behavior, coupling, risk, or review order.
Every generated PR body MUST include a "Change Summary" block immediately after the ## Summary section and before ## Technical Details. Emit these three H3s verbatim, in this order, each with concrete bullets:
### Changes made
- <verb-led statement of what moved, scoped to a feature, behavior, or implementation area>
- <one bullet per distinct change; do not lump multiple changes together>
### Things I didn't touch
- <adjacent work considered during this change and deliberately left out of scope>
- <use "None" if nothing was considered and skipped>
### Potential concerns
- <ship-risk items reviewers should know: data migrations, feature flags off by default, partial coverage, known follow-ups>
- <use "None" if nothing of note>
Rules:
add, extract, rename, remove, wire, gate).None. An empty block signals "considered and skipped", not "forgotten".If VISUAL_MODE is not set or browser/app detection failed (Phase 2.6):
Include a placeholder section for visual aids:
## Screenshots / Videos
<!-- Add screenshots or videos here to help reviewers visualize the changes -->
<!-- Consider including: -->
<!-- - Before/after UI comparisons -->
<!-- - New features in action -->
<!-- - Error states or edge cases -->
<!-- - Mobile/responsive views -->
NOTE: This is a placeholder section for the PR creator to populate with relevant visuals.
If VISUAL_MODE=true and a browser automation capability and dev server were detected:
Read references/visual-capture.md and follow Phase 3.5 to capture screenshots, prepare them for embedding or manual attachment, and build the Screenshots/Videos section.
ALWAYS format the output as clean Markdown:
[TODO] or [Fill this in]🤖 Generated with [Claude Code](https://claude.ai/code)Generated with Claude CodeCo-Authored-By: Claude or similarDIRECT_UPDATE=true: Update PR directlySkip copy-paste output and save-to-file prompt. Use this sequence to avoid both shell-interpolation and heredoc-terminator collisions in LLM-generated content:
Anchor to repo root and prepare the workspace directory. Run this bash block first:
REPO_ROOT=$(git rev-parse --show-toplevel)
BACKUP_DIR="$REPO_ROOT/.kramme-cc-workflow/pr-description"
mkdir -p "$BACKUP_DIR"
# Ensure the namespace is locally excluded so backups and saved descriptions are
# not accidentally committed. Use git's local exclude file; do not mutate tracked files.
GIT_EXCLUDE=$(git rev-parse --git-path info/exclude)
mkdir -p "$(dirname "$GIT_EXCLUDE")"
touch "$GIT_EXCLUDE"
if ! grep -qxF ".kramme-cc-workflow/" "$GIT_EXCLUDE"; then
printf '\n.kramme-cc-workflow/\n' >> "$GIT_EXCLUDE"
fi
# Snapshot the prior PR body. Real failure leaves no backup; empty backup is discarded.
PR_BACKUP="$BACKUP_DIR/pr-body.backup.$(date -u +%Y%m%dT%H%M%SZ).$$.md"
gh pr view --json body --jq '.body' > "$PR_BACKUP" 2> /dev/null
if [ ! -s "$PR_BACKUP" ]; then
PR_BACKUP=""
fi
echo "BACKUP_DIR=$BACKUP_DIR"
echo "PR_BACKUP=${PR_BACKUP:-<none>}"
Write the generated title and body to files using the runtime's file-write capability, keeping generated Markdown out of the shell parser. Targets:
$BACKUP_DIR/new-title.txt — the conventional-commit title, single line, no trailing newline.$BACKUP_DIR/new-body.md — the full description markdown.Prefer a native file-write/edit capability. If unavailable, use an equivalent safe file-write method that does not pass generated Markdown through shell interpolation or a heredoc.
Apply the edit:
gh pr edit \
--title "$(cat "$BACKUP_DIR/new-title.txt")" \
--body-file "$BACKUP_DIR/new-body.md"
"$(cat …)" substitutes the literal file contents into one argv element; gh does not re-evaluate the argument as shell.--body-file reads the body straight from disk; nothing in it flows through the shell.After updating, confirm success. Include the backup line only when a backup actually exists:
PR updated successfully.
URL: {pr-url}
Title: {title}
{when PR_BACKUP is non-empty: "Previous body backed up to: {PR_BACKUP}"}
If the update fails, fall back to presenting the description for copy-paste (same as the default flow below) and show the error.
ALWAYS present the final PR title and description in a clear, copy-paste-ready format:
Here is your generated PR:
**Title:** `<type>(<scope>): <description>`
---
[DESCRIPTION CONTENT HERE]
---
NOTE: The title is formatted with backticks for easy copying. The description follows the standard markdown format.
Skip this step if NON_INTERACTIVE=true.
After presenting the description, ask: "Would you like me to save this description to a markdown file?"
If yes, save to $REPO_ROOT/.kramme-cc-workflow/pr-description/PR_DESCRIPTION.md where REPO_ROOT=$(git rev-parse --show-toplevel). Add .kramme-cc-workflow/ to git's local exclude file first if it is not already listed (use the same idempotent check as the DIRECT_UPDATE block above), so the saved file is not accidentally committed without mutating tracked files. Confirm the absolute file path after saving.
Run the consolidated checklist in the Verification section near the end of this file. Phases 1–4 do not have their own checklist; the Verification section is the single source of truth.
Read the best practices guidelines from references/best-practices.md. Covers context gathering, writing style, technical details, and test plan rules.
Read the anti-pattern examples from references/anti-patterns.md. Includes title anti-patterns, vague-summary patterns (rejects titles like Fix bug, Fix build, Phase 1, Add convenience functions), and 6 paired WRONG/CORRECT examples covering vague summaries, missing context, missing tests, tone, hidden breaking changes, and AI attribution.
Read the complete PR examples from references/pr-examples.md. Includes 3 examples: frontend-only feature, full-stack with database migration, and frontend with visual capture (--visual).
Read the platform-specific notes from references/platform-notes.md. Covers magic words for issue linking, team abbreviations, and GitHub conventions.
--auto, an existing PR is found, and no blocking missing requirement is present, it may update that PR's title/body through gh pr edit. When saving output, it may write local files under .kramme-cc-workflow/pr-description/ and add .kramme-cc-workflow/ to git's local exclude file if missing.Use these uppercase markers when reasoning about the description generation. They do NOT appear in the final PR body — they go in the skill's conversation output so the user can track decisions.
UNVERIFIED: the migration is reversible — no down-migration present in the diff.NOTICED BUT NOT TOUCHING: a test-only rename in an adjacent file — not part of this PR's narrative.CONFUSION: commits say "add feature flag", but the diff toggles it on by default.MISSING REQUIREMENT: no Linear ID in branch name and no issue mentioned in commits — confirm the intended ticket or proceed without one.Read references/red-flags.md before finalizing. Covers common rationalizations that under-serve the reviewer and stop-and-regenerate red flags (vague summary nouns, file-list mirroring, missing migration warnings, automated-only Test Plan, spec-file references, AI-attribution badges).
Single pre-publish checklist. Run this before presenting copy-paste output, before gh pr edit, and before saving to file.
Title
<type>(<scope>): <description> with a valid type (feat, fix, refactor, docs, test, chore, perf, style, build, ci, revert).add, not added). No trailing period.Summary and Change Summary block
Fixes, Closes, Resolves, Related to, Refs, References).### Changes made lists distinct verb-led bullets — no vague verbs (update, improve) without an object.### Things I didn't touch reflects adjacent work considered and deliberately deferred (or None after consideration).### Potential concerns flags migrations, feature-flag defaults, partial coverage, and rollout risk (or None).Technical Details and Test Plan
### Automated verification is omitted unless the listed commands add signal beyond CI; missing targets are not listed as verification.None is a valid value after consideration).--visual produced embeddable remote assets, local-only table when copy-paste output can reference captured files, placeholder when capture failed or direct-update mode only has local files.Boundary, tone, and operational hygiene
siw/SPEC.md, LOG.md, etc.) or conversation history. Linear is the only external source the body may cite.Co-Authored-By: Claude lines.[TODO] / [Fill this in] strings (except the documented Screenshots placeholder).Output routing
DIRECT_UPDATE=true → no blocking missing requirements are present, then ran the Phase 4 sequence in order: repo-root anchored backup → local git exclude update → title/body files written outside shell interpolation → gh pr edit --title "$(cat …)" --body-file …. The success message includes the backup line only when the backup file is non-empty.DIRECT_UPDATE=false → presented copy-paste output; only asked about saving when NON_INTERACTIVE=false.MISSING REQUIREMENT, UNVERIFIED, CONFUSION, or NOTICED BUT NOT TOUCHING markers are emitted in the run output, not embedded in the PR body.Final conciseness pass
development
Compare an existing PR's title and body against the actual branch diff and report drift — false claims, missing major changes, stale scope, missing risk callouts. Use after pushing changes to a branch with an open PR, or before requesting review. Read-only by default; add --fix to delegate to kramme:pr:generate-description for an updated description. Complements kramme:pr:code-review (which checks description accuracy as one signal among many code-quality checks) by being a fast, focused, single-purpose check that runs in seconds.
tools
Reviews plugin skills for focused scope, progressive disclosure, portability, safety, retry behavior, and documentation quality. Use when auditing a SKILL.md, skill directory, or proposed skill text against skill-authoring standards. Not for creating new skills, editing skills, or reviewing ordinary application code.
tools
Reviews recent agent session transcripts to find repeated manual workflows or repeated user asks, then proposes and optionally scaffolds only useful new skills or custom subagents. Use when the user asks to inspect recent sessions, find automation opportunities, or create reusable workflows from repeated work. Not for summarizing one session, general retrospectives, or codebase refactoring.
data-ai
Remove all DONE issues and renumber remaining issues within each prefix group. Not for editing live issue content, archiving still-open issues, or moving issues between prefix groups.