Create GitHub Issue
Creates a GitHub issue using gh issue create. Produces a public, well-formatted
title and body, then verifies the rendered result.
Before Writing
- Search for existing issues first.
gh search issues --repo <owner>/<repo> "<topic>" - never duplicate an open or closed issue that already covers the topic. Reference it instead.
- Check the repo's conventions.
gh issue list --repo <owner>/<repo> --state all --limit 20 and skim titles/labels/body structure of recent issues. Match that style.
Title Rules
- No internal prefixes. Never
TASK 12: ..., TASK-123: ..., or working-document IDs - those mean nothing to a public audience.
- Descriptive, matching the repo's existing style (imperative or noun phrase, e.g. "Add --fix to apply machine-applicable suggestions", "Report when ignore comments can be removed").
- One short sentence; no trailing period.
- If the repo uses labels (bug / enhancement / feature request), add the matching ones with
--label.
Body Rules - the ones that actually bite
GitHub renders EVERY single newline in an issue body as a hard line break (<br>). There is no soft-wrap collapsing. Therefore:
- Each paragraph is one continuous line - never wrap text at 80 columns.
- List items each go on one line (no indented continuation lines).
- Separate blocks (paragraphs, lists, headings) with a single blank line.
- Only fenced code blocks may contain real newlines - use them for multi-line content.
Public tone, no internal context. No "Task N", no references to private working docs (HANDOFF.md, backlog files, agent notes), no abbreviations only the team understands. A stranger must be able to act on the issue with only the repo in front of them. Say what the rule/feature is by its public name (rule IDs like C007 are fine - they're in the docs).
Structure the body with ## sections. A proven shape:
## Problem
<what is broken or missing, from a user perspective>
## The idea / Why this is nontrivial
<proposed change; for complex work, the constraints that make it hard>
## Open questions
- <decisions that need input before implementing>
## Acceptance criteria (draft)
- <verifiable outcomes>
Write the body to a temp file (/tmp/issue-<n>.md) with the write tool and pass it via --body-file. Never inline long markdown in shell arguments - quoting will mangle it.
If the body was extracted from a larger document (sed/awk/head), verify the extraction boundaries: a section header from the NEXT section can leak into the end of your file. Check the last lines of the extracted file before submitting.
Workflow
Write title + body file per the rules above.
Create:
gh issue create --repo <owner>/<repo> --title "<title>" --body-file /tmp/issue-<n>.md
Use the gh_cli tool where available (it validates against an allowlist and parses JSON).
Verify after creation - this step is mandatory, it is how the previous mistakes were caught:
Fetch the rendered HTML and confirm there are zero <br> tags outside code blocks:
gh api graphql -f query='query { repository(owner:"<owner>", name:"<repo>") { issue(number:<n>) { bodyHTML } } }' \
--jq '.data.repository.issue.bodyHTML' | grep -c "<br"
Expect 0 (grep exits 1 with no matches - that is success).
Re-read the stored body (gh issue view <n>) and check: no stray headings at the end, no internal jargon, title clean.
Report the issue URL. Leave the temp body file in place for reference.
Editing an Existing Issue
Same rules apply to gh issue edit <n> --title ... --body-file ... - unwrapped single-line paragraphs, clean title, then re-verify with the GraphQL check.
Edge Cases
| Scenario |
Action |
| Existing issue covers the topic |
Don't create a duplicate; link/reference the existing one |
| Repo has label conventions |
Add labels with --label matching existing usage |
| Body extracted from a draft doc |
Check the tail of the extracted file for leaked headings |
Rendered body shows <br> breaks |
Unwrap paragraphs to single lines, re-edit, re-verify |
| User wants an internal/rough draft |
Ask - public issues default to the public style above |
1---2name: create-issue3description: Create a well-formed GitHub issue with a clean title and body. Invoke whenever the user asks to create an issue, file a bug report, open a feature request, or report something via GitHub CLI. Encodes the lessons learned from bad issue drafts: GitHub renders every single newline as a hard line break, internal working-doc jargon does not belong in public issues, and titles must match the repo's existing conventions.4---56# Create GitHub Issue78Creates a GitHub issue using `gh issue create`. Produces a public, well-formatted9title and body, then verifies the rendered result.1011## Before Writing12131. **Search for existing issues first.** `gh search issues --repo <owner>/<repo> "<topic>"` - never duplicate an open or closed issue that already covers the topic. Reference it instead.141. **Check the repo's conventions.** `gh issue list --repo <owner>/<repo> --state all --limit 20` and skim titles/labels/body structure of recent issues. Match that style.1516## Title Rules1718- **No internal prefixes.** Never `TASK 12: ...`, `TASK-123: ...`, or working-document IDs - those mean nothing to a public audience.19- Descriptive, matching the repo's existing style (imperative or noun phrase, e.g. "Add --fix to apply machine-applicable suggestions", "Report when ignore comments can be removed").20- One short sentence; no trailing period.21- If the repo uses labels (bug / enhancement / feature request), add the matching ones with `--label`.2223## Body Rules - the ones that actually bite24251. **GitHub renders EVERY single newline in an issue body as a hard line break (`<br>`).** There is no soft-wrap collapsing. Therefore:26 - Each paragraph is **one continuous line** - never wrap text at 80 columns.27 - List items each go on **one line** (no indented continuation lines).28 - Separate blocks (paragraphs, lists, headings) with a single blank line.29 - Only fenced code blocks may contain real newlines - use them for multi-line content.302. **Public tone, no internal context.** No "Task N", no references to private working docs (HANDOFF.md, backlog files, agent notes), no abbreviations only the team understands. A stranger must be able to act on the issue with only the repo in front of them. Say what the rule/feature is by its public name (rule IDs like C007 are fine - they're in the docs).313. **Structure the body** with `##` sections. A proven shape:3233 ```markdown34 ## Problem35 <what is broken or missing, from a user perspective>3637 ## The idea / Why this is nontrivial38 <proposed change; for complex work, the constraints that make it hard>3940 ## Open questions41 - <decisions that need input before implementing>4243 ## Acceptance criteria (draft)44 - <verifiable outcomes>45 ```46474. **Write the body to a temp file** (`/tmp/issue-<n>.md`) with the write tool and pass it via `--body-file`. Never inline long markdown in shell arguments - quoting will mangle it.485. **If the body was extracted from a larger document** (sed/awk/head), verify the extraction boundaries: a section header from the NEXT section can leak into the end of your file. Check the last lines of the extracted file before submitting.4950## Workflow51521. Write title + body file per the rules above.532. Create:5455 ```bash56 gh issue create --repo <owner>/<repo> --title "<title>" --body-file /tmp/issue-<n>.md57 ```5859 Use the `gh_cli` tool where available (it validates against an allowlist and parses JSON).603. **Verify after creation** - this step is mandatory, it is how the previous mistakes were caught:6162 - Fetch the rendered HTML and confirm there are **zero `<br>` tags outside code blocks**:6364 ```bash65 gh api graphql -f query='query { repository(owner:"<owner>", name:"<repo>") { issue(number:<n>) { bodyHTML } } }' \66 --jq '.data.repository.issue.bodyHTML' | grep -c "<br"67 ```6869 Expect `0` (grep exits 1 with no matches - that is success).70 - Re-read the stored body (`gh issue view <n>`) and check: no stray headings at the end, no internal jargon, title clean.714. Report the issue URL. Leave the temp body file in place for reference.7273## Editing an Existing Issue7475Same rules apply to `gh issue edit <n> --title ... --body-file ...` - unwrapped single-line paragraphs, clean title, then re-verify with the GraphQL check.7677## Edge Cases7879| Scenario | Action |80| --- | --- |81| Existing issue covers the topic | Don't create a duplicate; link/reference the existing one |82| Repo has label conventions | Add labels with `--label` matching existing usage |83| Body extracted from a draft doc | Check the tail of the extracted file for leaked headings |84| Rendered body shows `<br>` breaks | Unwrap paragraphs to single lines, re-edit, re-verify |85| User wants an internal/rough draft | Ask - public issues default to the public style above |