# Update Jira

> Update JIRA issue status and add PR link comment after push

- Skill: `valasubramanian-kr/update-jira` (Agent Skill)
- Install (CLI): `npx skillmds@latest add valasubramanian-kr/update-jira`
- Raw SKILL.md: https://api.skillmd.com/api/skills/valasubramanian-kr/update-jira/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: valasubramanian-kr (https://skillmd.com/u/valasubramanian-kr)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/valasubramanian-kr/update-jira

---


# Sync JIRA Status Skill

## Purpose

Update JIRA issue status and post progress comments with GitHub PR link.

## Usage

```bash
/update-jira
```

(Must be run after `/push`)

## What This Skill Does

1. **Load PR Details**: Reads `pr-details.md` from the most recent workflow
2. **Update JIRA Status**: Transitions issue to "In Review" or appropriate status
3. **Post Comment**: Adds comment with PR link and summary to JIRA
4. **Link PR to JIRA**: Creates bidirectional linkage between GitHub PR and JIRA issue

## Required Context Files

Before proceeding, you must read these files from the most recent workflow directory:

1. **PR Details**: `workflow/jira-to-github/<JIRA-NUMBER>/pr-details.md` - Contains PR number, URL, and metadata
2. **Current Issue**: `workflow/jira-to-github/<JIRA-NUMBER>/current-issue.md` - Contains JIRA issue details and current status

Use the Glob tool to find the most recent workflow directory:
```
workflow/jira-to-github/*/pr-details.md
```

Then use the Read tool to load both files before proceeding with JIRA updates.

## Instructions

You are updating JIRA issue status after creating a GitHub pull request. Follow these steps:

### Step 1: Validate Prerequisites

Verify that:
1. PR details exist (`pr-details.md`)
2. JIRA issue was analyzed (`current-issue.md`)
3. PR was successfully created (has PR number and URL)

```bash
JIRA_DIR=$(ls -td workflow/jira-to-github/*/ 2>/dev/null | head -1)

if [ ! -f "$JIRA_DIR/pr-details.md" ]; then
  echo "❌ No PR details found"
  echo "Run /push first"
  exit 1
fi
```

### Step 2: Extract Information

From `pr-details.md`, extract:
- PR number
- PR URL
- JIRA issue key
- Branch name

From `current-issue.md`, extract:
- Current JIRA status
- Issue summary

### Step 3: Determine Target Status

Based on current status, determine the next appropriate status:

**Status Transitions**:

| Current Status | Target Status | Reason |
|---------------|---------------|---------|
| To Do | In Progress | Work has started |
| In Progress | In Review | PR created, awaiting review |
| Blocked | In Review | Unblocked, PR created |
| Reopened | In Review | Work completed, awaiting review |
| In Review | In Review | Already in review (no change) |

**Default**: If current status allows transition to "In Review", use that. Otherwise, add comment without status change.

### Step 4: Update JIRA Status

Use Atlassian MCP to update the JIRA issue status:

**Option A: Using mcp__atlassian__updateIssue**
```
{
  "issueKey": "<JIRA-KEY>",
  "update": {
    "status": {
      "name": "In Review"
    }
  }
}
```

**Option B: Using transition endpoint**
```
{
  "issueKey": "<JIRA-KEY>",
  "transition": {
    "id": "<transition-id>",
    "name": "In Review"
  }
}
```

**Handle status transition errors**:
- If transition not available, skip status update
- Log warning but continue to add comment
- Display which transitions are available

### Step 5: Create JIRA Comment

Generate a comprehensive comment for the JIRA issue:

**Comment Template**:

```markdown
🚀 *Pull Request Created*

A pull request has been created for this issue:

*PR*: [#{PR_NUMBER}: {PR_TITLE}]({PR_URL})
*Branch*: `{BRANCH_NAME}`
*Status*: Open ✓

---

*Implementation Summary*

{IMPLEMENTATION_SUMMARY}

*Test Results*
• ✓ Linting passed
• ✓ Type checking passed
• ✓ Unit tests: {TEST_COUNT} passed
• ✓ Coverage: {COVERAGE}%

*Review*
{REVIEWERS}

---

*Next Steps*
1. CI/CD checks will run automatically
2. Reviewers will be notified
3. Address any feedback from reviewers
4. Merge when approved

_Automated by Claude Code JIRA-to-GitHub workflow_
```

**Example Comment**:

```markdown
🚀 *Pull Request Created*

A pull request has been created for this issue:

*PR*: [#123: [DRT-17270] Add eProtect error code handling](https://github.com/org/repo/pull/123)
*Branch*: `dcppay-17270-eprotect-error-code`
*Status*: Open ✓

---

*Implementation Summary*

- Implemented error code mapping for eProtect responses
- Added user-friendly error messages for common error codes
- Updated analytics events to track eProtect errors
- Modified Zustand store to handle error states
- Added unit tests with 95% coverage

*Test Results*
• ✓ Linting passed
• ✓ Type checking passed
• ✓ Unit tests: 45 passed
• ✓ Coverage: 95%

*Review*
@frontend-lead, @security-reviewer

---

*Next Steps*
1. CI/CD checks will run automatically
2. Reviewers will be notified
3. Address any feedback from reviewers
4. Merge when approved

_Automated by Claude Code JIRA-to-GitHub workflow_
```

