agentleFS
axiomanticaxiomantic/spellbook/skills/creating-issues-and-pull-requests/SKILL.md

creating-issues-and-pull-requests

Skill11 starsChanged 3 months agoMITView on GitHub

Use when creating GitHub pull requests or issues with template compliance. Triggers: 'create a PR', 'open a pull request', 'file an issue', 'create issue'. Also invoked by finishing-a-development-branch. NOT for: deciding whether to merge or PR (use finishing-a-development-branch).

  • Commits and pushes

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 13 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Template Discovery Before Creation: - Always attempt template discovery before falling back to a default body.

    line 18
  2. Very specific:

    Read Templates Yourself, Pass via --body-file: - Never rely on --template or --fill.

    line 19
  3. Distinctive:

    User Confirms All Side Effects: - Never push, create a PR, or create an issue without explicit user approval.

    line 20
  4. Distinctive:

    Target Repository is Never Assumed: - Always confirm the merge base repo with the user (upstream or origin?).

    line 21
  5. Distinctive:

    Jira Tickets are Real or Absent: - If no Jira ticket is evident from the branch name or user input, omit the prefix entirely.

    line 23
  6. Distinctive:

    Base Repo Templates for Fork PRs: - When creating a PR from a fork, templates come from the upstream (base) repo, not the fork.

    line 24
  7. Very specific:

    Draft-First for Staging PRs: - When creating a PR on a fork (not upstream), default to --draft.

    line 26
  8. Very specific:

    When invoked as a delegate from finishing-a-development-branch:

    line 66
  9. Distinctive:

    Check for caller-provided mode

    line 96
  10. Distinctive:

    If ambiguous, ask the user </analysis>

    line 97
  11. Very specific:

    Fork detection: Check if the repo has both a fork remote (origin) and an upstream remote (upstream).

    line 119
  12. Very specific:

    If only one remote exists, skip to Phase 2 with workflow_stage: "direct".

    line 120
  13. Distinctive:

    If fork detected: Ask the user:

    line 122
  14. Very specific:

    If workflow_stage is upstream_submit, require explicit confirmation:

    line 138
  15. Distinctive:

    Do not proceed without a clear "yes" from the user.

    line 141
  16. Distinctive:

    When multiple templates are discovered at any tier, present a chooser listing filenames and descriptions.

    line 194
  17. Distinctive:

    If the target repo has ANY template of a given type (PR or issue), ALL org-level templates of that type are blocked.

    line 198
  18. Very specific:

    Never fabricate a Jira ticket number.

    line 210
  19. Distinctive:

    IF ANY unchecked: STOP and fix.

    line 250
  20. Distinctive:

    Every PR and issue you create is a public artifact.

    line 254

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Creating Issues and Pull Requests

<ROLE> GitHub Integration Specialist. Your reputation depends on every PR and issue respecting the project's templates, naming conventions, and workflow constraints. A PR that ignores the project's template is a public failure. A fabricated Jira ticket number is unforgivable. </ROLE>

Announce: "Using creating-issues-and-pull-requests skill to handle GitHub creation."

Invariant Principles

  1. Template Discovery Before Creation - Always attempt template discovery before falling back to a default body. Never skip it.
  2. Read Templates Yourself, Pass via --body-file - Never rely on --template or --fill. Read the template content, populate it, write to a temp file, pass via --body-file.
  3. User Confirms All Side Effects - Never push, create a PR, or create an issue without explicit user approval.
  4. Target Repository is Never Assumed - Always confirm the merge base repo with the user (upstream or origin?).
  5. Branch-Relative Documentation Only - PR descriptions derive from the merge-base delta. No development history, no session narratives.
  6. 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.
  7. Base Repo Templates for Fork PRs - When creating a PR from a fork, templates come from the upstream (base) repo, not the fork.
  8. Zero Tags By Default (Safety-Critical) - PR titles, descriptions, and issue bodies MUST be sanitized before submission. GitHub auto-links #N to issues/PRs (notifying all subscribers) and @username pings users. A stray #108 in a PR description pings everyone subscribed to issue 108. The sanitization gate in create-pr and create-issue commands enforces this.
  9. Draft-First for Staging PRs - When creating a PR on a fork (not upstream), default to --draft. Only use --draft=false when the user explicitly requests a ready PR on their fork.
  10. Fork-Then-Upstream Workflow - Support a two-stage PR workflow: (a) create draft PR on fork for self-review/CI, then (b) create the real PR on upstream. When the user says "create a PR" in a fork context, always confirm which stage they're in. The skill must make it impossible to accidentally do step (b) when you meant step (a).

Inputs

InputRequiredDefaultDescription
modeNoauto-detect"pr" or "issue"
branchNocurrent branchFeature branch name
baseNoauto-detectBase/target branch for PRs
target_repoNoauto-detectOWNER/REPO for the target
jira_ticketNodetect from branchJira ticket number (e.g., ODY-1234)
diff_summaryNocompute from merge-base diffPre-computed merge-base diff summary
draftNofalseCreate as draft PR
labelsNononeLabels to apply
reviewersNononeReviewers to request

Outputs

OutputTypeDescription
urlstringCreated PR or issue URL
numberintPR or issue number
typestring"pr" or "issue"
target_repostringOWNER/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, through finishing-a-development-branch at the end of implementation.
  • User directly - Via /creating-issues-and-pull-requests, or the shorthand commands /create-pr and /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

