Skip to content
Back to skills

Gh Create Issue

ASecurity

Use when user wants to create a GitHub issue for the current repository. Must read and follow the repository's issue template format.

  • 24 stars
  • 0 votes
  • 0 copies
  • 10 views
  • Added November 30, 2026
code-qualitybashnoderefactoringgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill gh-create-issue --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gh Create Issue?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gh Create Issue
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-gh-create-issue/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-gh-create-issue)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gh-create-issue
description: Use when user wants to create a GitHub issue for the current repository. Must read and follow the repository's issue template format.
---

# GitHub Create Issue

Use this skill when the user requests to create an issue. Must follow the repository's issue template format.

## Workflow

### Step 1: Determine Template Type

Analyze the user's request to determine the issue type:
- If the user describes a problem, error, crash, or something not working -> Bug Report
- If the user requests a new feature, enhancement, or additional support -> Feature Request
- If the user is asking a question or needs help with something -> Questions & Discussion
- If the user describes engineering work with no user-facing behavior change (a follow-up deferred from a pull request, technical debt, refactoring, tooling or CI work) -> Engineering Task
- Otherwise -> Others

Engineering Task is not a GitHub issue form and is not offered to regular users. Only select it when the request clearly describes internal engineering work.

**If unclear**, ask the user which template to use. Do not default to "Others" on your own.

#### Eligibility Check (Engineering Task only)

Engineering Task is meant for maintainers and collaborators with write access. This is a request,
not an access control — nothing prevents anyone from calling `gh issue create` directly, and this
skill does not try to. The check below is here so that a contributor without write access learns
that early and gets pointed somewhere more useful.

Before collecting any information, read the authenticated user's permission level:

```bash
repo="$(gh repo view --json nameWithOwner --jq .nameWithOwner)"
user="$(gh api user --jq .login)"
permission="$(gh api "repos/$repo/collaborators/$user/permission" --jq .permission 2>/dev/null)"
case "$permission" in
  admin | write) echo "eligible" ;;
  *) echo "not eligible" ;;
esac
```

Only `admin` and `write` are eligible (`maintain` reports as `write`). Always compare the returned
value: on a public repository this endpoint answers `read` for any user, including one who is not a
collaborator at all, so a successful call proves nothing on its own. Do not use
`repos/{owner}/{repo}/collaborators/{user}` here — it answers `204` for `read`- and `triage`-only
collaborators, who are not the intended audience for this template.

If the result is anything else, do not use this template. Explain that it is meant for maintainers
with write access, politely ask the contributor to use one of the public templates instead, and
offer to help them file it there — their report is welcome, just not under this template. Do not
quietly switch templates while keeping the Engineering Task labels or issue type.

### Step 2: Search for Existing Reports

The public templates ask the reporter to confirm they searched pinned, open, and closed issues and discussions. That checkbox is a claim made in the user's name, so search before collecting information, for every template:

```bash
repo="$(gh repo view --json nameWithOwner --jq .nameWithOwner)"
gh api graphql -F owner="${repo%/*}" -F name="${repo#*/}" -f query='
  query($owner: String!, $name: String!) {
    repository(owner: $owner, name: $name) {
      pinnedIssues(first: 10) { nodes { issue { number title url } } }
    }
  }'
gh issue list --state all --search "<keywords>" --limit 10 --json number,title,state,stateReason,url
gh discussion list --state all --search "<keywords>" --limit 10 --json number,title,closed,url
```

The search is done once 3–5 keyword sets, drawn from the symptom or the request and the affected feature, have each been run and their results read. All words in one query must match, so split a query that finds nothing into single terms before concluding there is no match.

When a result covers the same thing:
- **Open issue or discussion**: show it to the user and recommend a comment there that adds only what it lacks. File only if the user decides the new report is distinct, and link the existing one in the body.
- **Closed issue**: its `stateReason` decides how the new issue reads. `COMPLETED` means it was fixed, so a recurrence is a regression: reference it and give the version where the problem returned. `NOT_PLANNED` means the direction was declined: tell the user, and file only if they have a new argument, which the body must address.

Tick each template checklist item only after doing what it states. Leave any you could not verify unticked and name them in the Step 5 preview.

### Step 3: Read the Selected Template

