---
name: update-ticket-status
description: Write a PR's status back to its originating ticket in the PM tool (ClickUp/Asana/Notion/Jira) — move the ticket's status to match the PR state and comment the PR link. Closes the loop the ticket-fetcher opens. Run from the lead/main session.
disable-model-invocation: true
argument-hint: "[PR number or URL]"
---

# Write PR status back to the ticket

The `ticket-fetcher` opens the loop (ticket → task → PR); this skill **closes** it (PR → ticket). When a teammate's PR opens, updates, or merges, move the originating ticket's status in the PM tool and drop the PR link as a comment, so the PM tool reflects reality without anyone hand-updating it.

`$ARGUMENTS` may name the PR (number or URL). If omitted, ask, or operate on the PRs the lead just produced this session.

Run this from the **lead / main session** — it writes to the PM tool, which needs credentials only the main session holds.

## Steps

1. **Resolve the PR.** From `$ARGUMENTS`, or `gh pr view` for the current branch. Read its title, body, state (`open` / `merged` / `closed`), and review state.

2. **Find the originating ticket.** `/process-ticket` mandates a `Ticket: <url/ID>` link in every PR body — extract it. If the PR has no ticket link, **stop and report** rather than guessing: a ticket-less PR is a process violation the lead should fix at the source, not paper over here.

3. **Map PR state → ticket status.** Use the project's actual PM-tool statuses (discover them; don't assume English names — ClickUp statuses are often localised, e.g. `in Bearbeitung`, `abgeschlossen`). A sensible default mapping, adjusted to what the tool exposes:

   | PR state | Ticket status |
   |---|---|
   | open, no review | in progress / in review |
   | open, changes requested | in progress |
   | open, approved | in review / ready to merge |
   | merged | done / closed |
   | closed unmerged | back to todo (with a note) |

   Confirm the target status name against the tool's status list before setting it.

4. **Comment the PR link.** Add a comment on the ticket: the PR URL, its state, and a one-line summary. Don't duplicate — if a comment for this PR already exists, update rather than re-post.

5. **Report.** Summarise: ticket, old → new status, comment posted (yes/no). If anything was ambiguous (no ticket link, unknown status mapping), surface it instead of forcing a change.

## Optional: fire automatically on PR creation

By default this runs manually (the lead invokes it after a PR lands). To automate it, add an opt-in `Stop` or `PostToolUse` hook that calls the skill when a `gh pr create` completes — the same opt-in pattern `synthesize-learnings` documents for the `learning-synthesizer`. Keep it opt-in: auto-writing to the PM tool on every stop is noisy and can race with manual updates.

## Boundaries

- **Read the PR, write the ticket** — never the reverse. This skill doesn't change code, reopen PRs, or merge.
- **No ticket link, no write.** Report the gap; don't infer the ticket.
- **Tool-agnostic** — use the connected MCP server, else the configured API token the main session holds. Respect the PM-tool gotchas the `ticket-fetcher` documents (ClickUp `team_id`, localised statuses, `custom_id` lookups).
- **Secrets policy** — never read, request, or echo credential values.