### Step 6: Post Comment to JIRA

Use Atlassian MCP to add the comment:

**Using mcp__atlassian__addComment**:
```
{
  "issueKey": "<JIRA-KEY>",
  "body": "<comment-markdown>"
}
```

### Step 7: Add GitHub PR Link to JIRA (Optional)

If your JIRA instance supports remote links, add the PR as a linked item:

**Using mcp__atlassian__addRemoteLink** (if available):
```
{
  "issueKey": "<JIRA-KEY>",
  "object": {
    "url": "<PR-URL>",
    "title": "PR #<number>: <title>",
    "icon": {
      "url16x16": "https://github.com/favicon.ico"
    }
  }
}
```

### Step 8: Verify Updates

Confirm that updates were successful:

**Check status update**:
```
✓ JIRA status updated: "In Progress" → "In Review"
```

**Check comment posted**:
```
✓ Comment posted to JIRA issue
```

**Check remote link** (if applicable):
```
✓ PR linked to JIRA issue
```

### Step 9: Display Summary

Display a concise summary to the user:

```
✓ JIRA Issue Updated

Issue: <JIRA-KEY>
Status: <OLD_STATUS> → In Review
Comment: Posted ✓
PR Link: Added ✓

JIRA URL: <JIRA-URL>
PR URL: <PR-URL>

The JIRA issue has been updated with:
- Status transition to "In Review"
- Comment with PR link and implementation summary
- Link to GitHub pull request

Next steps:
1. Monitor PR for review feedback
2. Address reviewer comments
3. Merge when approved
4. JIRA will be automatically updated when PR is merged (if GitHub integration configured)
```

## Error Handling

If errors occur:
1. Log error to `workflow/jira-to-github/<JIRA-NUMBER>/errors.log`
2. Display user-friendly message
3. Suggest recovery action

Common errors:

### Status Transition Error

```
⚠️  Status Update Failed

Current status: "In Progress"
Attempted transition: "In Review"

Error: Transition not available from current status

Available transitions:
- "Done"
- "Blocked"
- "To Do"

Recommendation:
- Manually update status in JIRA, or
- Use one of the available transitions

Comment was still posted successfully ✓
```

### Comment Post Error

```
❌ Comment Post Failed

Error: <error-message>

Recommendation:
- Verify Atlassian credentials in MCP configuration
- Check JIRA permissions for adding comments
- Manually post comment to JIRA

Comment text saved to:
workflow/jira-to-github/<JIRA-NUMBER>/jira-comment.txt
```

### Authentication Error

```
❌ JIRA Authentication Failed

Error: Invalid credentials or token expired

Fix:
1. Check Atlassian credentials in .mcp.json
2. Verify API token is valid
3. Ensure JIRA permissions are correct

Try again after fixing authentication.
```

### Network Error

```
❌ Network Error

Error: Could not connect to JIRA

Recommendation:
- Check internet connectivity
- Verify JIRA URL is correct
- Try again in a few moments
```

## Fallback: Manual Update

If automated update fails, provide manual instructions:

```
ℹ️  Manual Update Instructions

Since automated update failed, please manually update JIRA:

1. Go to: <JIRA-URL>

2. Update status to: "In Review"

3. Add this comment:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
<generated-comment-text>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

4. Link PR: <PR-URL>
```

## Advanced Features

### Smart Status Detection

Automatically detect the most appropriate status based on workflow:

**Scenarios**:
- PR created → "In Review"
- PR approved → "Ready for Merge"
- PR merged → "Done"
- PR closed without merge → Return to previous status

### Assignee Notification

Update assignee when status changes:

- Add watchers: PR reviewers
- Mention in comment: @reviewer1, @reviewer2
- Notify assignee of status change

### Time Tracking (if enabled)

Log time spent:

- Calculate time from "In Progress" to "In Review"
- Add time tracking entry
- Update remaining estimate

## Examples

Example 1: Successful update
```bash
/update-jira

# → Status updated: "In Progress" → "In Review"
# → Comment posted with PR link
# → Remote link added
# ✓ Complete
```

Example 2: Status transition not available
```bash
/update-jira

# → ⚠️ Cannot transition to "In Review" from "Done"
# → Comment still posted ✓
# → Manual status change recommended
```

Example 3: Authentication error
```bash
/update-jira

# → ❌ Authentication failed
# → Check credentials in .mcp.json
# → Manual instructions provided
```

Example 4: PR already in JIRA
```bash
/update-jira

# → ℹ️ PR already linked to JIRA
# → Status already "In Review"
# → No changes needed
```

## Integration with GitHub

If GitHub-JIRA integration is configured:

**Automatic bidirectional sync**:
- PR creation → JIRA comment (this skill)
- PR merge → JIRA status "Done" (GitHub automation)
- PR close → JIRA comment (GitHub automation)

**Smart branches**:
- Branch name includes JIRA key
- GitHub automatically links commits to JIRA
- JIRA shows GitHub activity in issue timeline

**Deployment tracking**:
- Link deployments to JIRA
- Track which environments have the change
- Update JIRA when deployed to production

