Work On Jira Ticket work-on-jira-ticket

Fetch a Jira ticket by link, build its full context, produce an implementation plan and optionally implement it.

Works in Claude, ChatGPT, Codex and more
Our test
7/10✓ Verified
tested Dec 6, 2026
GitHub stars
24k
comet-ml/opik
Added by
0
members
Updated
Dec 6
commit 316de6f
Content
2 files
no scripts · 14 KB
License
Apache 2.0
free to use

What our test found

The workflow gives a detailed, safety-conscious process for connecting Jira context to an Opik implementation plan, but depends on project-specific tools and workspace access.

Request we tested it on“Use the work-on-jira-ticket workflow for https://comet-ml.atlassian.net/browse/OPIK-2180. Fetch the ticket, review the repository, and give me an implementation plan. Don’t make code changes yet.”

Limits spotted

  • The workflow is tightly coupled to the Opik repository and Jira MCP.
  • It may stash local changes or change Jira status, so those side effects should be explicitly authorized before execution.
  • The fallback for a missing ticket searches only the current user’s To Do issues, which may not resolve broader access or key errors.
View on GitHub ↗
name: work-on-jira-ticket
description: "Fetch a Jira ticket by link, build its full context, produce an implementation plan and optionally implement it."
disable-model-invocation: true

Work on Jira Ticket

Overview

Fetch a Jira ticket by link, build full context (title, description, comments, type, status, priority, assignee, labels), and generate an actionable implementation plan. This workflow will:

  • Verify Jira MCP availability (or instruct how to install it).
  • Fetch and parse the ticket details.
  • If not found, list your assigned To Do issues.
  • Check local git status in the Opik repository and propose a branch if on main.
  • Suggest moving the ticket to In Progress if it's currently in To Do.
  • Validate all operations and provide clear success/failure feedback.

Inputs

  • Jira link (required): e.g., https://comet-ml.atlassian.net/browse/OPIK-1234
  • Worktree (optional): Pass worktree to work in an isolated git worktree. Defaults to no worktree when the argument is omitted — the command never prompts about worktrees.

Steps

1. Preflight & Environment Check
  • Check Jira MCP: If unavailable, respond with: > "This command needs the Atlassian MCP (Jira): sign in to it with /mcp in Claude Code (Cursor asks on first use), then retry." > Stop here.
  • Check development environment: Verify project dependencies, build tools, and project structure are ready.
  • Check local git branch in the Opik repository:
  • If on main, propose a new branch following Opik naming convention:
    {USERNAME}/OPIK-{TICKET-NUMBER}-{TICKET-SUMMARY}

Example:

  • Ticket: https://comet-ml.atlassian.net/browse/OPIK-2180
  • Title: "Add cursor git workflow rule"
  • Branch: andrescrz/OPIK-2180-add-cursor-git-workflow-rule

2. Fetch Ticket
  • Extract key from link (OPIK-<number>).
  • Fetch with getJiraIssue, and the comments with listJiraIssueComments: summary, description, issue type, status, priority, assignee, labels, reporter, comments.
  • If fetch fails: Show error message and suggest troubleshooting steps.
  • If not found: Search JQL: assignee = currentUser() AND status = "To Do" ORDER BY updated DESC (max 10).
  • Show list: OPIK-#### — Summary (Status) and stop if ticket not found.

3. Build Jira Context
  • Key, Title, Type, Status, Priority, Assignee, Labels
  • Description: verbatim if short, otherwise concise summary + key quotes. The description contains the WHY (motivation) and WHAT (high-level scope + acceptance criteria); implementation details ("HOW") live in a separate comment — see below.
  • If no description: Note this and suggest adding context for better implementation planning.
  • Comments: newest → oldest, [author @ date] summary with important snippets.
  • HOW comment: scan comments for the most recent one whose body matches ^#\s*HOW\b (case-insensitive). If found, surface it as the implementation suggestion — clearly framed as a note from when the ticket was filed, not a plan of record. The current code state is authoritative; the HOW is one input. If no HOW comment exists, proceed without one — many tickets won't have one, and that's fine (older tickets predate the convention; some tickets have nothing worth adding beyond the WHAT).
  • Epic/Story context: Include parent issue information if available.

4. Determine Implementation Scope
  • Analyze ticket scope: Determine which Opik components are affected:
  • Backend only: Java API changes, database migrations, services
  • Frontend only: React components, UI changes, state management
  • SDK only: Python or TypeScript SDK changes
  • Cross-component: Changes affecting multiple layers
  • Infrastructure: Docker, deployment, configuration changes
  • Identify affected areas: Map ticket requirements to specific Opik modules and files
  • Estimate complexity: Consider if changes require database migrations, API versioning, or breaking changes

