generate-pr-description
Generate PR Description
Generate a concise pull request description by analyzing git changes and using the project's PR template.
Language: Always generate PR titles and descriptions in English, regardless of the user's language or the language of commit messages.
Workflow
-
Identify parent branch
- Check current branch:
git rev-parse --abbrev-ref HEAD - Determine parent (usually
mainormaster):git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//' - Or use:
git merge-base HEAD mainto find common ancestor
- Check current branch:
-
Analyze changes
- Get diff stats:
git diff --stat <parent-branch>..HEAD - Get commit messages:
git log --oneline <parent-branch>..HEAD - Get file changes:
git diff --name-status <parent-branch>..HEAD
- Get diff stats:
-
Generate semantic commit title
- Analyze changes to determine type:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, no logic change)refactor:- Code refactoringperf:- Performance improvementstest:- Adding or updating testschore:- Maintenance tasks (deps, config, etc.)
- Format:
<type>(<scope>): <short description> - Keep title under 72 characters
- Analyze changes to determine type:
-
Load PR template
- Check for
.github/pull_request_template.mdfirst - If not found, check
.gitlab/merge_request_template.md - If still not found, use the template in this skill:
templates/pull_request_template.md(relative to the skill directory) - Read the template file
- Check for
-
Build the change hierarchy — follow these rules strictly
Step A — Extract raw changes List every meaningful change from the diff and commit log (files modified, features added, bugs fixed, etc.). Do not group yet.
Step B — Group into themes Assign each raw change to a theme. A theme maps to a functional area or concern, for example:
Auth,API,UI,Tests,Config,Docs,DB,CI. One change belongs to exactly one theme. Use at most 6 themes; merge minor themes into the closest major one.Step C — Decide the hierarchy level for each theme Apply the rule below to each theme independently:
Number of distinct sub-changes in the theme Structure to use 1 (single, simple change) Level-1 bullet only — no sub-bullets 2 or more distinct sub-changes Level-1 bullet (theme label) + one Level-2 sub-bullet per distinct sub-change A "distinct sub-change" is a change that affects a different component, file group, or behavior within the same theme. Two commits that both touch the same component count as one sub-change.
Step D — Write the bullets
- Level-1:
- **ThemeLabel:** one-line summary of what changed in this theme. - Level-2 (when applicable):
- Sub-change description (one line). - Never nest deeper than Level-2.
- Never duplicate information between a Level-1 line and its Level-2 children: the Level-1 line states the theme + overall impact; Level-2 lines state the individual sub-changes.
Step E — Validate before writing Re-read your draft and check:
- No theme appears more than once at Level-1.
- Every Level-2 bullet belongs to a different component/behavior within its theme.
- No sub-change is repeated across different themes.
- Themes with only one sub-change have no Level-2 bullets.
- Level-1:
-
Fill template
- Use the hierarchy built in step 5 for the "Changes Description" section.
- Keep each bullet point brief (one line when possible).
- Use emojis sparingly (🚧 for WIP, ✅ for done, etc.).
- Mark checklist items appropriately:
- Documentation: check the box if the PR introduces documentation (JSDoc in changed files, or markdown files
.mddetected in the diff). - Tests: check the box if the PR adds or updates unit tests. Detect test changes using common conventions: file names matching
*.test.*or*.spec.*, or paths undertest/,__tests__/,tests/, or similar directories.
- Documentation: check the box if the PR introduces documentation (JSDoc in changed files, or markdown files
- Leave "Screen capture(s)" as 🚫 if not applicable.
-
Related tickets
- Ticket IDs source: The user may provide ticket IDs in their request (e.g. "generate PR description, tickets: NN-123, TB-456"). If none were given, ask the user: "Ticket IDs for this PR (comma-separated, e.g.
PROJ-123, PROJ-456). Leave empty if none." - Parsing: Accept ticket IDs in forms like
tickets: NN-123, TB-456or inline (e.g.NN-123,TB-456). Normalize to a trimmed list. - If one or more IDs are available:
- Tasks manager base URL: Run from the project root:
node <skill-dir>/scripts/tasks-system.mjs. Useconfigs.tasksManagerSystemBaseUrlfor the base URL. - Build each link:
{baseUrl}/{ID} - Fill "Related Issue(s)" with:
- [Description or ID]({baseUrl}/{ID})
- Tasks manager base URL: Run from the project root:
- If none, keep "Related Issue(s)" as
- 🚫.
- Ticket IDs source: The user may provide ticket IDs in their request (e.g. "generate PR description, tickets: NN-123, TB-456"). If none were given, ask the user: "Ticket IDs for this PR (comma-separated, e.g.
-
Enforce 1000 character limit
- Count total characters including markdown syntax.
- If over limit, apply in order:
- Keep the title.
- Keep all Level-1 theme bullets.
- Shorten or remove Level-2 sub-bullets starting from the least critical theme.
- Condense remaining lines.
-
Write file, copy to clipboard, remove file
- At PR project root, create or overwrite
pr-description.mdwith the full PR output. - Call:
node <skill-dir>/scripts/copy-to-clipboard.mjs "<full-path-to-pr-description.md>" - On success: remove the file and tell the user: "The full PR description is in the clipboard; you can paste it into your PR."
- On error: leave
pr-description.mdin place and tell the user they can open it or copy manually.
- At PR project root, create or overwrite
Output Format
## PR Description
<semantic-commit-style-title>
<filled-template-markdown>
Extended Example
Scenario: Branch feature/checkout-flow — changes span payment service, cart UI, discount API, tests, and docs.
Raw changes identified (Step A):
PaymentService: added Stripe integrationPaymentService: added retry logic on failureCartSummarycomponent: shows discount badgeCartSummarycomponent: fixed item count bugDiscountAPI: new/applyendpointauth.test.ts: added login edge-case testscheckout.test.ts: added checkout flow testsREADME.md: updated setup instructions
Themes after grouping (Step B):
- Payment → Stripe integration + retry logic (2 sub-changes → Level-2)
- Cart UI → discount badge + item count fix (2 sub-changes → Level-2)
- API →
/applyendpoint (1 sub-change → Level-1 only) - Tests → auth + checkout test files (2 sub-changes → Level-2)
- Docs → README update (1 sub-change → Level-1 only)
Output:
## Changes Description
feat(checkout): implement checkout flow with Stripe and discounts
- **Payment:** Stripe integration with fault tolerance.
- Stripe payment provider added.
- Retry logic on failed transactions.
- **Cart UI:** visual and functional improvements.
- Discount badge displayed in cart summary.
- Fixed incorrect item count display.
- **API:** `/apply` discount endpoint added.
- **Tests:** coverage for auth and checkout flows.
- Login edge-case tests (`auth.test.ts`).
- End-to-end checkout flow tests (`checkout.test.ts`).
- **Docs:** README setup instructions updated.
## Checklist
- [x] Tests added or updated
- [x] Documentation updated
More from lichens-innovation/ai-dev-tools
react-coding-standards
Enforces internal React and TypeScript coding standards using avoid/prefer rules. Use when reviewing or refactoring React/TS code, applying company standards, or when the user asks to align code with coding standards.
23react-single-responsibility
Strategies to simplify components, hooks, and methods: decomposition order (utilities, hooks, sub-components), early returns, control flow, parameter design, and code smell fixes. Use when the user says: ungodify this method/function/component, simplify this method/function/component, make this method/function/component less complex; or when refactoring a large component, hook, or function, reducing complexity, applying single responsibility, or asking how to simplify a component, hook, or method.
19review-staged-changes
Reviews staged git changes for code quality, maintainability, readability, and potential regressions. Verifies changes make sense in context, improve maintainability, enhance readability, and don't introduce side effects. Use when reviewing staged changes, examining git diffs, or when the user asks to review modifications before committing.
14react-files-structure-standards
Enforces file and folder naming and structure standards for React/TypeScript projects. Use when normalizing file/folder names, auditing project structure, renaming files or directories, or when the user asks to align file/folder naming with standards.
13react-linter-setup
Sets up ESLint for React and TypeScript projects aligned with company standards. Use when installing or configuring the project linter, adding devDependencies, custom ESLint rules, package.json scripts, or when the user asks to set up or migrate to the company React/TypeScript ESLint stack.
12review-code-changes
Reviews code changes for quality, maintainability, readability, and potential regressions. Supports reviewing explicitly mentioned files, git staged files, or changes between branches. Verifies changes make sense in context, improve maintainability, enhance readability, and don't introduce side effects. Use when reviewing code changes, examining git diffs, reviewing staged changes, comparing branches, or when the user asks to review modifications.
3