Agent skill
creating-issues-and-pull-requests
Use when creating GitHub pull requests or issues with template compliance. Triggers: 'create a PR', 'open a pull request', 'file an issue', 'create issue', or invoked as delegate from finishing-a-development-branch Option 2. Discovers project templates, populates them from branch context, and creates via reliable gh CLI patterns.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/creating-issues-and-pull-requests
SKILL.md
Creating Issues and Pull Requests
Announce: "Using creating-issues-and-pull-requests skill to handle GitHub creation."
Invariant Principles
- Template Discovery Before Creation - Always attempt template discovery before falling back to a default body. Never skip it.
- Read Templates Yourself, Pass via
--body-file- Never rely on--templateor--fill. Read the template content, populate it, write to a temp file, pass via--body-file. - User Confirms All Side Effects - Never push, create a PR, or create an issue without explicit user approval.
- Target Repository is Never Assumed - Always confirm the merge base repo with the user (upstream or origin?).
- Branch-Relative Documentation Only - PR descriptions derive from the merge-base delta. No development history, no session narratives.
- Jira Tickets are Real or Absent - If no Jira ticket is evident from the branch name or user input, omit the prefix entirely. Never fabricate ticket numbers.
- Base Repo Templates for Fork PRs - When creating a PR from a fork, templates come from the upstream (base) repo, not the fork.
- Zero Tags By Default (Safety-Critical) - All PR titles, descriptions, and issue bodies MUST be sanitized before submission. GitHub auto-links
#Nto issues/PRs (notifying all subscribers) and@usernamepings users. A single stray#108in a PR description pings everyone subscribed to issue 108. This is treated as a SAFETY-CRITICAL concern, not a nice-to-have. The sanitization gate in the create-pr and create-issue commands enforces this. - Draft-First for Staging PRs - When creating a PR on a fork (not upstream), default to
--draft. Staging PRs exist for self-review and CI validation, not for notifying the world. Only use--draft=falsewhen the user explicitly requests a ready PR on their fork. - Fork-Then-Upstream Workflow - Support a two-stage PR workflow: (a) create draft PR on fork for self-review/CI, then (b) when ready, create the real PR on upstream. The skill must make it impossible to accidentally do step (b) when you meant step (a). When the user says "create a PR" in a fork context, always confirm which stage they're in.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
mode |
No | auto-detect | "pr" or "issue" |
branch |
No | current branch | Feature branch name |
base |
No | auto-detect | Base/target branch for PRs |
target_repo |
No | auto-detect | OWNER/REPO for the target |
jira_ticket |
No | detect from branch | Jira ticket number (e.g., ODY-1234) |
diff_summary |
No | compute | Pre-computed merge-base diff summary |
draft |
No | false | Create as draft PR |
labels |
No | none | Labels to apply |
reviewers |
No | none | Reviewers to request |
Outputs
| Output | Type | Description |
|---|---|---|
url |
string | Created PR or issue URL |
number |
int | PR or issue number |
type |
string | "pr" or "issue" |
target_repo |
string | OWNER/REPO where it was created |
Integration Contract
Called By
finishing-a-development-branch(Option 2: Push and Create PR) - Delegates PR creation with branch context.executing-plans- Indirectly, throughfinishing-a-development-branchat the end of implementation.- User directly - Via
/creating-issues-and-pull-requests, or the shorthand commands/create-prand/create-issue.
Context Passed by Callers
When invoked as a delegate from finishing-a-development-branch:
mode: "pr"
branch: <feature-branch>
base: <base-branch>
diff_summary: <pre-computed merge-base diff summary>
The skill handles everything from push confirmation through PR creation and URL reporting.
Direct Invocation
| Invocation | Behavior |
|---|---|
/creating-issues-and-pull-requests |
Mode detection, asks PR or issue |
/creating-issues-and-pull-requests --pr |
Dispatches directly to /create-pr |
/creating-issues-and-pull-requests --issue |
Dispatches directly to /create-issue |
/create-pr |
Invokes PR command directly (bypasses orchestrator) |
/create-issue |
Invokes issue command directly |
The Process
Phase 0: Mode Detection
| Signal | Detected Mode |
|---|---|
"create a PR", "open PR", caller passes mode: "pr" |
PR |
"create an issue", "file a bug", "open issue", caller passes mode: "issue" |
Issue |
| No clear signal | Ask user: "Would you like to create a PR or an issue?" |
Phase 1: Gather Context
Before dispatching, collect the context that commands need:
- Current branch:
git branch --show-current - Remote configuration:
git remote -v - Fork detection:
gh repo view --json isFork,parent - Jira ticket detection: Scan the branch name for patterns like
ODY-XXXXorelijahr/ODY-XXXX
Pass all gathered context to the appropriate command.
Phase 1.5: Safety Pre-Check
Before dispatching, determine the workflow stage and draft mode:
-
Fork detection: Check if the repo has both a fork remote (
origin) and an upstream remote (upstream).- If only one remote exists, skip to Phase 2 with
workflow_stage: "direct".
- If only one remote exists, skip to Phase 2 with
-
If fork detected: Ask the user:
"You have a fork and upstream configured. Are you staging this on your fork first, or submitting directly to upstream?"
-
Set workflow variables based on response:
| User Response | workflow_stage |
draft_mode |
Target Remote |
|---|---|---|---|
| Staging on fork | fork_staging |
true (forced) |
Fork (origin) |
| Submitting to upstream | upstream_submit |
User's preference | Upstream (upstream) |
| Single remote (no fork) | direct |
User's preference | Default remote |
-
Fork staging behavior:
- Force
--draftby default. The user must explicitly pass--draft=falseto override. - Set the target to the fork remote.
- Force
-
Upstream submit confirmation:
Do not proceed without a clear "yes" from the user. </CRITICAL>
- Pass forward: Provide
workflow_stageanddraft_modeto Phase 2.
Phase 2: Dispatch
For PR creation:
Dispatch subagent with command: /create-pr
Provide context: branch name, base branch, target repo (if known), jira ticket (if detected), diff summary (if pre-computed), draft flag, labels, reviewers, workflow_stage, draft_mode.
- If
workflow_stageisfork_staging, pass--draftunless the user explicitly overrode it. - If
workflow_stageisupstream_submit, pass the confirmed target repo and the user's draft preference. - If
workflow_stageisdirect, pass context as before (no fork-specific overrides).
For issue creation:
Dispatch subagent with command: /create-issue
Provide context: target repo (if known), labels, workflow_stage.
- If
workflow_stageisfork_stagingorupstream_submit, ensure the issue is created on the correct target repo matching the workflow stage.
Phase 3: Report Result
Report the created URL back to the user and to any calling skill.
Template Discovery Overview
Both commands implement a 4-tier template discovery cascade. This section provides the high-level algorithm; commands contain the full implementation details.
PR Template Discovery
| Tier | Source | Method | Applies When |
|---|---|---|---|
| 1 | Local filesystem | Scan .github/, root, docs/ for pull_request_template.md and PULL_REQUEST_TEMPLATE/ directories |
Same-repo PRs only |
| 2 | Remote (target repo) | GraphQL repository.pullRequestTemplates |
Always (primary source for fork PRs) |
| 3 | Org-level .github repo |
GraphQL against ORG/.github |
Fallback when target repo has no templates |
| 4 | No template found | Use sensible default body structure | Final fallback |
Issue Template Discovery
| Tier | Source | Method |
|---|---|---|
| 1 | Local filesystem | Scan .github/ISSUE_TEMPLATE/ for .md and .yml files, parse config.yml |
| 2 | Remote (target repo) | GraphQL repository.issueTemplates |
| 3 | Org-level .github repo |
GraphQL against ORG/.github |
| 4 | Legacy / No template | Check root issue_template.md; if nothing found, use blank issue (if allowed) |
Multiple Templates
When multiple templates are discovered at any tier, present a chooser listing filenames and descriptions. Let the user select.
All-or-Nothing Override
If the target repo has ANY template of a given type (PR or issue), ALL org-level templates of that type are blocked. There is no merging or layering between repo-level and org-level templates.
Naming Conventions
| Condition | PR Title | Branch Name |
|---|---|---|
| Jira ticket exists | [ODY-XXXX] <description> |
elijahr/ODY-XXXX |
| No Jira ticket | <description> (plain, no prefix) |
elijahr/<descriptive-slug> |
Post-Creation Operations
Since gh pr edit is broken (GitHub Projects Classic deprecation), use the REST API for any post-creation modifications:
# Update PR title or body
gh api repos/OWNER/REPO/pulls/NUMBER --method PATCH \
-f title="New title" -f body="New body"
# Add labels
gh api repos/OWNER/REPO/issues/NUMBER/labels --method POST \
-f 'labels[]=label1'
# Request reviewers
gh api repos/OWNER/REPO/pulls/NUMBER/requested_reviewers --method POST \
-f 'reviewers[]=username'
Self-Check
IF ANY unchecked: STOP and fix.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?