Connects work to the repo's ticket tracker — Linear, GitHub issues, or none — from a committed `.agents/aw/tracker.yml`: `setup` writes it, `search` finds a Linear ticket that already fits a request, `create` opens a new one (or hands off to a configured skill such as a Linear planning skill), `link` ties a ticket to a PR, and `move` sets its state for a pipeline stage; a script decides whether to link, search, ask, create, or skip. Triggers on "create a ticket for this", "link this to AI-123...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ticket?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mthines-ticket)
---
name: ticket
description: >
Connects work to the repo's ticket tracker — Linear, GitHub issues, or none —
from a committed `.agents/aw/tracker.yml`: `setup` writes it, `search` finds a
Linear ticket that already fits a request, `create` opens a new one (or hands
off to a configured skill such as a Linear planning skill), `link` ties a
ticket to a PR, and `move` sets its state for a pipeline stage; a script
decides whether to link, search, ask, create, or skip. Triggers on "create a
ticket for this", "link this to AI-123", "set up the tracker", "/ticket".
disable-model-invocation: false
argument-hint: 'setup | search "<request>" | create "<request>" | link <ticket> <pr-url> | move <ticket> build|ready|merge'
license: MIT
metadata:
author: mthines
version: '1.0.0'
workflow_type: command
tags:
- linear
- github-issues
- tickets
- tracker
- atelier
---
# ticket
Ties work to a ticket in the repo's tracker, so every PR points at the ticket that asked for it and the ticket follows the PR.
[`scripts/ticket.mjs`](./scripts/ticket.mjs) makes every decision it can from config and text alone: link, search, ask, create, or skip; which state a stage maps to; which PR line links.
Judging whether a found ticket actually fits the request is not one of those: [`search`](#search) makes that call, the one decision in this skill that needs reading, not just matching.
This skill does the tracker calls the script cannot make.
Config format: [`rules/config.md`](./rules/config.md).
```bash
T="${CLAUDE_SKILL_DIR:-$HOME/.claude/skills/ticket}/scripts/ticket.mjs"
node "$T" --decide --request "<the request>" [--ticket <id|url>] [--unattended] # TICKET: link <id> | search | ask | create | skip — <why>
```
| `--decide` prints | Do |
| --- | --- |
| `TICKET: link <id>` | Use that ticket; never create a second one |
| `TICKET: search` | Only for `provider: linear`: look for a fitting ticket before asking or creating ([`search`](#search)) |
| `TICKET: ask` | Ask once: "Create a `<provider>` ticket for this?" — yes → [`create`](#create); no → no ticket, and say so |
| `TICKET: create` | Run [`create`](#create) without asking (`require: always`) |
| `TICKET: skip — <why>` | No ticket; repeat `<why>` to the caller |
A request that names no ticket still may not need one created: when `provider: linear`, search first ([`search`](#search)) instead of asking or creating outright, because the ticket this work belongs to may already exist under another phrasing.
GitHub issues and `none` go straight to ask/create/skip: there is no search here for GitHub issues yet.
A repo without `tracker.yml` never gets a ticket created: the script links a ticket the request names and skips otherwise, because creating one is visible to other people and there is no team to put it in.
```text
✗ no tracker.yml, "add a dark-mode toggle" → create a Linear ticket in the first team the MCP lists
✓ no tracker.yml, "add a dark-mode toggle" → TICKET: skip — no .agents/aw/tracker.yml; /atelier setup configures a tracker
```
A request names a ticket by a Linear or GitHub issue URL, by `#n` under `provider: github`, or by a bare key only under the configured `linear.team`; `--ticket` links any key.
```text
✗ no tracker.yml, "add SHA-256 checksums" → TICKET: link SHA-256
✓ no tracker.yml, "add SHA-256 checksums" → TICKET: skip; team AI, "fix AI-3112" → TICKET: link AI-3112
```
## Modes
### `setup`
Interactive only. Writes `.agents/aw/tracker.yml` once, validates it on re-runs.
1. Detect: Linear MCP tools present (`save_issue`, `list_teams`), `gh` authenticated for the repo's `origin`, and an existing `tracker.yml`.
2. Ask in one batched question: the provider (`linear`, `github`, `none`); for Linear the team (from `list_teams`) and an optional project; `require` (`ask` recommended, `always` when every change must have a ticket, `never`); labels; and an optional `skills.create` pointer (for example `project-management:linear-planning`).
3. Write `tracker.yml` per [`rules/config.md`](./rules/config.md) with only the keys that differ from the defaults; put a personal value (another workspace's team, a token variable) in `~/.agents/aw/config.yml` → `repos.<owner/repo>.tracker`.
4. Validate: `node "$T" --check` prints `tracker.yml ok: …`. Commit nothing; print the path for the user to review.
### `search`
Find a Linear ticket that already fits the request, before asking a human or opening a new one. Only runs when `--decide` prints `TICKET: search` (`provider: linear`, no ticket named). Pass `--unattended` through from the caller: it decides whether an `ambiguous` result can ask a human.
1. Search Linear (`list_issues` or the MCP server's search, scoped to `linear.team` and, when set, `linear.project`) for titles and descriptions that plausibly match the request; widen the query once if the first pass returns nothing, dropping jargon to its plain-English intent.
2. Judge the results on fit, not just keyword overlap — same feature area, same kind of change, not already shipped or closed for a different reason — and sort them into exactly one of:
- **One fairly certain match**: a ticket clearly asks for this, or for work this request is part of. Print `TICKET: match <id> — <one-line why it fits>`.
- **Nothing fits well enough**: every result is unrelated, already resolved, or there were no results. Print `TICKET: none`.
- **Too ambiguous to pick**: several tickets could plausibly be this one, or `linear.team`/`linear.project` leaves more than one team or project in play and the request does not say which. Print `TICKET: ambiguous — <the candidates, each with id and title, or the missing team/project>`.
3. Caller:
- `match <id>` → link `<id>`; always say which ticket was used and why, so a wrong guess is visible and easy to correct — never link one silently.
- `none` → run [`create`](#create) without asking; a clean miss needs no human (by the time search runs, `require: never` has already skipped elsewhere).
- `ambiguous — <why>` → ask the user once, showing the candidates (or the missing team/project), whether to use one of them or create a new ticket; under `--unattended` there is no one to ask, so skip instead (`TICKET=none`), the same way a `require: ask` skip does — report it as `Needs you: no ticket — <why>`, never `Degraded:` — never guess.
```text
✗ one candidate loosely related, nothing closer → link it quietly # a wrong link is worse than one created extra
✓ one candidate loosely related, nothing closer → TICKET: none → create a new ticket
```
```text
✗ three candidates, unattended run → pick the first one returned
✓ three candidates, unattended run → TICKET: ambiguous → skip, Needs you: no ticket — 3 plausible tickets, no human present
```
### `create`
Open one ticket for a request, then print `TICKET: <id> <url>`.
1. `skills.create` set → `Skill("<skills.create>", "<request> — create exactly one ticket and print its id and URL")`, and take the id from its output; the pointed skill owns titles, estimates, and templates.
2. Otherwise, by provider:
- `linear`: `save_issue` with `team` (and `project`, `labels` from config), a one-line title from the request, and the request as the description.
- `github`: `gh issue create --title "<title>" --body "<request>"` with `--label` per configured label.
3. Never create a second ticket for a request that already has one: check the request text with `--decide` first.
### `link`
Tie a ticket to a PR.
1. `node "$T" --pr-line --ticket <id>` prints the line (`Closes AI-3112`, `Closes #12`); the PR body carries it once — add it with `gh pr edit` only when it is missing.
2. Linear: attach the PR URL to the issue (`create_attachment`) when the issue does not already show it.
### `move`
Set the ticket's state for a pipeline stage.
1. `node "$T" --state --stage <build|ready|merge>` prints the state; `none` → do nothing.
2. Linear: `save_issue` with that state. GitHub: `closed` at `merge` is done by the PR's `Closes #n`; confirm the issue closed, never close it by hand before the merge.
## Hard rules
- **The script decides whatever text and config can decide.** Link, search, ask, create, or skip comes from `--decide`; never from your judgment.
- **Search judges fit, never guesses.** A `search` match is linked only when it is fairly certain and said out loud (`match <id> — why`); anything less certain is `ambiguous`, not a quiet pick of the closest-looking ticket.
- **Never create unattended when `--decide` prints `TICKET: ask`.** The script prints `skip` there; report it as `Needs you: no ticket`. A linear `search` miss is different: `none` creates even unattended ([`search`](#search) point 3), because nothing fits and no human judgment is needed to see that; only an `ambiguous` result skips unattended.
- **One ticket per request.** A named ticket, or a `search` match, is linked, never duplicated by also creating one.
- **A tracker failure never blocks the caller.** Report it as one `Degraded:` line; the work goes on.