---
name: "codemaman-jira-to-pr"
description: "Take a Jira ticket from start to merged-ready PR: read the ticket, branch, implement, open a well-formed PR linked to Jira, and update the ticket. Use for 'work on ABC-123', 'pick up this ticket', 'open a PR for this and update Jira'."
---

# Jira to PR

Glue between Jira, git, GitHub and the code. Keeps ticket, branch, commits and PR consistent so nobody has to copy and paste between them.

## 0. Tooling check (silent)
- Jira: prefer a connected Atlassian/Jira MCP tool. If none, check for `acli` or a configured REST token in the environment. If nothing works, ask the user to paste the ticket text and skip the Jira write-back steps (provide the comment/transition text for them to paste).
- GitHub: `gh auth status`. Git: confirm repo, default branch, clean working tree (stash or ask before proceeding if dirty).
- Read the repo's conventions: CLAUDE.md, CONTRIBUTING.md, `.github/pull_request_template.md`, recent `git log --oneline -20` for commit style, branch naming in `git branch -r`.

## 1. Read and digest the ticket
Fetch by key (argument like `ABC-123` or a URL). Capture: summary, description, acceptance criteria, type, priority, status, assignee, linked issues, parent epic, attachments and comments (comments often hold the real requirements).
Write a short brief for the user: goal in one sentence, acceptance criteria as a checklist, open questions/ambiguities, and a risk note. If requirements are ambiguous or contradictory, ask before coding. If the ticket is large, propose a split or an ordered plan.

## 2. Set up
- Update from remote and branch from the default branch: `<type>/<KEY>-<kebab-summary>` (e.g. `feature/ABC-123-add-export-button`) unless the repo uses another convention.
- If the ticket is unassigned or in To Do, offer to assign it to the user and transition it to In Progress. Do it only if they agree.

## 3. Plan then implement
- Explore the relevant code before writing any (grep for related features, existing patterns, tests). Present a brief plan (files to touch, approach, test plan) for non-trivial work and get a go-ahead.
- Implement in small logical commits. Follow repo style. Add or update tests for each acceptance criterion; run the project's lint, typecheck and tests and fix failures before moving on.
- Commit messages: match repo convention (Conventional Commits if used) and include the ticket key, e.g. `feat(export): add CSV export button (ABC-123)`.
- Don't expand scope. Note adjacent problems you noticed in the PR description or as follow-up tickets (offer to create them) rather than fixing them silently.

## 4. Self-review
Run a review of your own diff (`git diff <base>...HEAD`) against the acceptance criteria checklist: tick each one with the evidence (test name, file, or manual check). Remove debug code, stray files, and unrelated formatting changes.

## 5. Open the PR
- Push the branch and create the PR with `gh pr create` (draft if tests or criteria are incomplete). Title: `ABC-123: <imperative summary>` or the repo's convention.
- Body: use the repo's PR template if one exists (the codemaman-pr-description skill can draft it), otherwise:
  - **Ticket**: link to the Jira issue
  - **What & why**: 2-4 sentences
  - **Changes**: bullet list by area
  - **How to test**: concrete steps, including URLs, accounts, flags
  - **Acceptance criteria**: checklist mapped to evidence
  - **Screenshots**: placeholder, or offer to run the codemaman-pr-screenshots skill for UI changes
  - **Risks / rollout / follow-ups**
- Add labels/reviewers if the repo's history shows a pattern (CODEOWNERS applies automatically). Ask before requesting specific people.

## 6. Close the loop in Jira
With the user's OK (state exactly what you will do first):
- Add a comment with the PR link and a 2-3 line summary of what changed and how to verify.
- Transition to the team's review state (look up available transitions; don't guess names). Link the PR in the issue's development/remote link field if supported.
- Report ticket status and PR URL back to the user.

## Ongoing use
- If the user comes back after review feedback, use the codemaman-pr-address-comments skill: read the PR's review threads, group them into must-fix vs optional, make the changes as new commits (no force-push unless asked), reply on each thread saying what changed, and re-request review.
- After merge, offer to transition the ticket to Done/Released, delete the local and remote branch (the codemaman-git-cleanup skill can help), and add the merge commit or release to the Jira comment.

## Rules
- Never transition, assign, comment on, or create Jira issues without telling the user what you will do and getting a yes (batch these into one confirmation).
- Never force-push, rewrite published history, or push to the default branch.
- If you are blocked or the ticket is wrong/outdated, say so and propose a Jira comment rather than guessing.