InvocationBehavior
/creating-issues-and-pull-requestsMode detection, asks PR or issue
/creating-issues-and-pull-requests --prDispatches directly to /create-pr
/creating-issues-and-pull-requests --issueDispatches directly to /create-issue
/create-prInvokes PR command directly (bypasses orchestrator)
/create-issueInvokes issue command directly

The Process

Phase 0: Mode Detection

<analysis> Determine what the user wants to create: - Examine the invocation arguments and user message - Check for caller-provided mode - If ambiguous, ask the user </analysis>
SignalDetected 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 signalAsk user: "Would you like to create a PR or an issue?"

Phase 1: Gather Context

Collect context that commands need:

  1. Current branch: git branch --show-current
  2. Remote configuration: git remote -v
  3. Fork detection: gh repo view --json isFork,parent
  4. Jira ticket detection: Scan the branch name for patterns like ODY-XXXX or elijahr/ODY-XXXX

Pass all gathered context to the appropriate command.

Phase 1.5: Safety Pre-Check

  1. 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".
  2. 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?"

  3. Set workflow variables based on response:
User Responseworkflow_stagedraft_modeTarget Remote
Staging on forkfork_stagingtrue (forced)Fork (origin)
Submitting to upstreamupstream_submitUser's preferenceUpstream (upstream)
Single remote (no fork)directUser's preferenceDefault remote
  1. Fork staging: Force --draft by default. The user must explicitly pass --draft=false to override.
  2. Upstream submit confirmation:
<CRITICAL> If `workflow_stage` is `upstream_submit`, require explicit confirmation: > "This will create a PR visible to the upstream maintainers. Proceed?"

Do not proceed without a clear "yes" from the user. </CRITICAL>

  1. Pass workflow_stage and draft_mode to 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.

  • fork_staging → pass --draft unless user explicitly overrode it; set target to fork remote.
  • upstream_submit → pass confirmed target repo and user's draft preference.
  • direct → pass context with no fork-specific overrides.

For issue creation: Dispatch subagent with command: /create-issue

Provide context: target repo (if known), labels, workflow_stage. Ensure issue targets the 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. If GraphQL tiers fail, fall through to Tier 4.

PR Template Discovery

TierSourceMethodApplies When
1Local filesystemScan .github/, root, docs/ for pull_request_template.md and PULL_REQUEST_TEMPLATE/ directoriesSame-repo PRs only
2Remote (target repo)GraphQL repository.pullRequestTemplatesAlways (primary source for fork PRs)
3Org-level .github repoGraphQL against ORG/.githubFallback when target repo has no templates
4No template foundUse sensible default body structureFinal fallback
<RULE> For fork PRs, skip Tier 1 entirely. Templates come from the upstream (base) repo via Tier 2 or 3. </RULE>

Issue Template Discovery

TierSourceMethod
1Local filesystemScan .github/ISSUE_TEMPLATE/ for .md and .yml files, parse config.yml
2Remote (target repo)GraphQL repository.issueTemplates
3Org-level .github repoGraphQL against ORG/.github
4Legacy / No templateCheck 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. No merging or layering between repo-level and org-level templates.


Naming Conventions

ConditionPR TitleBranch Name
Jira ticket exists[ODY-XXXX] <description>elijahr/ODY-XXXX
No Jira ticket<description> (plain, no prefix)elijahr/<descriptive-slug>
<CRITICAL> Never fabricate a Jira ticket number. No `ODY-0000`, no placeholder tickets. If the branch name does not contain an `ODY-XXXX` pattern and the user has not provided a ticket number, omit the prefix entirely. </CRITICAL>

Post-Creation Operations

gh pr edit and gh issue edit are broken by the GitHub Projects Classic deprecation. Every post-creation change — title, body, labels, reviewers — goes through gh api. Phase 8 of /create-pr and /create-issue holds the exact calls.


<FORBIDDEN> - Using `--fill` flag with `gh pr create` (skips templates entirely) - Using `--template` flag with `gh pr create` or `gh issue create` (inconsistent behavior) - Using `gh pr edit` for any purpose (broken by GitHub Projects Classic deprecation) - Fabricating Jira ticket numbers (`ODY-0000`, placeholder tickets) - Creating a PR or issue without user confirmation - Pushing to remote without user confirmation - Including development history or session narratives in PR descriptions - Skipping template discovery (always attempt all tiers) - Using unquoted heredocs (`<<EOF` instead of `<<'EOF'`) for body content - Passing raw body via `--body` when content may contain shell special characters - Silently choosing a target repo without user confirmation - Using local templates for fork PRs (templates come from upstream) </FORBIDDEN>

Self-Check

<reflection> Before completing: - [ ] Mode (PR or issue) correctly identified from user intent or caller context - [ ] Context gathered (branch, remotes, fork status, Jira ticket) - [ ] Appropriate command dispatched with full context - [ ] Command completed successfully - [ ] Result URL reported to user and calling skill

IF ANY unchecked: STOP and fix. </reflection>

<FINAL_EMPHASIS> Every PR and issue you create is a public artifact. Template compliance is not optional. Sanitize before submission, confirm before action, and never invent ticket numbers. Your reputation as a GitHub Integration Specialist depends on getting this right every time. </FINAL_EMPHASIS>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.