|
| 1 | +--- |
| 2 | +name: github-issue-create |
| 3 | +description: >- |
| 4 | + Creates a new GitHub issue using the GitHub CLI (gh issue create): title, |
| 5 | + body, labels, assignees, milestone, template, or target repo. Use when the |
| 6 | + user asks to open, file, or create a GitHub issue via gh; wants gh issue new; |
| 7 | + or says to track work on GitHub without an existing issue number. |
| 8 | +--- |
| 9 | + |
| 10 | +# GitHub issue create (gh CLI) |
| 11 | + |
| 12 | +## When this applies |
| 13 | + |
| 14 | +Use when the user wants a **new** issue recorded on GitHub and agrees to use **`gh`** (not only local notes). If they only want a draft, produce markdown they can paste instead of running `gh`. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +- `gh` installed and authenticated: `gh auth status` (else `gh auth login`). |
| 19 | +- Network access when running `gh`. |
| 20 | +- Prefer the **git repo root** so the default remote matches the intended repository. |
| 21 | +- Another repo: pass `-R owner/repo` (or `HOST/owner/repo` for GitHub Enterprise). |
| 22 | + |
| 23 | +## 1. Gather content |
| 24 | + |
| 25 | +Before running `gh`, confirm: |
| 26 | + |
| 27 | +- **Title** — short, imperative or problem-focused (e.g. “Profile articles tab shows blank when empty”). |
| 28 | +- **Body** — context, steps to reproduce, expected vs actual, screenshots/links as markdown. Do **not** paste secrets, tokens, or full `.env` contents. |
| 29 | + |
| 30 | +Optional metadata from the user: |
| 31 | + |
| 32 | +- **Labels** (`-l`): repeat per label or comma-separated per `gh` examples. |
| 33 | +- **Assignee** (`-a`): logins or `@me`. |
| 34 | +- **Milestone** (`-m`): exact name as on GitHub. |
| 35 | +- **Project** (`-p`): project title; requires `gh auth refresh -s project` if GitHub returns project permission errors. |
| 36 | +- **Template** (`-T`): must match a template filename in `.github/ISSUE_TEMPLATE/` (if the repo uses them). |
| 37 | + |
| 38 | +## 2. Create the issue |
| 39 | + |
| 40 | +**Simple (inline):** |
| 41 | + |
| 42 | +```bash |
| 43 | +gh issue create --title "Your title" --body "Your body (markdown OK in quotes; use a file for long text)." |
| 44 | +``` |
| 45 | + |
| 46 | +**Long body or complex markdown — use a file:** |
| 47 | + |
| 48 | +```bash |
| 49 | +gh issue create --title "Your title" --body-file path/to/issue-body.md |
| 50 | +``` |
| 51 | + |
| 52 | +**Stdin:** |
| 53 | + |
| 54 | +```bash |
| 55 | +gh issue create --title "Your title" --body-file - |
| 56 | +# then paste body, end with Ctrl-D |
| 57 | +``` |
| 58 | + |
| 59 | +**Labels and self-assign:** |
| 60 | + |
| 61 | +```bash |
| 62 | +gh issue create -t "Title" -b "Body" -l bug -l "help wanted" -a "@me" |
| 63 | +``` |
| 64 | + |
| 65 | +**Editor (title + body in one buffer — first line is title):** |
| 66 | + |
| 67 | +```bash |
| 68 | +gh issue create -e |
| 69 | +``` |
| 70 | + |
| 71 | +**Web UI:** |
| 72 | + |
| 73 | +```bash |
| 74 | +gh issue create -w |
| 75 | +``` |
| 76 | + |
| 77 | +**Explicit repo:** |
| 78 | + |
| 79 | +```bash |
| 80 | +gh issue create -R owner/repo -t "Title" -b "Body" |
| 81 | +``` |
| 82 | + |
| 83 | +**From template:** |
| 84 | + |
| 85 | +```bash |
| 86 | +gh issue create --template "Bug Report" |
| 87 | +``` |
| 88 | + |
| 89 | +Alias: `gh issue new` is equivalent to `gh issue create`. |
| 90 | + |
| 91 | +## 3. After create |
| 92 | + |
| 93 | +`gh` prints the new issue URL. Share it with the user. Optionally mention the related skill for fixing issues: `github-issue-resolve`. |
| 94 | + |
| 95 | +## Safety |
| 96 | + |
| 97 | +- Do **not** run `gh issue create` without a clear title and body the user (or task) actually wants on the public tracker. |
| 98 | +- If intent is ambiguous, ask once for title, body, and labels before creating. |
| 99 | + |
| 100 | +## Checklist |
| 101 | + |
| 102 | +- [ ] Title and body ready; no secrets in the body. |
| 103 | +- [ ] Correct repo (`cwd` or `-R`). |
| 104 | +- [ ] Labels / assignee / milestone / project / template applied if requested. |
| 105 | +- [ ] Command run; URL returned to the user. |
0 commit comments