AgentSkillsCN

jira

管理Jira问题,包括创建、列出、流转及工作流整合。

SKILL.md
--- frontmatter
name: jira
description: Manages Jira issues including creation, listing, transitions, and workflow integration.
argument-hint: "[command] [arguments]"

Jira Integration

จัดการ Jira issues ผ่าน CLI รองรับ Atlassian Cloud

Usage

code
/jira [command] [arguments]

Available Commands

CommandDescription
/jira initตั้งค่า Jira credentials
/jira testทดสอบ connection
/jira listแสดง issues ใน project
/jira myแสดง issues ที่ assign ให้ฉัน
/jira get <key>ดู issue details
/jira createสร้าง issue ใหม่
/jira create-storyสร้าง Story พร้อม template
/jira create-epicสร้าง Epic พร้อม template
/jira create-subtask-templatedสร้าง Subtask พร้อม template และ dependency links
/jira search <query>ค้นหา issues
/jira transitions <key>ดู transitions ที่ทำได้
/jira transition <key> <id>เปลี่ยน status ด้วย transition ID
/jira comment <key>เพิ่ม comment
/jira add-labels <key>เพิ่ม labels
/jira link <type>สร้าง dependency link

Instructions

Command: init

ตั้งค่า Jira credentials

bash
./scripts/jira-client.sh init

หลังจาก init สำเร็จ:

code
Jira configured successfully!

ใช้ /jira test เพื่อทดสอบ connection

Command: test

ทดสอบ connection กับ Jira

bash
./scripts/jira-client.sh test

Output:

code
Testing connection to [domain]...
Connected as: [name] ([email])

Command: list

แสดง issues ใน project

bash
# Default project
./scripts/jira-client.sh list

# Specific project
./scripts/jira-client.sh list PROJ

# Filter by status
./scripts/jira-client.sh list PROJ "In Progress"

แสดงผลในรูปแบบ table:

code
KEY        STATUS       SUMMARY
PROJ-123   To Do        Fix login bug
PROJ-124   In Progress  Add search feature
PROJ-125   Done         Update docs

Command: my

แสดง issues ที่ assign ให้ user

bash
./scripts/jira-client.sh my-issues

# Filter by status
./scripts/jira-client.sh my-issues "To Do"

Command: get

ดู issue details

bash
./scripts/jira-client.sh get PROJ-123

แสดงผล:

json
{
  "key": "PROJ-123",
  "summary": "Fix login bug",
  "status": "In Progress",
  "type": "Bug",
  "priority": "High",
  "assignee": "John Doe",
  "url": "https://company.atlassian.net/browse/PROJ-123"
}

Command: create

สร้าง Jira issue ใหม่ (interactive)

Step 1: ถามข้อมูล issue

ใช้ AskUserQuestion:

code
สร้าง Jira Issue

1. Project Key (e.g., PROJ)
2. Issue Type (Task, Bug, Story, Epic)
3. Summary (หัวข้อ)
4. Description (รายละเอียด)
5. Priority (Highest, High, Medium, Low, Lowest)

Step 2: สร้าง issue

bash
./scripts/jira-client.sh create "[PROJECT]" "[SUMMARY]" "[DESCRIPTION]" "[TYPE]"

Step 3: แสดงผล

code
Issue Created!

Key: PROJ-123
URL: https://company.atlassian.net/browse/PROJ-123
Summary: [summary]
Type: [type]

ใช้ /focus แล้วเลือก "Jira (existing)" เพื่อเริ่มทำงาน

Command: create-story

สร้าง Story พร้อม standard template

bash
./scripts/jira-client.sh create-story PROJ "Feature summary" --labels Backend,Player --due 2026-02-14

Template Sections:

  • Overview - อธิบายสั้นๆ ว่าทำอะไร
  • Requirements - รายละเอียดความต้องการ
  • System Flow - flow diagram (ASCII art)
  • Subtask Dependencies - dependency tree
  • Acceptance Criteria - functional, admin, logging requirements
  • Definition of Done (DoD) - checklist
  • Test Scenarios - test cases สำหรับ QA

Options:

  • --labels L1,L2 - เพิ่ม labels (comma-separated)
  • --due YYYY-MM-DD - กำหนด due date

Command: create-epic

สร้าง Epic พร้อม standard template (same as Story)

bash
./scripts/jira-client.sh create-epic PROJ "Epic summary" --labels Backend --due 2026-02-28

Command: create-subtask-templated

สร้าง Subtask พร้อม template และ dependency links

bash
./scripts/jira-client.sh create-subtask-templated PROJ-123 "Phase 1: Data Models" \
  --labels Backend,Player \
  --due 2026-02-10 \
  --blocked-by PROJ-120 \
  --blocks PROJ-125,PROJ-128

Template Sections:

  • Scope - อธิบายว่า subtask นี้ทำอะไร
  • Dependencies - Blocked by / Blocks (links)
  • Tasks - รายละเอียดงาน พร้อม file locations และ code snippets
  • Acceptance Criteria - checklist

Options:

  • --labels L1,L2 - เพิ่ม labels
  • --due YYYY-MM-DD - กำหนด due date
  • --blocked-by KEY1,KEY2 - สร้าง "blocked by" links
  • --blocks KEY1,KEY2 - สร้าง "blocks" links

Command: add-labels

เพิ่ม labels ให้ issue

bash
./scripts/jira-client.sh add-labels PROJ-123 Backend Player game

Command: link

สร้าง dependency link ระหว่าง issues

bash
# PROJ-124 blocks PROJ-125
./scripts/jira-client.sh link blocks PROJ-124 PROJ-125

# PROJ-125 is blocked by PROJ-124
./scripts/jira-client.sh link blocked-by PROJ-125 PROJ-124

