# Create GitHub Issue

Log a GitHub issue from the current session context.

**Issue description:** $ARGUMENTS

---

Read `skills/create-issue/SKILL.md` fully before doing anything.

## Step 1 — Parse the prefix and title

From $ARGUMENTS, extract:
- **Prefix**: the first word before the colon (e.g. `feat`, `bug`, `idea`, `chore`, `docs`)
- **Title**: everything after the colon, trimmed

If $ARGUMENTS is empty or has no clear title, ask:
```
What should the issue be about? Use a prefix to set the label:
  feat: Add X        → enhancement label
  bug: Y hangs       → bug label
  idea: Z approach   → no label
  chore: update X    → no label
  docs: document X   → no label
```

## Step 2 — Determine the label

| Prefix | Label |
|--------|-------|
| `feat` | `enhancement` |
| `bug` | `bug` |
| `idea`, `chore`, `docs`, anything else | *(no label)* |

## Step 3 — Draft the issue body from session context

Read the current session — recent messages, errors discussed, code explored, and the goal described — and draft a rich issue body. Use this structure:

```markdown
## Summary

<1–3 sentences: what this is and why it matters>

## Context

<What was tried, what was discussed, relevant code paths or file names>

## Expected behavior

<What should happen>

## Current behavior / Problem

<What happens now, or why this is missing>

## Notes

<Anything else relevant from the session — error messages, related issues, etc.>
```

Omit any section that has nothing meaningful to say. Keep the body factual and useful — not padded.

## Step 4 — Resolve the target repo

Check the environment for `ARCCREW_GITHUB_REPO`. If set, use that value as `owner/repo`.
If not set, default to `amonrreal/arccrew`.

Split the value into `owner` and `repo` parts on `/`.

## Step 5 — Create the issue via GitHub MCP

Call `mcp__github-mcp-server__create_issue` with:
- `owner`: from Step 4
- `repo`: from Step 4
- `title`: full title string (include prefix, e.g. `feat: Add X`)
- `body`: drafted body from Step 3
- `labels`: array with the label from Step 2, or an empty array if no label

## Step 6 — Show the result

```
Issue created: #{number} — {title}
URL: {html_url}
```
