jira-safe
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJira SAFe (Scaled Agile Framework) Skill
Jira SAFe(规模化敏捷框架)技能
Implements SAFe methodology for Epic, Feature, Story, and Task management in Jira Cloud.
在Jira Cloud中为Epic、Feature、Story和Task管理实施SAFe方法论。
When to Use
适用场景
- Creating Epics with business outcomes and acceptance criteria
- Writing user stories in SAFe format ("As a... I want... So that...")
- Breaking down Features into Stories with acceptance criteria
- Creating Subtasks under Stories
- Linking work items in proper hierarchy (Epic → Feature → Story → Subtask)
- 创建包含业务成果和验收标准的Epic
- 以SAFe格式编写用户故事("作为... 我希望... 以便...")
- 将Feature拆解为带有验收标准的Story
- 在Story下创建子任务
- 按正确层级关联工作项(Epic → Feature → Story → 子任务)
CRITICAL: Next-Gen vs Classic Projects
重要提示:下一代项目与经典项目对比
SCRUM project is Next-Gen (Team-managed). Key differences:
| Aspect | Classic (Company-managed) | Next-Gen (Team-managed) |
|---|---|---|
| Epic Link | | |
| Epic Name | | Not available |
| Subtask Type | | |
| Project Style | | |
Always detect project type first:
javascript
const projectInfo = await fetch(`${JIRA_URL}/rest/api/3/project/${PROJECT_KEY}`, { headers });
const project = await projectInfo.json();
const isNextGen = project.style === 'next-gen' || project.simplified === true;SCRUM项目属于下一代(团队管理)类型。主要差异:
| 方面 | 经典版(企业管理) | 下一代(团队管理) |
|---|---|---|
| Epic关联 | | |
| Epic名称 | | 不可用 |
| 子任务类型 | | |
| 项目风格 | | |
请始终先检测项目类型:
javascript
const projectInfo = await fetch(`${JIRA_URL}/rest/api/3/project/${PROJECT_KEY}`, { headers });
const project = await projectInfo.json();
const isNextGen = project.style === 'next-gen' || project.simplified === true;SAFe Hierarchy in Jira
Jira中的SAFe层级结构
Portfolio Level:
└── Epic (Strategic Initiative)
└── Feature (Benefit Hypothesis)
└── Story (User Value)
└── Subtask (Technical Work)组合级:
└── Epic(战略举措)
└── Feature(效益假设)
└── Story(用户价值)
└── Subtask(技术工作)SAFe Templates
SAFe模板
Epic Template (Next-Gen)
下一代项目Epic模板
javascript
// NOTE: Next-Gen projects do NOT use customfield_10011 (Epic Name)
const epic = {
fields: {
project: { key: 'PROJECT_KEY' },
issuetype: { name: 'Epic' },
summary: '[Epic ID]: [Epic Name] - [Business Outcome]',
description: {
type: 'doc',
version: 1,
content: [
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Business Outcome' }]
},
{
type: 'paragraph',
content: [{ type: 'text', text: 'Describe the measurable business value...' }]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Success Metrics' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Metric 1: [measurable target]' }] }]
}
]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Scope' }]
},
{
type: 'paragraph',
content: [{ type: 'text', text: 'What is in scope and out of scope...' }]
}
]
},
labels: ['epic-label'] // Use labels instead of Epic Name for categorization
}
};javascript
// NOTE: Next-Gen projects do NOT use customfield_10011 (Epic Name)
const epic = {
fields: {
project: { key: 'PROJECT_KEY' },
issuetype: { name: 'Epic' },
summary: '[Epic ID]: [Epic Name] - [Business Outcome]',
description: {
type: 'doc',
version: 1,
content: [
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Business Outcome' }]
},
{
type: 'paragraph',
content: [{ type: 'text', text: 'Describe the measurable business value...' }]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Success Metrics' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Metric 1: [measurable target]' }] }]
}
]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Scope' }]
},
{
type: 'paragraph',
content: [{ type: 'text', text: 'What is in scope and out of scope...' }]
}
]
},
labels: ['epic-label'] // Use labels instead of Epic Name for categorization
}
};Story Template (SAFe Format, Next-Gen)
下一代项目SAFe格式Story模板
javascript
// NOTE: Next-Gen uses 'parent' field, NOT customfield_10014
const story = {
fields: {
project: { key: 'PROJECT_KEY' },
issuetype: { name: 'Story' },
summary: '[US-ID]: As a [persona], I want [goal], so that [benefit]',
description: {
type: 'doc',
version: 1,
content: [
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'User Story' }]
},
{
type: 'paragraph',
content: [
{ type: 'text', text: 'As a ', marks: [{ type: 'strong' }] },
{ type: 'text', text: '[persona]' },
{ type: 'text', text: ', I want ', marks: [{ type: 'strong' }] },
{ type: 'text', text: '[goal]' },
{ type: 'text', text: ', so that ', marks: [{ type: 'strong' }] },
{ type: 'text', text: '[benefit]' }
]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Acceptance Criteria' }]
},
{
type: 'heading',
attrs: { level: 3 },
content: [{ type: 'text', text: 'Scenario 1: [Name]' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'GIVEN [precondition]', marks: [{ type: 'strong' }] }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'WHEN [action]', marks: [{ type: 'strong' }] }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'THEN [expected result]', marks: [{ type: 'strong' }] }] }]
}
]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Definition of Done' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Code reviewed and approved' }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Unit tests written and passing' }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Integration tests passing' }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Documentation updated' }] }]
}
]
}
]
},
// Next-Gen: Link to parent Epic using 'parent' field
parent: { key: 'EPIC_KEY' },
labels: ['category-label', 'epic-id']
}
};javascript
// NOTE: Next-Gen uses 'parent' field, NOT customfield_10014
const story = {
fields: {
project: { key: 'PROJECT_KEY' },
issuetype: { name: 'Story' },
summary: '[US-ID]: As a [persona], I want [goal], so that [benefit]',
description: {
type: 'doc',
version: 1,
content: [
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'User Story' }]
},
{
type: 'paragraph',
content: [
{ type: 'text', text: 'As a ', marks: [{ type: 'strong' }] },
{ type: 'text', text: '[persona]' },
{ type: 'text', text: ', I want ', marks: [{ type: 'strong' }] },
{ type: 'text', text: '[goal]' },
{ type: 'text', text: ', so that ', marks: [{ type: 'strong' }] },
{ type: 'text', text: '[benefit]' }
]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Acceptance Criteria' }]
},
{
type: 'heading',
attrs: { level: 3 },
content: [{ type: 'text', text: 'Scenario 1: [Name]' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'GIVEN [precondition]', marks: [{ type: 'strong' }] }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'WHEN [action]', marks: [{ type: 'strong' }] }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'THEN [expected result]', marks: [{ type: 'strong' }] }] }]
}
]
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Definition of Done' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Code reviewed and approved' }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Unit tests written and passing' }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Integration tests passing' }] }]
},
{
type: 'listItem',
content: [{ type: 'paragraph', content: [{ type: 'text', text: '[ ] Documentation updated' }] }]
}
]
}
]
},
// Next-Gen: Link to parent Epic using 'parent' field
parent: { key: 'EPIC_KEY' },
labels: ['category-label', 'epic-id']
}
};Subtask Template (Next-Gen)
下一代项目子任务模板
javascript
// NOTE: Next-Gen uses 'Subtask' (no hyphen), NOT 'Sub-task'
const subtask = {
fields: {
project: { key: 'PROJECT_KEY' },
issuetype: { name: 'Subtask' }, // Next-Gen: 'Subtask', Classic: 'Sub-task'
summary: '[Technical task description]',
// Parent Story (required for subtasks)
parent: { key: 'STORY_KEY' }
// Note: Description is optional for subtasks
}
};javascript
// NOTE: Next-Gen uses 'Subtask' (no hyphen), NOT 'Sub-task'
const subtask = {
fields: {
project: { key: 'PROJECT_KEY' },
issuetype: { name: 'Subtask' }, // Next-Gen: 'Subtask', Classic: 'Sub-task'
summary: '[Technical task description]',
// Parent Story (required for subtasks)
parent: { key: 'STORY_KEY' }
// Note: Description is optional for subtasks
}
};API Implementation (Next-Gen Projects)
API实现(下一代项目)
Create Epic with Stories (Next-Gen)
创建关联Story的Epic(下一代项目)
javascript
async function createEpicWithStories(epicFields, storyDefinitions) {
const headers = {
'Authorization': `Basic ${Buffer.from(`${EMAIL}:${TOKEN}`).toString('base64')}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
};
// 1. Create Epic
const epicResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify({ fields: epicFields })
});
if (!epicResponse.ok) {
const error = await epicResponse.text();
throw new Error(`Epic creation failed: ${error}`);
}
const createdEpic = await epicResponse.json();
console.log(`Created Epic: ${createdEpic.key}`);
// 2. Create Stories linked to Epic using 'parent' field (Next-Gen)
const createdStories = [];
for (const storyDef of storyDefinitions) {
const storyFields = {
...storyDef,
parent: { key: createdEpic.key } // Next-Gen: use 'parent', NOT customfield_10014
};
const storyResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify({ fields: storyFields })
});
if (!storyResponse.ok) {
const error = await storyResponse.text();
console.error(`Story creation failed: ${error}`);
continue;
}
const createdStory = await storyResponse.json();
createdStories.push(createdStory);
console.log(` Created Story: ${createdStory.key}`);
// Rate limiting
await new Promise(r => setTimeout(r, 100));
}
return { epic: createdEpic, stories: createdStories };
}javascript
async function createEpicWithStories(epicFields, storyDefinitions) {
const headers = {
'Authorization': `Basic ${Buffer.from(`${EMAIL}:${TOKEN}`).toString('base64')}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
};
// 1. Create Epic
const epicResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify({ fields: epicFields })
});
if (!epicResponse.ok) {
const error = await epicResponse.text();
throw new Error(`Epic creation failed: ${error}`);
}
const createdEpic = await epicResponse.json();
console.log(`Created Epic: ${createdEpic.key}`);
// 2. Create Stories linked to Epic using 'parent' field (Next-Gen)
const createdStories = [];
for (const storyDef of storyDefinitions) {
const storyFields = {
...storyDef,
parent: { key: createdEpic.key } // Next-Gen: use 'parent', NOT customfield_10014
};
const storyResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify({ fields: storyFields })
});
if (!storyResponse.ok) {
const error = await storyResponse.text();
console.error(`Story creation failed: ${error}`);
continue;
}
const createdStory = await storyResponse.json();
createdStories.push(createdStory);
console.log(` Created Story: ${createdStory.key}`);
// Rate limiting
await new Promise(r => setTimeout(r, 100));
}
return { epic: createdEpic, stories: createdStories };
}Create Story with Subtasks (Next-Gen)
创建关联子任务的Story(下一代项目)
javascript
async function createStoryWithSubtasks(storyFields, epicKey, subtaskSummaries) {
const headers = {
'Authorization': `Basic ${Buffer.from(`${EMAIL}:${TOKEN}`).toString('base64')}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
};
// 1. Create Story under Epic
const storyRequest = {
fields: {
...storyFields,
parent: { key: epicKey } // Link to Epic
}
};
const storyResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify(storyRequest)
});
if (!storyResponse.ok) {
throw new Error(`Story creation failed: ${await storyResponse.text()}`);
}
const createdStory = await storyResponse.json();
// 2. Create Subtasks under Story
const createdSubtasks = [];
for (const summary of subtaskSummaries) {
const subtaskResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify({
fields: {
project: { key: storyFields.project.key },
issuetype: { name: 'Subtask' }, // Next-Gen: 'Subtask', NOT 'Sub-task'
summary: summary,
parent: { key: createdStory.key }
}
})
});
if (subtaskResponse.ok) {
createdSubtasks.push(await subtaskResponse.json());
}
await new Promise(r => setTimeout(r, 50)); // Rate limiting
}
return { story: createdStory, subtasks: createdSubtasks };
}javascript
async function createStoryWithSubtasks(storyFields, epicKey, subtaskSummaries) {
const headers = {
'Authorization': `Basic ${Buffer.from(`${EMAIL}:${TOKEN}`).toString('base64')}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
};
// 1. Create Story under Epic
const storyRequest = {
fields: {
...storyFields,
parent: { key: epicKey } // Link to Epic
}
};
const storyResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify(storyRequest)
});
if (!storyResponse.ok) {
throw new Error(`Story creation failed: ${await storyResponse.text()}`);
}
const createdStory = await storyResponse.json();
// 2. Create Subtasks under Story
const createdSubtasks = [];
for (const summary of subtaskSummaries) {
const subtaskResponse = await fetch(`${JIRA_URL}/rest/api/3/issue`, {
method: 'POST',
headers,
body: JSON.stringify({
fields: {
project: { key: storyFields.project.key },
issuetype: { name: 'Subtask' }, // Next-Gen: 'Subtask', NOT 'Sub-task'
summary: summary,
parent: { key: createdStory.key }
}
})
});
if (subtaskResponse.ok) {
createdSubtasks.push(await subtaskResponse.json());
}
await new Promise(r => setTimeout(r, 50)); // Rate limiting
}
return { story: createdStory, subtasks: createdSubtasks };
}Get Epic Link Field ID
获取Epic关联字段ID
Epic link field varies by Jira instance. Find it:
javascript
async function findEpicLinkField() {
const response = await fetch(`${JIRA_URL}/rest/api/3/field`, { headers });
const fields = await response.json();
const epicLinkField = fields.find(f =>
f.name === 'Epic Link' ||
f.name.toLowerCase().includes('epic link')
);
return epicLinkField?.id; // Usually customfield_10014
}Epic关联字段因Jira实例而异,查找方法:
javascript
async function findEpicLinkField() {
const response = await fetch(`${JIRA_URL}/rest/api/3/field`, { headers });
const fields = await response.json();
const epicLinkField = fields.find(f =>
f.name === 'Epic Link' ||
f.name.toLowerCase().includes('epic link')
);
return epicLinkField?.id; // Usually customfield_10014
}Bulk Delete Issues
批量删除问题
javascript
async function bulkDeleteIssues(projectKey, maxResults = 100) {
// Search for all issues
const jql = encodeURIComponent(`project = ${projectKey} ORDER BY key ASC`);
const searchResponse = await fetch(
`${JIRA_URL}/rest/api/3/search/jql?jql=${jql}&maxResults=${maxResults}&fields=key`,
{ headers }
);
const { issues } = await searchResponse.json();
// Delete each issue
for (const issue of issues) {
await fetch(`${JIRA_URL}/rest/api/3/issue/${issue.key}?deleteSubtasks=true`, {
method: 'DELETE',
headers
});
console.log(`Deleted: ${issue.key}`);
await new Promise(r => setTimeout(r, 100)); // Rate limit
}
return issues.length;
}javascript
async function bulkDeleteIssues(projectKey, maxResults = 100) {
// Search for all issues
const jql = encodeURIComponent(`project = ${projectKey} ORDER BY key ASC`);
const searchResponse = await fetch(
`${JIRA_URL}/rest/api/3/search/jql?jql=${jql}&maxResults=${maxResults}&fields=key`,
{ headers }
);
const { issues } = await searchResponse.json();
// Delete each issue
for (const issue of issues) {
await fetch(`${JIRA_URL}/rest/api/3/issue/${issue.key}?deleteSubtasks=true`, {
method: 'DELETE',
headers
});
console.log(`Deleted: ${issue.key}`);
await new Promise(r => setTimeout(r, 100)); // Rate limit
}
return issues.length;
}SAFe Best Practices
SAFe最佳实践
Epic Naming
Epic命名规范
- Format:
[Domain] - [Business Outcome] - Example:
Marketing Copilot - Enable 24/7 Brand-Aware Content Generation
- 格式:
[领域] - [业务成果] - 示例:
Marketing Copilot - Enable 24/7 Brand-Aware Content Generation
Story Naming (INVEST Criteria)
Story命名(INVEST原则)
- Independent: Can be developed separately
- Negotiable: Details can be discussed
- Valuable: Delivers user value
- Estimable: Can be sized
- Small: Fits in a sprint
- Testable: Has clear acceptance criteria
- Independent(独立):可独立开发
- Negotiable(可协商):细节可讨论
- Valuable(有价值):交付用户价值
- Estimable(可估算):可进行规模估算
- Small(小型):可在一个迭代内完成
- Testable(可测试):有明确的验收标准
Story Format
Story格式
As a [specific persona],
I want [concrete action/capability],
So that [measurable benefit].作为[特定角色],
我希望[具体操作/能力],
以便[可衡量的收益]。Acceptance Criteria (Given-When-Then)
验收标准(Given-When-Then格式)
Scenario: [Descriptive name]
GIVEN [initial context/precondition]
WHEN [action/event occurs]
THEN [expected outcome]
AND [additional outcome if needed]场景:[描述性名称]
假设[初始上下文/前置条件]
当[操作/事件发生]
则[预期结果]
并且[如有需要,补充其他结果]Issue Link Types (Next-Gen)
问题关联类型(下一代项目)
| Link Type | Use Case | Field |
|---|---|---|
| Parent (Next-Gen) | Story → Epic | |
| Parent (Next-Gen) | Subtask → Story | |
| Blocks/Is blocked by | Dependencies | Link type |
| Relates to | Related items | Link type |
Classic Projects Only:
| Link Type | Use Case | Field |
|---|---|---|
| Epic Link | Story → Epic | |
| Epic Name | Epic short name | |
| 关联类型 | 适用场景 | 字段 |
|---|---|---|
| Parent(下一代) | Story → Epic | |
| Parent(下一代) | Subtask → Story | |
| Blocks/Is blocked by(阻塞/被阻塞) | 依赖关系 | 关联类型 |
| Relates to(相关) | 相关项 | 关联类型 |
仅适用于经典版项目:
| 关联类型 | 适用场景 | 字段 |
|---|---|---|
| Epic Link | Story → Epic | |
| Epic Name | Epic简称 | |
Custom Fields by Project Type
按项目类型划分的自定义字段
Next-Gen (Team-managed) - SCRUM Project
下一代(团队管理)SCRUM项目
| Purpose | Method |
|---|---|
| Link Story to Epic | |
| Link Subtask to Story | |
| Subtask issue type | |
| 用途 | 实现方式 |
|---|---|
| Story关联到Epic | |
| Subtask关联到Story | |
| 子任务类型 | |
Classic (Company-managed)
经典版(企业管理)
| Field | ID (typical) | Purpose |
|---|---|---|
| Epic Link | customfield_10014 | Links Story to Epic |
| Epic Name | customfield_10011 | Short name for Epic |
| Story Points | customfield_10016 | Estimation |
| Sprint | customfield_10007 | Sprint assignment |
| 字段 | 典型ID | 用途 |
|---|---|---|
| Epic Link | customfield_10014 | Story关联到Epic |
| Epic Name | customfield_10011 | Epic简称 |
| Story Points | customfield_10016 | 估算 |
| Sprint | customfield_10007 | 迭代分配 |
Error Handling
错误处理
javascript
async function safeJiraRequest(url, options = {}) {
const response = await fetch(url, { ...options, headers });
if (!response.ok) {
const error = await response.text();
throw new Error(`Jira API ${response.status}: ${error.substring(0, 200)}`);
}
if (response.status === 204) return null;
return response.json();
}javascript
async function safeJiraRequest(url, options = {}) {
const response = await fetch(url, { ...options, headers });
if (!response.ok) {
const error = await response.text();
throw new Error(`Jira API ${response.status}: ${error.substring(0, 200)}`);
}
if (response.status === 204) return null;
return response.json();
}