Create a new ticket in Linear with proper formatting — title, description, priority, labels. Use when the user finds a bug or wants to track new work.
Level: L2 — GATHER, BUILD, GATE, CREATE
Create a well-formatted ticket in the Botree Software (BSW) Linear project. Gathers information from the user and codebase, formats it properly, gets approval, and creates it via the Linear API.
Linear Team: Botree Software (BSW)
186fc3de-4e72-479f-a1ef-cddb3e7f6df975778467-64d9-41c9-92aa-ab07de93500fLabel IDs:
fa7e3833-01d7-4ca4-bc1f-1cd57822bf769aa87004-faf4-430b-a86a-46db80dd6d32e3434095-ff60-47d4-afb8-462e4970b722Priority Mapping:
Goal: Get all the information needed to create a useful ticket.
git remote -v to get the GitHub repo URL for linking.If information is unclear, ask the user:
I need a few details to create the ticket:
- Title: [parsed from input or ask]
- Type: Bug / Feature / Improvement?
- Priority: Urgent / High / Medium / Low?
- Description: What is the problem or what needs to be built?
Goal: Create a well-structured ticket body with all relevant information.
Format the ticket body in markdown:
## Problem
[Clear description of what is broken or what needs to be built. Include specific error messages, unexpected behavior, or the desired new functionality.]
## Acceptance Criteria
- [ ] [First criterion — specific, testable behavior]
- [ ] [Second criterion — specific, testable behavior]
- [ ] [Third criterion — specific, testable behavior]
- [ ] All existing tests continue to pass
## Relevant Files
- `src/main/java/com/botree/example/Service.java` — [brief description of relevance]
- `src/test/java/com/botree/example/ServiceTest.java` — [test that should verify the fix]
## Context
- **Repo:** [GitHub repo URL from git remote]
- **Module:** [affected module/package]
- **Discovered by:** [user or test name]
This phase is mandatory. Never skip the gate.
Present the complete ticket to the user:
## New Ticket Preview
**Title:** Fix NullPointerException in InvoiceService.getAllInvoices
**Type:** Bug
**Priority:** 2 (High)
**Team:** Botree Software (BSW)
**Status:** Todo
**Description:**
[full formatted body from Phase 2]
Create this ticket? (Create / Edit / Cancel)
Wait for the user to respond:
Goal: Create the ticket via the Linear GraphQL API.
Verify LINEAR_API_KEY is set:
test -n "$LINEAR_API_KEY" && echo "OK" || echo "MISSING"
Create the issue. Build and execute the GraphQL mutation. Note: the description body must be properly JSON-escaped (escape newlines, quotes, backslashes):
curl -s -X POST https://api.linear.app/graphql \
-H "Content-Type: application/json" \
-H "Authorization: $LINEAR_API_KEY" \
-d '{
"query": "mutation($input: IssueCreateInput!) { issueCreate(input: $input) { success issue { identifier title url priority state { name } labels { nodes { name } } } } }",
"variables": {
"input": {
"teamId": "186fc3de-4e72-479f-a1ef-cddb3e7f6df9",
"title": "TICKET_TITLE",
"description": "TICKET_DESCRIPTION",
"priority": PRIORITY_NUMBER,
"stateId": "75778467-64d9-41c9-92aa-ab07de93500f",
"labelIds": ["LABEL_ID"]
}
}
}'
Parse the response. Extract the new ticket identifier (BSW-###), URL, and confirm creation.
## Ticket Created
- ID: BSW-25
- Title: Fix NullPointerException in InvoiceService.getAllInvoices
- Priority: 2 (High)
- Type: Bug
- Status: Todo
- URL: https://linear.app/botree-software/issue/BSW-25
To start working on it: `/ticket BSW-25`
| Failure | Detection | Response |
|---|---|---|
| LINEAR_API_KEY not set | Environment variable is empty or unset | Report: "LINEAR_API_KEY is not set. Export it and try again." Stop. |
| API error on creation | success is false or errors array in response | Report the error from Linear. Show the ticket content so the user can retry. |
| Network error | curl times out or cannot connect | Report: "Cannot reach Linear API. Check your internet connection." Show the ticket content so the user can create it manually. |
| User cancels at gate | User says "Cancel" | Stop. Do not create the ticket. Report: "Ticket creation canceled." |
| Insufficient information | Cannot determine title, type, or priority from input | Ask the user for the missing information. Do not guess. |
| Invalid label | Label name does not match Bug, Feature, or Improvement | Default to no label. Report: "Unknown label '{input}'. Creating without a label." |
| Not in a git repo | git remote -v fails | Skip the repo URL in the description. Note: "Not in a git repo — skipping repo link." |
git remote -v.\n), quotes (\"), and backslashes (\\).After /create-ticket completes:
/ticket BSW-### to start working on it immediately/sprint to view the sprint board/create-ticket againLINEAR_API_KEY and retry