Loading...
Loading...
Use when the user asks to create a GitHub issue from the current conversation context (e.g., "new issue", "create issue", "file an issue", bug/feature request) with a target repo given or auto-detected, and gh CLI is available/authenticated.
npx skill4agent add tenfyzhong/skills-hub new-issue| User Input | Mode | Git Repo Required |
|---|---|---|
| Explicit | No |
| Explicit | No |
| No repo specified | Auto-detect | Yes |
# Check if gh CLI is available and authenticated
gh auth statusgh auth login# Check if in a git repository
git rev-parse --is-inside-work-tree
# Get repository info
gh repo view --json owner,name,urlowner/repohttps://github.com/owner/repoowner/repo# From URL: https://github.com/owner/repo or https://github.com/owner/repo/...
# Extract: owner/repo
# From short form: owner/repo
# Use directly
# Validate the repository exists and is accessible
gh repo view "$TARGET_REPO" --json owner,name,url# Get repository info and check if it's a fork
gh repo view --json owner,name,isFork,parent,url
# If it's a fork, get parent (upstream) info
IS_FORK=$(gh repo view --json isFork -q '.isFork')
if [ "$IS_FORK" = "true" ]; then
UPSTREAM_OWNER=$(gh repo view --json parent -q '.parent.owner.login')
UPSTREAM_NAME=$(gh repo view --json parent -q '.parent.name')
TARGET_REPO="$UPSTREAM_OWNER/$UPSTREAM_NAME"
else
# Use current repo as target
TARGET_REPO=$(gh repo view --json owner,name -q '.owner.login + "/" + .name')
fi[Bug][Feature][Enhancement][Question]## Description
[Clear explanation of the issue/feature request]
## Context
[Relevant background information from the conversation]
## Steps to Reproduce (for bugs)
1. [Step 1]
2. [Step 2]
3. [Expected vs Actual behavior]
## Proposed Solution (if discussed)
[Any solutions discussed in the conversation]
## Additional Information
- [Relevant code snippets]
- [Error messages]
- [Environment details if relevant]question## Issue Draft
**Target Repository**: [TARGET_REPO]
**Title**: [Generated Title]
**Description**:
[Generated Description]
---
Please review the above issue draft.questionOptions:
1. "Submit as-is" - Create the issue with current content
2. "Modify title" - Change the issue title
3. "Modify description" - Change the issue description
4. "Cancel" - Do not create the issue# Create issue on the target repository
gh issue create \
--repo "$TARGET_REPO" \
--title "$ISSUE_TITLE" \
--body "$ISSUE_BODY"gh issue create --repo "$TARGET_REPO" --title "$ISSUE_TITLE" --body "$(cat <<'EOF'
## Description
[Description content here]
## Context
[Context content here]
EOF
)"# Get the created issue details
gh issue view --repo "$TARGET_REPO" <ISSUE_NUMBER> --json number,title,url,state| Situation | Action |
|---|---|
| No context provided | Ask user to describe the issue they want to create |
| User cancels | "Issue creation cancelled. No issue was created." |
| API error | Report the error and suggest checking permissions |
| Rate limited | Inform user and suggest waiting |
| No write access | "You don't have permission to create issues on [REPO]. Consider forking first." |
| Repo not specified + not in git repo | Ask user to specify target repo or navigate to a git project |
| Invalid repo format | "Invalid repository format. Use 'owner/repo' or full GitHub URL." |