1. Read the corresponding template file from `.github/ISSUE_TEMPLATE/` directory.
2. Identify required fields (`validations.required: true`), title prefix (`title`), labels (`labels`, if present), and issue type (`type`, if present).

For Engineering Task, read [references/engineering-task.md](references/engineering-task.md) instead — it lives outside `.github/ISSUE_TEMPLATE/` on purpose and carries its own title prefix, labels, issue type, and body structure.

### Step 4: Collect Information

Based on the selected template, ask the user for required information only. Follow the template's required fields and option constraints (for example, Platform and Priority choices).

A bug or request visible in the UI needs evidence a reader believes at a glance. Decide on it yourself rather than asking the user: use screenshots or recordings the user supplied; otherwise reproduce it in a dev instance and follow [UI capture](../verification/references/ui-capture.md). When it cannot be reproduced locally (it needs credentials, another platform, or the user's data), describe it in text instead. For a capture:
- Reach the problem in the fewest steps, in the scene where it stands out most: a gap missing under a button with a strong border reads at once, under a pale card it barely does. Adjust the scene (window size, data) rather than open more UI.
- Frame the region where the problem shows, plus whatever it is measured against (both edges of a missing gap), not the whole window.
- Record only a problem seen in motion: an animation, flicker, timing, or the order in which things happen. A state that steps end in is a still, however many steps reach it: capture that end state with what proves it in frame, such as the scrollbar thumb at the end of its track.
- When the problem is not visible on screen (keyboard focus without a focus ring, the keys pressed), mark it with an annotation and say in the body that it was added for the capture.
- Look at each capture at about 900 px wide, the width an issue body shows it, and recapture when the problem does not show at a glance.

With files to attach, follow the `gh-attach` skill from Step 5 on.

### Step 5: Build and Preview Issue Content

Write the issue body to a unique temp file. Keep the `X`s at the end of the template: macOS `mktemp` leaves them unfilled when a suffix such as `.md` follows.

```bash
issue_body_file="$(mktemp /tmp/gh-issue-body-XXXXXX)"
cat > "$issue_body_file" <<'EOF'
...issue body built from selected template...
EOF
```

Build it from the selected template:
- Use the exact title prefix from the selected template.
- Fill content following the template body structure and section order.
- Apply labels exactly as defined by the template.
- Keep all labels when there are multiple labels.
- If template has no labels, do not add custom labels.
- Apply the issue type exactly as defined by the template's `type` field.

Preview the temp file content. **Show the file path** (e.g., `/tmp/gh-issue-body-XXXXXX`) and ask for confirmation before creating. **Skip this step if the user explicitly indicates no preview/confirmation is needed** (for example, automation workflows).

### Step 6: Create Issue

Create the issue with `gh issue create`, using values from the selected template:

```bash
gh issue create --title "<title_with_template_prefix>" --body-file "$issue_body_file"
```

If the selected template includes labels, append one `--label` per label:

```bash
gh issue create --title "<title_with_template_prefix>" --body-file "$issue_body_file" --label "<label_1_from_template>" --label "<label_2_from_template>"
```

If the selected template has no labels, do not pass `--label`.

If the selected template declares a `type`, pass it as well. `--body-file` does not carry the issue type over on its own, so omitting this leaves the issue untyped:

```bash
gh issue create --title "<title_with_template_prefix>" --body-file "$issue_body_file" --type "<type_from_template>"
```

`--template` and `--web` resolve against `.github/ISSUE_TEMPLATE/` on the default branch, so neither works for Engineering Task. Build the body locally for it.

For the other templates you may use `--template` as a starting point (use the exact template name from the repository):

```bash
gh issue create --template "<template_name>"
```

Use the `--web` flag to open the creation page in browser when complex formatting is needed:

```bash
gh issue create --web
```

Clean up the temp file after creation:

```bash
rm -f "$issue_body_file"
```

## Notes

- Must read template files under `.github/ISSUE_TEMPLATE/` (or `references/` for Engineering Task) to ensure following the correct format.
- Treat template files as the only source of truth. Do not hardcode title prefixes, labels, or issue types in this skill.
- Title must be clear and concise, avoid vague terms like "a suggestion" or "stuck".
- Provide as much detail as possible to help developers understand and resolve the issue.

Files in this skill

  • SKILL.md9.3 KB
  • references/engineering-task.md2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.