5. Task Plan
  • Bugfix: repro steps, root cause hypothesis, affected files, fix approach, risks, tests, verification.
  • Feature: user story recap, acceptance criteria, implementation plan, tests, rollout notes.
  • HOW comment, if one exists: weave its suggestions into the plan after independently reading the current code state. If the HOW conflicts with what the code looks like today, trust the code and note the divergence in your plan. The HOW is a hint from when the ticket was filed, not a contract.
  • Always reference shared + domain guidance in the right place:
  • Global policy: the root AGENTS.md (git workflow, security, code style)
  • Backend guidance: .agents/skills/opik-backend/*
  • Frontend guidance: .agents/skills/opik-frontend/*
  • SDK guidance: .agents/skills/python-sdk/* and .agents/skills/typescript-sdk/*
  • Component-specific guidance: Use the appropriate guidance set based on the implementation scope identified in step 4

6. Git & Branch Setup
  • Repo: Opik repository (current workspace)
  • NEVER commit directly to main (following Opik git workflow)
6a. Worktree Decision

Worktree usage is strictly opt-in:

  • If `worktree` was passed as an argument: Use a worktree (continue to 6b).
  • Otherwise (default): Skip 6b and go straight to 6c (normal path). Do not prompt the user.

If the EnterWorktree tool is not available (e.g., running in Cursor or another editor) even when worktree was passed, fall back to 6c without prompting.

6b. Worktree Path (if using worktree)
  1. Slugify {TICKET-SUMMARY} for the worktree name: replace any character not in [A-Za-z0-9._-] with -, collapse consecutive - into one, and trim leading/trailing -. Then call EnterWorktree with name {USERNAME}-OPIK-{TICKET-NUMBER}-{SLUGIFIED-SUMMARY}.
  2. Inside the worktree, fetch the latest remote state and create the properly named branch based on origin/main (using the same slugified summary):
   git fetch origin
   git checkout -b {USERNAME}/OPIK-{TICKET-NUMBER}-{SLUGIFIED-SUMMARY} origin/main

The worktree intentionally branches off origin/main regardless of the parent checkout's current branch or local main state, and skips the rebase-strategy prompt — isolation is the whole point of the worktree.

Do not inspect or prompt about the parent checkout's working tree (staged, unstaged, or untracked files; current branch). Worktrees are physically isolated, so parent state has no effect on the worktree and is not the agent's concern in this path.

  1. Continue with implementation in the worktree directory.
6c. Normal Path (if not using worktree)
  • Handle working directory state BEFORE branching:
  • If working directory has changes:
  • Option 1: Stash changes: git stash push -m "WIP: before OPIK-{TICKET-NUMBER}"
  • Option 2: Ask user what to do with uncommitted changes
  • Slugify {TICKET-SUMMARY} the same way as step 6b: replace any character not in [A-Za-z0-9._-] with -, collapse consecutive - into one, and trim leading/trailing -.
  • If on main, create branch following Opik conventions:
  git checkout main
  git pull origin main
  git checkout -b {USERNAME}/OPIK-{TICKET-NUMBER}-{SLUGIFIED-SUMMARY}
  • After branch creation: Apply stashed changes if any: git stash pop
  • Verify branch creation: Confirm new branch is active and clean.

7. Status Management (Optional)
  • Move ticket to "In Progress" if currently in "To Do":
  • Move it with transitionJiraIssue
  • Verify transition success: Confirm status actually changed
  • Handle transition failures: Provide error details and retry options

8. Implementation Suggestion
  • Based on Jira context and Opik agent guidance, suggest implementing the feature/bugfix:
  • Reference global policy in the root AGENTS.md and domain guidance in .agents/skills/*
  • Provide specific implementation steps based on the task plan
  • Include code examples or file paths where appropriate
  • Suggest testing approaches and quality checks
  • Follow Opik architecture patterns (Resources → Services → DAOs → Models for backend)
  • Commit Message Format: Use semantic commits. The first commit on a branch is critical because PR title is derived from it:

First Commit (PR-title source, required):

  [OPIK-####] [BE/FE/SDK/DOCS] <type>: <description>

Allowed ticket-key variants (when applicable):

  [issue-####] [BE/FE/SDK/DOCS] <type>: <description>
  [NA] [BE/FE/SDK/DOCS] <type>: <description>

Follow-up Commits (preferred):

  <type>(<scope>): <description>

where <type> is one of: feat, fix, refactor, test, docs, chore.

Last-resort fallback (discouraged):

  Revision N: <description>

Component Types:

  • [BE] - Backend changes (Java, API endpoints, services)
  • [FE] - Frontend changes (React, TypeScript, UI components)
  • [SDK] - SDK changes (Python, TypeScript SDKs)
  • [DOCS] - Documentation updates, README changes, comments, swagger/OpenAPI documentation

Examples:

  [OPIK-1234] [BE] feat: add create trace endpoint
  [OPIK-1234] [FE] feat: add project custom metrics UI dashboard
  [OPIK-1234] [DOCS] docs: update API documentation
  [issue-1234] [SDK] feat: add new Python SDK method
  fix(metrics): handle empty dashboard responses
  test(api): cover project metrics endpoint pagination
  Revision 2: small follow-up rename after emergency patch

Jira key convention in commit messages (see the root AGENTS.md, Commit & Pull Request Guidelines): the GitHub for Jira app links any OPIK-<digits> it finds in a commit message to that ticket's Development panel, and the link can't be removed. The ticket this branch resolves keeps the hyphen (OPIK-1234) — that's the prefix. But any other ticket a commit message mentions without resolving (an escalation, a reference to an older ticket) must be written with an underscore (OPIK_7000) and with no Jira URL, so the scanner doesn't link it.

9. User Confirmation
  • Ask for user approval before proceeding with implementation:
  • Present the implementation plan clearly
  • Ask: "Would you like me to proceed with implementing this feature/fix now?"
  • Wait for explicit user confirmation before making any code changes
  • If user declines: Stop here and provide guidance for manual implementation
  • If user confirms: Proceed to implementation phase
10. Implementation Phase (Optional)
  • Only proceed if user confirmed in previous step
  • Execute the implementation plan:
  • Create/modify necessary files following Opik patterns
  • Apply code changes according to the plan
  • Run quality checks and tests
  • Commit changes with proper ticket number prefix
  • Post-push PR description sync: Whenever this skill (or any follow-up step the user runs from this conversation) invokes git push or git push --force-with-lease to a branch with an open PR in comet-ml/opik, invoke the pr-description-sync skill (.agents/skills/pr-description-sync/SKILL.md) immediately after the push completes. The sub-skill is a no-op when no PR exists, when the description is already in sync, or when the user has opted out of refreshes for this repo. This keeps the PR description aligned with what was actually shipped instead of what was claimed when the PR was opened.
  • If user declined: Provide manual implementation guidance and stop

11. Completion Summary & Validation
  • Confirm all steps completed:
  • ✅ Jira MCP available and working
  • ✅ Ticket fetched and analyzed successfully
  • ✅ Status updated (if applicable)
  • ✅ Feature branch created and active following Opik naming convention
  • ✅ Development environment ready
  • ✅ Implementation suggestion provided
  • Next steps: Provide clear guidance on what to do next
  • Error summary: If any steps failed, provide troubleshooting guidance

Error Handling

Jira MCP Failures
  • Connection issues: Check network and authentication
  • Permission errors: Verify user access to the ticket
  • Rate limiting: Wait and retry
Git Operation Failures
  • Branch creation fails: Check for conflicts, verify permissions
  • Pull fails: Resolve merge conflicts, check remote status
  • Working directory dirty: NEVER commit to main - stash changes first
  • CRITICAL SAFETY: Always verify current branch before any commits
  • Uncommitted changes: Stash before branching, pop after branch creation
Status Transition Failures
  • Invalid transition: Check available transitions for current status
  • Permission denied: Verify user can modify ticket status
  • Workflow restrictions: Check project workflow configuration

Success Criteria

The command is successful when:

  1. ✅ Jira ticket is successfully fetched and analyzed
  2. ✅ Feature branch is created and active following Opik naming convention
  3. ✅ Ticket status is updated (if requested)
  4. ✅ Implementation suggestion provided based on context and Opik rules
  5. ✅ User confirmation received (proceed or decline)
  6. ✅ Implementation executed (if confirmed) or manual guidance provided (if declined)
  7. ✅ All operations complete without errors
  8. ✅ Clear next steps are provided to the user

Troubleshooting

Common Issues
  • Jira MCP not available: sign in to it with /mcp in Claude Code (Cursor asks on first use)
  • Git branch conflicts: Resolve conflicts before proceeding
  • Permission errors: Check user access and project settings
  • Network issues: Verify connectivity to Atlassian services
Fallback Options
  • If ticket fetch fails: List user's assigned tickets
  • If branch creation fails: Provide manual git commands
  • If status update fails: Continue with development setup

End Command