Use this skill when you need to open or update a GitHub pull request for the current branch, filling the repository's PR template from the actual branch changes and, when possible, from the linked GitHub issue.
-
Resolve inputs. Determine target_branch from the arguments, defaulting to release.
-
Read the PR template. It always lives at .github/PULL_REQUEST_TEMPLATE.md in this repository — read it directly, no discovery needed. If it is somehow missing, build a sensible default description structure from the changes.
-
Infer the PR type from the branch name. Map the branch prefix to the PR <type>:
| Branch prefix | PR title <type> |
|---|
feat/ | feat |
fix/ | fix |
docs/ | docs |
chore/ | chore |
refactor/ | refactor |
If the PR type cannot be inferred with confidence, ask the user before proceeding.
-
Discover the related GitHub issue.
- Look for a number in the branch name (for example
466 in feat/466/category-type-accumulation).
- If none, inspect the commits on this branch that are not on
target_branch (git log <target_branch>..HEAD) for a (#<number>) token — this repository's commit convention is <type>(#<number>): <description> (for example feat(#466): ...).
- If still none, ask the user whether the change relates to a GitHub issue. If the user confirms there is none, proceed in issue-less mode (see step 7).
-
Gather change context. Inspect the branch changes against target_branch (for example git diff <target_branch>...HEAD and git log <target_branch>..HEAD) to understand what the pull request introduces, and to determine which parts of the codebase were touched (for the scope labels in step 9).
-
Enrich the description (issue conditional).
- If an issue number was found, fetch it — prefer a GitHub MCP tool (for example
get_issue); otherwise gh issue view <number> --json title,body — and use its title/body together with the diff to write an accurate change description.
- If no issue was found, or it cannot be read, derive the description from the branch changes only.
- In both cases, ask the user any clarifying questions about the changes or intent before showing the preview.
-
Build the title and description. <type> is one of feat, fix, docs, chore, refactor.
- The title must follow the pattern
<type>: Title (conventional-commit style, matching this repository's own commit messages).
- Fill the template sections (
Description, Agreement) from the issue and the diff. Leave the Agreement checkboxes unchecked for the user to confirm themselves.
- When an issue number was found, add a
closes #<number> line following the template's "Closing issues" convention. In issue-less mode, omit it.
-
Show a mandatory preview. Present the full title and description and ask for explicit confirmation before any create or update call. When updating an existing pull request, make clear which content will be replaced, and preserve any manually added sections not covered by the template rather than overwriting them.
-
Determine labels from the actual changes. This repository uses these labels (match the strings exactly, including the space after the colon):
- Type:
type: bug (branch prefix fix//bug/, or fix(...) commits) or type: feature (branch prefix feat/). For other prefixes, do not force type: bug/type: feature; ask the user if a type label should be applied (for example type: task).
- Scope, one or more depending on which files changed in the diff:
scope: code — functional code under packages/*/src.
scope: tests — test files (test/, *.spec.*, *.test.*).
scope: documentation — docs/website content and *.md files.
- Other existing labels (
scope: dependencies, scope: CI-CD, scope: refactor) may also apply — use them when the diff matches.
-
Prefer GitHub MCP tools. Use GitHub MCP tools for all supported operations (for example create_pull_request, update_pull_request, get_issue). Fall back to gh CLI or REST only for operations MCP does not support.
-
Create or update the pull request. Check whether a pull request already exists for the current branch. If one exists, update it and leave its existing draft/ready state unchanged (never promote or demote it). Otherwise create a new pull request targeting target_branch, explicitly setting draft: true so it starts in draft state; do not switch a newly created pull request to ready for review.
-
Label and assign. Apply the labels determined in step 9 (adding to, not replacing, any labels already present on an existing PR unless they conflict, e.g. a stale type label). On creation, assign the pull request to the authenticated user; on update, keep the existing assignee (do not reassign).
-
Report. Respond to the user with the pull request URL.
Include assumptions, risks, and follow-ups when relevant.