# Linear

> Linear Git Autopilot

- Skill: `imggion/linear` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add imggion/linear`
- Raw SKILL.md: https://api.skillmd.com/api/skills/imggion/linear/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: imggion (https://skillmd.com/u/imggion)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/imggion/linear

---


# Linear Git Autopilot

## Goal

Run a fully automated workflow from a Linear initiative + project to completed PRs, using:
- Linear MCP for task discovery and status updates
- Git for branching/commits
- `gh` for PR creation

Default behavior: proceed without asking questions unless blocked by missing access, missing required tools, or ambiguous project/initiative matching.

## Prerequisites (assume true; stop only if missing)
- Linear MCP server `linear` enabled and authenticated (OAuth).
- GitHub CLI `gh` authenticated with PR create permissions.
- Repo present and on a valid branch (usually `main`).
- Branch prefix must be `codex/`.

If any prerequisite is missing, stop and ask for the single missing item.

## Inputs (only)
- Initiative name (string)
- Project name (string)

## Defaults (do not ask)
- Process **all open tasks** in the project.
- Order by priority (if available), then by `createdAt` ascending.
- Status mapping: use `In Progress` for active work, `Done` when PR is opened.
- Branch naming: `codex/fix/KEY-slug` or `codex/feature/KEY-slug`.
- `fix` vs `feature`: use `fix` if issue looks like a defect/bug (labels or title contains: `bug`, `fix`, `error`, `errore`, `broken`, `non`, `crash`). Otherwise `feature`.
- PR base: `main`.
- Tests: if none run, write “Not run (not available)” in PR.

## Linear MCP Workflow (no questions unless blocked)

### 1) Resolve initiative + project
- Use `list_initiatives` with query = initiative name, includeProjects = true.
- Use `list_projects` with query = project name, includeArchived = true.
- Match project to initiative; if multiple matches, pick exact name match. If still ambiguous, stop and ask for clarification.

### 2) Get issues
- Use `list_issues` with project = project name (or ID), includeArchived = false.
- Filter out `Done`/`Canceled`/`Duplicate`.
- Sort by priority (desc) then `createdAt` (asc).

### 3) For each issue
- Set status to `In Progress` via `update_issue`.
- Proceed with Git workflow below.
- When PR is created: add Linear comment with PR URL + testing line via `create_comment`.
- Set status to `Done` via `update_issue`.
- Attach PR link if supported (attachments auto-link from comment is OK).

## Git Workflow (commands)

### Preflight (do not block)
- `git status -sb`
- If there are unrelated local changes:
  - Do not discard.
  - Keep them unstaged.
  - Only stage files you edit for the current issue.

### Branch creation
- Format slug: lowercase, hyphenated, short (3–6 words).
- Create branch:
  - `git switch -c codex/fix/KEY-slug`
  - or `git switch -c codex/feature/KEY-slug`

If branch creation fails due to permissions or lock:
- Request permission to proceed (Git needs write access to `.git/refs`).

### Commit
- Stage only files relevant to the issue:
  - `git add <files>`
- Commit message:
  - `fix(KEY): <summary>`
  - `feat(KEY): <summary>`

### Push
- `git push -u origin <branch>`

### PR creation (gh)
- `gh pr create --base main --head <branch> --title "<type>(KEY): <summary>" --body "<body>"`
- Default PR body template:

```
## Summary
- <bullet 1>
- <bullet 2>

## Testing
- Not run (not available)

## Linear
- KEY
```

## Implementation Guidance (no-ask mode)

- Prefer minimal, targeted changes.
- If UI change is requested, search in `src/ui/src`.
- Use `rg` for fast searching.
- If task is ambiguous, infer from title/description and proceed.

## Error Handling

- If Linear MCP calls fail: stop and ask to reconnect Linear MCP.
- If `gh` fails: stop and ask to authenticate.
- If repo has merge conflicts: stop and ask whether to resolve now or skip the task.

## Completion Output

After finishing all tasks:
- Provide a summary:
  - Each issue key → branch → PR URL → status
- Mention any tests not run.
- Mention any unrelated local changes detected.

## Non-goals

- Do not refactor unrelated code.
- Do not change API contracts unless the issue explicitly requires it.
- Do not close Linear tasks without creating a PR (unless explicitly told to skip PRs).

