jira-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJira Integration Skill
Jira集成Skill
Retrieve, analyze, and update Jira tickets directly from your AI coding workflow. Supports both MCP-based (recommended) and direct REST API approaches.
可直接在你的AI编码工作流中检索、分析和更新Jira工单,同时支持基于MCP(推荐)和直接调用REST API两种方式。
When to Activate
何时启用
- Fetching a Jira ticket to understand requirements
- Extracting testable acceptance criteria from a ticket
- Adding progress comments to a Jira issue
- Transitioning a ticket status (To Do → In Progress → Done)
- Linking merge requests or branches to a Jira issue
- Searching for issues by JQL query
- 获取Jira工单以了解需求
- 从工单中提取可测试的验收标准
- 为Jira问题添加进度评论
- 流转工单状态(待办 → 进行中 → 已完成)
- 将合并请求或分支关联到Jira问题
- 通过JQL查询搜索问题
Prerequisites
前置条件
Option A: MCP Server (Recommended)
选项A:MCP服务器(推荐)
Install the MCP server. This exposes Jira tools directly to your AI agent.
mcp-atlassianRequirements:
- Python 3.10+
- (from
uvx), installed via your package manager or the officialuvinstallation documentationuv
Add to your MCP config (e.g., → ):
~/.claude.jsonmcpServersjson
{
"jira": {
"command": "uvx",
"args": ["mcp-atlassian==0.21.0"],
"env": {
"JIRA_URL": "https://YOUR_ORG.atlassian.net",
"JIRA_EMAIL": "your.email@example.com",
"JIRA_API_TOKEN": "your-api-token"
},
"description": "Jira issue tracking — search, create, update, comment, transition"
}
}Security: Never hardcode secrets. Prefer setting,JIRA_URL, andJIRA_EMAILin your system environment (or a secrets manager). Only use the MCPJIRA_API_TOKENblock for local, uncommitted config files.env
To get a Jira API token:
- Go to https://id.atlassian.com/manage-profile/security/api-tokens
- Click Create API token
- Copy the token — store it in your environment, never in source code
安装 MCP服务器,它会直接向你的AI Agent暴露Jira工具能力。
mcp-atlassian要求:
- Python 3.10+
- (来自
uvx),可通过包管理器或官方uv安装文档进行安装uv
添加到你的MCP配置中(例如的字段):
~/.claude.jsonmcpServersjson
{
"jira": {
"command": "uvx",
"args": ["mcp-atlassian==0.21.0"],
"env": {
"JIRA_URL": "https://YOUR_ORG.atlassian.net",
"JIRA_EMAIL": "your.email@example.com",
"JIRA_API_TOKEN": "your-api-token"
},
"description": "Jira问题追踪 — 搜索、创建、更新、评论、状态流转"
}
}安全提示: 永远不要硬编码密钥。建议将、JIRA_URL和JIRA_EMAIL配置在系统环境变量(或密钥管理器)中。仅在本地未提交的配置文件中使用MCP的JIRA_API_TOKEN配置块。env
获取Jira API token的方法:
- 访问 https://id.atlassian.com/manage-profile/security/api-tokens
- 点击创建API token
- 复制token并存到你的环境变量中,永远不要提交到源代码
Option B: Direct REST API
选项B:直接调用REST API
If MCP is not available, use the Jira REST API v3 directly via or a helper script.
curlRequired environment variables:
| Variable | Description |
|---|---|
| Your Jira instance URL (e.g., |
| Your Atlassian account email |
| API token from id.atlassian.com |
Store these in your shell environment, secrets manager, or an untracked local env file. Do not commit them to the repo.
如果无法使用MCP,可以通过或辅助脚本直接调用Jira REST API v3。
curl所需环境变量:
| 变量 | 描述 |
|---|---|
| 你的Jira实例地址(例如 |
| 你的Atlassian账号邮箱 |
| 从id.atlassian.com获取的API token |
将这些变量存储在你的shell环境、密钥管理器或未被追踪的本地env文件中,不要提交到代码仓库。
MCP Tools Reference
MCP工具参考
When the MCP server is configured, these tools are available:
mcp-atlassian| Tool | Purpose | Example |
|---|---|---|
| JQL queries | |
| Fetch full issue details by key | |
| Create issues (Task, Bug, Story, Epic) | New bug report |
| Update fields (summary, description, assignee) | Change assignee |
| Change status | Move to "In Review" |
| Add comments | Progress update |
| List issues in a sprint | Active sprint review |
| Link issues (Blocks, Relates to) | Dependency tracking |
| See linked PRs, branches, commits | Dev context |
Tip: Always callbefore transitioning — transition IDs vary per project workflow.jira_get_transitions
配置好 MCP服务器后,你可以使用以下工具:
mcp-atlassian| 工具 | 用途 | 示例 |
|---|---|---|
| JQL查询 | |
| 通过工单key获取完整问题详情 | |
| 创建问题(任务、Bug、需求、史诗) | 新Bug报告 |
| 更新字段(标题、描述、负责人) | 更换负责人 |
| 变更状态 | 移动到「审核中」 |
| 添加评论 | 进度更新 |
| 列出某个迭代中的所有问题 | 活跃迭代复盘 |
| 关联问题(阻塞、关联) | 依赖追踪 |
| 查看关联的PR、分支、提交 | 开发上下文 |
提示: 流转状态前请先调用— 不同项目的工作流对应的流转ID不一样。jira_get_transitions
Direct REST API Reference
直接REST API参考
Fetch a Ticket
获取工单
bash
curl -s -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
-H "Content-Type: application/json" \
"$JIRA_URL/rest/api/3/issue/PROJ-1234" | jq '{
key: .key,
summary: .fields.summary,
status: .fields.status.name,
priority: .fields.priority.name,
type: .fields.issuetype.name,
assignee: .fields.assignee.displayName,
labels: .fields.labels,
description: .fields.description
}'bash
curl -s -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
-H "Content-Type: application/json" \
"$JIRA_URL/rest/api/3/issue/PROJ-1234" | jq '{
key: .key,
summary: .fields.summary,
status: .fields.status.name,
priority: .fields.priority.name,
type: .fields.issuetype.name,
assignee: .fields.assignee.displayName,
labels: .fields.labels,
description: .fields.description
}'Fetch Comments
获取评论
bash
curl -s -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
-H "Content-Type: application/json" \
"$JIRA_URL/rest/api/3/issue/PROJ-1234?fields=comment" | jq '.fields.comment.comments[] | {
author: .author.displayName,
created: .created[:10],
body: .body
}'bash
curl -s -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
-H "Content-Type: application/json" \
"$JIRA_URL/rest/api/3/issue/PROJ-1234?fields=comment" | jq '.fields.comment.comments[] | {
author: .author.displayName,
created: .created[:10],
body: .body
}'Add a Comment
添加评论
bash
curl -s -X POST -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"body": {
"version": 1,
"type": "doc",
"content": [{
"type": "paragraph",
"content": [{"type": "text", "text": "Your comment here"}]
}]
}
}' \
"$JIRA_URL/rest/api/3/issue/PROJ-1234/comment"bash
curl -s -X POST -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"body": {
"version": 1,
"type": "doc",
"content": [{
"type": "paragraph",
"content": [{"type": "text", "text": "Your comment here"}]
}]
}
}' \
"$JIRA_URL/rest/api/3/issue/PROJ-1234/comment"Transition a Ticket
流转工单状态
bash
undefinedbash
undefined1. Get available transitions
1. 获取可用的流转选项
curl -s -u "$JIRA_EMAIL:$JIRA_API_TOKEN"
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions" | jq '.transitions[] | {id, name: .name}'
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions" | jq '.transitions[] | {id, name: .name}'
curl -s -u "$JIRA_EMAIL:$JIRA_API_TOKEN"
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions" | jq '.transitions[] | {id, name: .name}'
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions" | jq '.transitions[] | {id, name: .name}'
2. Execute transition (replace TRANSITION_ID)
2. 执行状态流转(替换TRANSITION_ID)
curl -s -X POST -u "$JIRA_EMAIL:$JIRA_API_TOKEN"
-H "Content-Type: application/json"
-d '{"transition": {"id": "TRANSITION_ID"}}'
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions"
-H "Content-Type: application/json"
-d '{"transition": {"id": "TRANSITION_ID"}}'
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions"
undefinedcurl -s -X POST -u "$JIRA_EMAIL:$JIRA_API_TOKEN"
-H "Content-Type: application/json"
-d '{"transition": {"id": "TRANSITION_ID"}}'
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions"
-H "Content-Type: application/json"
-d '{"transition": {"id": "TRANSITION_ID"}}'
"$JIRA_URL/rest/api/3/issue/PROJ-1234/transitions"
undefinedSearch with JQL
用JQL搜索
bash
curl -s -G -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
--data-urlencode "jql=project = PROJ AND status = 'In Progress'" \
"$JIRA_URL/rest/api/3/search"bash
curl -s -G -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
--data-urlencode "jql=project = PROJ AND status = 'In Progress'" \
"$JIRA_URL/rest/api/3/search"Analyzing a Ticket
工单分析
When retrieving a ticket for development or test automation, extract:
当你拉取工单用于开发或测试自动化时,请提取以下信息:
1. Testable Requirements
1. 可测试需求
- Functional requirements — What the feature does
- Acceptance criteria — Conditions that must be met
- Testable behaviors — Specific actions and expected outcomes
- User roles — Who uses this feature and their permissions
- Data requirements — What data is needed
- Integration points — APIs, services, or systems involved
- 功能需求 — 该特性的作用是什么
- 验收标准 — 必须满足的条件
- 可测试行为 — 具体操作和预期结果
- 用户角色 — 谁使用该特性以及对应的权限
- 数据要求 — 需要用到哪些数据
- 集成点 — 涉及的API、服务或系统
2. Test Types Needed
2. 所需测试类型
- Unit tests — Individual functions and utilities
- Integration tests — API endpoints and service interactions
- E2E tests — User-facing UI flows
- API tests — Endpoint contracts and error handling
- 单元测试 — 单个函数和工具方法
- 集成测试 — API端点和服务交互
- E2E测试 — 用户侧UI流程
- API测试 — 端点契约和错误处理
3. Edge Cases & Error Scenarios
3. 边界情况与错误场景
- Invalid inputs (empty, too long, special characters)
- Unauthorized access
- Network failures or timeouts
- Concurrent users or race conditions
- Boundary conditions
- Missing or null data
- State transitions (back navigation, refresh, etc.)
- 无效输入(空值、过长、特殊字符)
- 未授权访问
- 网络故障或超时
- 并发用户或竞态条件
- 边界值条件
- 缺失或空数据
- 状态流转(回退、刷新等)
4. Structured Analysis Output
4. 结构化分析输出
Ticket: PROJ-1234
Summary: [ticket title]
Status: [current status]
Priority: [High/Medium/Low]
Test Types: Unit, Integration, E2E
Requirements:
1. [requirement 1]
2. [requirement 2]
Acceptance Criteria:
- [ ] [criterion 1]
- [ ] [criterion 2]
Test Scenarios:
- Happy Path: [description]
- Error Case: [description]
- Edge Case: [description]
Test Data Needed:
- [data item 1]
- [data item 2]
Dependencies:
- [dependency 1]
- [dependency 2]工单: PROJ-1234
标题: [工单标题]
状态: [当前状态]
优先级: [高/中/低]
测试类型: 单元测试, 集成测试, E2E测试
需求:
1. [需求1]
2. [需求2]
验收标准:
- [ ] [标准1]
- [ ] [标准2]
测试场景:
- 正常路径: [描述]
- 错误场景: [描述]
- 边界场景: [描述]
所需测试数据:
- [数据项1]
- [数据项2]
依赖项:
- [依赖1]
- [依赖2]Updating Tickets
工单更新
When to Update
何时更新
| Workflow Step | Jira Update |
|---|---|
| Start work | Transition to "In Progress" |
| Tests written | Comment with test coverage summary |
| Branch created | Comment with branch name |
| PR/MR created | Comment with link, link issue |
| Tests passing | Comment with results summary |
| PR/MR merged | Transition to "Done" or "In Review" |
| 工作流步骤 | Jira更新操作 |
|---|---|
| 开始工作 | 流转到「进行中」 |
| 测试编写完成 | 评论说明测试覆盖率概况 |
| 创建分支 | 评论附上分支名称 |
| 创建PR/MR | 评论附上PR链接,关联工单 |
| 测试通过 | 评论附上测试结果概况 |
| PR/MR合并 | 流转到「已完成」或「审核中」 |
Comment Templates
评论模板
Starting Work:
Starting implementation for this ticket.
Branch: feat/PROJ-1234-feature-nameTests Implemented:
Automated tests implemented:
Unit Tests:
- [test file 1] — [what it covers]
- [test file 2] — [what it covers]
Integration Tests:
- [test file] — [endpoints/flows covered]
All tests passing locally. Coverage: XX%PR Created:
Pull request created:
[PR Title](https://github.com/org/repo/pull/XXX)
Ready for review.Work Complete:
Implementation complete.
PR merged: [link]
Test results: All passing (X/Y)
Coverage: XX%开始工作:
开始实现该工单需求。
分支: feat/PROJ-1234-feature-name测试实现完成:
已实现自动化测试:
单元测试:
- [测试文件1] — [覆盖范围]
- [测试文件2] — [覆盖范围]
集成测试:
- [测试文件] — [覆盖的端点/流程]
所有测试本地运行通过。覆盖率: XX%PR已创建:
已提交Pull Request:
[PR标题](https://github.com/org/repo/pull/XXX)
可进行审核。工作完成:
需求实现完成。
PR已合并: [链接]
测试结果: 全部通过 (X/Y)
覆盖率: XX%Security Guidelines
安全指南
- Never hardcode Jira API tokens in source code or skill files
- Always use environment variables or a secrets manager
- Add to
.envin every project.gitignore - Rotate tokens immediately if exposed in git history
- Use least-privilege API tokens scoped to required projects
- Validate that credentials are set before making API calls — fail fast with a clear message
- 永远不要在源代码或技能文件中硬编码Jira API token
- 始终使用环境变量或密钥管理器存储凭证
- 在所有项目的中添加
.gitignore.env - 如果token泄露到git历史中,立即轮换
- 使用最小权限的API token,仅授予所需项目的访问权限
- 发起API调用前校验凭证是否已配置 — 快速失败并给出明确提示
Troubleshooting
问题排查
| Error | Cause | Fix |
|---|---|---|
| Invalid or expired API token | Regenerate at id.atlassian.com |
| Token lacks project permissions | Check token scopes and project access |
| Wrong ticket key or base URL | Verify |
| IDE cannot find | Use full path (e.g., |
| Connection timeout | Network/VPN issue | Check VPN connection and firewall rules |
| 错误 | 原因 | 解决方法 |
|---|---|---|
| API token无效或已过期 | 到id.atlassian.com重新生成 |
| Token没有项目权限 | 检查token权限范围和项目访问权限 |
| 工单key或基础URL错误 | 校验 |
| IDE在PATH中找不到 | 使用完整路径(例如 |
| 连接超时 | 网络/VPN问题 | 检查VPN连接和防火墙规则 |
Best Practices
最佳实践
- Update Jira as you go, not all at once at the end
- Keep comments concise but informative
- Link rather than copy — point to PRs, test reports, and dashboards
- Use @mentions if you need input from others
- Check linked issues to understand full feature scope before starting
- If acceptance criteria are vague, ask for clarification before writing code
- 随工作进度同步更新Jira,不要等到最后一次性更新
- 评论简洁但信息完整
- 优先使用链接而非复制内容 — 指向PR、测试报告和看板
- 如果你需要其他人的输入请使用@提及
- 开始开发前先检查关联问题,了解完整的特性范围
- 如果验收标准模糊,先询问清楚再编写代码