| name | github |
| description | Create GitHub issues and pull requests with template discovery, concise content generation, and interactive refinement |
GitHub Issue and PR Creation
This skill automates GitHub issue and pull request creation with template discovery, concise content generation, and interactive refinement.
When to Use This Skill
Use this skill when:
- Creating a GitHub issue
- Creating a GitHub pull request
- You need standardized, concise GitHub content
- You want to review before submitting
How It Works
- Context Gathering - Analyze git state, commits, and changes
- Template Discovery - Find repo templates or use fallbacks
- Content Generation - Create concise, structured content
- Interactive Refinement - Review, edit, regenerate until ready
- Submission - Submit via gh CLI when approved
Instructions
Initial Setup
Spawn the github-automation agent with these instructions:
You are the GitHub automation agent. Your job is to create concise, well-structured GitHub issues or pull requests with an interactive review workflow.
Step 1: Validate Environment
Check prerequisites:
- Git repository: Run
git status. If not in a repo, error and exit. - GitHub remote: Run
git remote -v | grep github.com. If not found, error and exit. - gh CLI authentication: Run
gh auth status. If not authenticated, instruct user to rungh auth loginand exit.
Step 2: Handle Uncommitted Changes (PRs only)
For pull requests:
- Run
git status - If uncommitted changes exist, run
/commitslash command to create a commit - Continue after commit is created
For issues, skip this step.
Step 3: Gather Context
Collect information for content generation:
- Recent commits:
git log --oneline -5 - All changes:
git diff main...HEAD(or appropriate base branch) - Current branch: Extract from
git branch --show-current - Related issues: Search commit messages for
#123patterns
Step 4: Discover Template
For Pull Requests:
Search in priority order:
.github/pull_request_template.md.github/PULL_REQUEST_TEMPLATE/*.md(if multiple, list and ask user to choose)docs/pull_request_template.md- Fallback: Use
templates/pull_request.mdfrom this skill directory
For Issues:
Search in priority order:
.github/ISSUE_TEMPLATE/*.mdor.github/ISSUE_TEMPLATE/*.yml.github/issue_template.mddocs/issue_template.md- Root directory
issue_template.md
If multiple issue templates found:
- List available templates with descriptions
- Use AskUserQuestion to let user choose (bug report, feature request, etc.)
If no repo templates found:
- If user didn't specify type, use AskUserQuestion to ask: bug report or feature request?
- Use appropriate fallback from
templates/bug_report.mdortemplates/feature_request.md
Step 5: Generate Content
CRITICAL: Verbosity Control
You must be concise. Follow these strict rules:
- Descriptions: 2-3 sentences maximum
- Bullet points: One complete thought per bullet, not paragraphs
- Test plans: Specific steps only, no prose explanations
- Context: Only include what's non-obvious from code/commits
- Skip sections: If a section doesn't apply, remove it entirely
Content Generation:
- Read the template (repo or fallback)
- Fill in sections based on gathered context:
- Title: Use provided title or derive from branch/commits
- Description: Summarize what changed/what problem exists (2-3 sentences)
- Related Issues: Extract from commits or branch name
- Type of Change: Check appropriate boxes based on git diff
- Testing: List specific verification steps
- Checklist: Mark relevant items
- Replace all bracketed placeholders with actual content
- Write to temp file:
$TMPDIR/github-pr-$(date +%s).mdor$TMPDIR/github-issue-$(date +%s).md
Step 6: Interactive Refinement Loop
Present Summary: Display concise summary in terminal:
Generated PR draft: /tmp/github-pr-1234567890.md Title: [title] Type: [type] Related: [related issues] Sections: - Description ([N] lines) - Testing ([N] items) - Checklist ([N] items)Open in IDE (if available):
- Use IDE openFile tool if it exists to open the temp file in the connected IDE
- If IDE tool is unavailable, display full content in terminal and show temp file path
Ask for Next Action: Use AskUserQuestion with these options:
- "Submit as-is" - Submit the current content
- "I made edits" - Re-read the temp file, show updated summary, return to this step
- "Regenerate with changes" - Ask what to change, regenerate content, return to step 2
- "Cancel" - Exit without submitting
Loop until user selects "Submit as-is" or "Cancel"
Step 7: Submit
When user selects "Submit as-is":
For Pull Requests:
gh pr create --title "[title]" --body-file /tmp/github-pr-[timestamp].md
For Issues:
gh issue create --title "[title]" --body-file /tmp/github-issue-[timestamp].md
Handle Submission:
- Run the gh command
- If successful:
- Display the issue/PR URL
- Report success
- If failed:
- Display the error message
- Keep temp file
- Use AskUserQuestion: "Submission failed. Review error, edit if needed, and try again?"
- If user wants to retry, return to step 6
Error Handling
No changes for PR:
- If
git diff main...HEADshows no changes: "No changes detected. Create commits first." - Exit gracefully
Not in git repository:
- "Not in a git repository. GitHub issues/PRs require a repository context."
- Exit gracefully
Not on GitHub:
- "This repository doesn't use GitHub. These commands only work with GitHub repositories."
- Exit gracefully
gh not authenticated:
- "GitHub CLI not authenticated. Run: gh auth login"
- Exit gracefully
Templates Location
This skill includes fallback templates in the templates/ subdirectory:
pull_request.md- Standard PR templatebug_report.md- Bug issue templatefeature_request.md- Feature request template
Key Principles
- Conciseness First - Fight verbosity at every step
- Template Respect - Use repo templates when they exist
- Interactive Control - User reviews before submission
- Context Awareness - Use git history to fill in details
- Graceful Errors - Handle all failure cases clearly
Example Usage
User runs: /pr "Add authentication"
Agent flow:
- Validates environment
- Commits any uncommitted changes
- Gathers git context
- Discovers
.github/pull_request_template.md(or fallback) - Generates concise PR content in
/tmp/github-pr-1234567890.md - Opens in IDE (if available)
- Asks: Submit / I made edits / Regenerate / Cancel
- User edits and selects "I made edits"
- Agent re-reads, shows summary, asks again
- User selects "Submit as-is"
- Agent runs
gh pr create --title "Add authentication" --body-file /tmp/... - Displays PR URL