# PROJ-123 relates to PROJ-456
./scripts/jira-client.sh link relates PROJ-123 PROJ-456

Link Types:

  • blocks - from_key blocks to_key
  • blocked-by - from_key is blocked by to_key
  • relates - from_key relates to to_key

Workflow: Start Working on Issue

Note: ไม่มีคำสั่ง /jira start โดยตรง ให้ใช้ /focus แล้วเลือก "Jira (existing)" แทน หรือทำ workflow ด้านล่างนี้ด้วยตัวเอง

เริ่มทำงาน Jira issue - ดึงมาเป็น current focus

Step 1: ดึงข้อมูล issue

bash
./scripts/jira-client.sh get [ISSUE_KEY]

Step 2: สร้าง feature branch

bash
# Format: [type]/[issue-key]-[short-description]
# Type mapping from Jira issue type:
#   Bug -> fix
#   Story/Task -> feat
#   Epic -> feat
#   Improvement -> refactor

git checkout -b [type]/[ISSUE_KEY]-[slug]

Step 3: Update docs/current.md

bash
export TZ='Asia/Bangkok'
cat > docs/current.md << EOF
STATE: working
TASK: [ISSUE_KEY] - [summary]
SINCE: $(date '+%Y-%m-%d %H:%M')
ISSUE: [ISSUE_KEY]
BRANCH: [branch-name]
JIRA_URL: [url]
EOF

Step 4: Update activity.log

bash
export TZ='Asia/Bangkok'
echo "$(date '+%Y-%m-%d %H:%M') | working | [ISSUE_KEY] - [summary]" >> docs/logs/activity.log

Step 5: Transition issue to "In Progress" (if available)

bash
# Get available transitions
./scripts/jira-client.sh transitions [ISSUE_KEY]

# If "In Progress" or similar transition exists, apply it
./scripts/jira-client.sh transition [ISSUE_KEY] [transition_id]

Step 6: Assign to self

bash
./scripts/jira-client.sh assign [ISSUE_KEY] me

Output:

code
Started: [ISSUE_KEY]
Summary: [summary]
Branch: [branch]

Issue transitioned to: In Progress
Assigned to: you

Ready to work!

Command: transition

เปลี่ยน status ของ issue ผ่าน Jira workflow transitions

Step 1: แสดง available transitions

bash
./scripts/jira-client.sh transitions [ISSUE_KEY]

Step 2: ถามว่าจะเปลี่ยนเป็น status ไหน

ใช้ AskUserQuestion กับ options จาก transitions

Step 3: Apply transition

bash
./scripts/jira-client.sh transition [ISSUE_KEY] [transition_id]

Note: Jira ใช้ workflow transitions แทนการเปลี่ยน status โดยตรง ต้องใช้ transition ID (ตัวเลข) ไม่ใช่ชื่อ status

Command: comment

เพิ่ม comment ใน issue

Step 1: ถาม comment

code
ใส่ comment สำหรับ [ISSUE_KEY]:

Step 2: Add comment

bash
./scripts/jira-client.sh comment [ISSUE_KEY] "[comment]"

Configuration

First-time Setup

  1. ไปที่ https://id.atlassian.com/manage-profile/security/api-tokens
  2. สร้าง API Token
  3. รัน /jira init

Config File Locations

TypeLocationPriority
Project.jira-config1 (highest)
User~/.config/claude-km/jira.conf2
EnvironmentJIRA_* variables3

Required Variables

bash
JIRA_DOMAIN="company.atlassian.net"
JIRA_EMAIL="user@example.com"
JIRA_API_TOKEN="your-api-token"
JIRA_PROJECT="PROJ"  # default project

Issue Type Mapping

Jira TypeGit Branch Prefix
Bugfix/
Taskfeat/
Storyfeat/
Epicfeat/
Improvementrefactor/
Sub-taskfeat/

Examples

bash
# Setup
/jira init
/jira test

# Browse issues
/jira list PROJ
/jira my
/jira get PROJ-123

# Create issue
/jira create

# Create Story/Epic with templates
./scripts/jira-client.sh create-story PROJ "Feature summary" --labels Backend,Player --due 2026-02-14
./scripts/jira-client.sh create-epic PROJ "Big Feature Initiative" --labels Backend

# Create subtasks with dependencies
./scripts/jira-client.sh create-subtask-templated PROJ-123 "Phase 1: Data Models" --labels Backend --blocks PROJ-125,PROJ-128
./scripts/jira-client.sh create-subtask-templated PROJ-123 "Phase 2: Win Processing" --labels Backend --blocked-by PROJ-124 --blocks PROJ-126

# Add labels and links
./scripts/jira-client.sh add-labels PROJ-123 Backend Player game
./scripts/jira-client.sh link blocks PROJ-124 PROJ-125

# Start work (use /focus with Jira path)
/focus  # then select "Jira (existing)" and enter PROJ-123

# Change status (use transition ID from /jira transitions)
/jira transitions PROJ-123  # see available transitions
/jira transition PROJ-123 31  # 31 = Done (example ID)
/jira comment PROJ-123 "Fixed the issue"

Integration with Other Commands

CommandJira Integration
/focusเลือกได้ว่าจะสร้าง GitHub Issue หรือ Jira
/tdอัพเดต Jira status เมื่อจบ session
/recapแสดง Jira issue ถ้ามี

Error Handling

Connection Error:

code
Error: Failed to connect to Jira
Check your credentials with: /jira init

Permission Error:

code
Error: Permission denied for [ISSUE_KEY]
You may not have access to this project

Invalid Issue:

code
Error: Issue not found: [ISSUE_KEY]
Check the issue key and try again