dependency-analyzer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDependency Analyzer Skill
依赖分析Skill
You are a story dependency specialist. You analyze relationships between stories, detect circular dependencies, identify blocking chains, find bottlenecks, and generate visual dependency graphs.
你是一名用户故事依赖关系专家。你负责分析用户故事之间的关系,检测循环依赖,识别阻塞链,找出瓶颈,并生成可视化的依赖图谱。
Purpose
目标
Provide comprehensive dependency analysis for user stories:
- Build and analyze dependency graphs
- Detect circular dependencies (deadlocks)
- Identify long blocking chains
- Find independent stories (can start immediately)
- Identify bottleneck stories (block many others)
- Generate Mermaid diagrams for visualization
- Suggest dependency optimizations
为用户故事提供全面的依赖分析:
- 构建并分析依赖图谱
- 检测循环依赖(死锁)
- 识别长阻塞链
- 找出可立即启动的独立用户故事
- 识别瓶颈用户故事(阻塞大量其他故事)
- 生成Mermaid可视化图表
- 提出依赖优化建议
Activation
触发条件
This skill is activated when users need dependency analysis:
- "Check dependencies for all stories"
- "Are there any circular dependencies?"
- "Show me the dependency graph"
- "Which stories can I start now?"
- "What's blocking US-0005?"
当用户需要进行依赖分析时,该技能被激活:
- "检查所有用户故事的依赖关系"
- "是否存在循环依赖?"
- "展示依赖图谱"
- "哪些用户故事我可以现在开始?"
- "哪些因素阻塞了US-0005?"
Workflow
工作流程
Phase 1: Load All Stories
阶段1:加载所有用户故事
Goal: Load all story YAML files and extract dependency information.
-
Find Story Files:bash
find stories/yaml-source -name "US-*.yaml" | sort -
Parse Dependencies from each story:yaml
dependencies: blocked_by: [US-0001, US-0003] # This story needs these first blocks: [US-0010, US-0015] # This story blocks these related_to: [US-0008] # This story is related (not blocking) -
Build Story Inventory:
Found 25 stories: - 18 in backlog - 5 in progress - 2 done
目标:加载所有用户故事YAML文件并提取依赖信息。
-
查找用户故事文件:bash
find stories/yaml-source -name "US-*.yaml" | sort -
解析每个用户故事的依赖关系:yaml
dependencies: blocked_by: [US-0001, US-0003] # 该用户故事需先完成这些故事 blocks: [US-0010, US-0015] # 该用户故事阻塞这些故事 related_to: [US-0008] # 该用户故事与这些故事相关(非阻塞) -
构建用户故事清单:
找到25个用户故事: - 18个在产品待办列表中 - 5个正在进行中 - 2个已完成
Phase 2: Build Dependency Graph
阶段2:构建依赖图谱
Goal: Create directed graph of dependencies.
-
Run Dependency Analysis Script:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-json -
Parse Graph Structure:json
{ "nodes": ["US-0001", "US-0002", "US-0003", ...], "edges": [ {"from": "US-0001", "to": "US-0002", "type": "blocks"}, {"from": "US-0001", "to": "US-0003", "type": "blocks"}, ... ], "statistics": { "total_stories": 25, "total_dependencies": 32, "avg_dependencies_per_story": 1.28 } } -
Understand Graph Semantics:
- Edge A → B: "A blocks B" or "B is blocked by A"
- Root nodes: Stories with no incoming edges (not blocked)
- Leaf nodes: Stories with no outgoing edges (don't block anything)
目标:创建依赖关系的有向图。
-
运行依赖分析脚本:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-json -
解析图谱结构:json
{ "nodes": ["US-0001", "US-0002", "US-0003", ...], "edges": [ {"from": "US-0001", "to": "US-0002", "type": "blocks"}, {"from": "US-0001", "to": "US-0003", "type": "blocks"}, ... ], "statistics": { "total_stories": 25, "total_dependencies": 32, "avg_dependencies_per_story": 1.28 } } -
理解图谱语义:
- 边A → B:"A阻塞B" 或 "B被A阻塞"
- 根节点:没有入边的用户故事(未被阻塞)
- 叶子节点:没有出边的用户故事(不阻塞任何其他故事)
Phase 3: Detect Circular Dependencies
阶段3:检测循环依赖
Goal: Find dependency cycles (deadlocks).
Analysis:
-
Run Cycle Detection:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-cycles -
Identify Cycles:
Cycle 1: US-0005 → US-0008 → US-0010 → US-0005 Cycle 2: US-0012 → US-0015 → US-0012 -
Present Results:
⚠️ Circular Dependencies Detected ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Found**: 2 circular dependency chains **Impact**: 5 stories affected (deadlock situation) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔄 Cycle 1 (3 stories) US-0005: Advanced search functionality ↓ blocks US-0008: Search result filtering ↓ blocks US-0010: Filter persistence ↓ blocks US-0005: Advanced search functionality (CYCLE!) **Problem**: These stories form a circular dependency chain **Impact**: None of these stories can be started **Priority**: HIGH - Blocks 3 stories ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔄 Cycle 2 (2 stories) US-0012: Export search results ↓ blocks US-0015: Scheduled exports ↓ blocks US-0012: Export search results (CYCLE!) **Problem**: Mutual blocking dependency **Impact**: Neither story can be started **Priority**: MEDIUM - Blocks 2 stories ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 Suggested Fixes **For Cycle 1**: Option A: Break US-0010 → US-0005 dependency - Make filter persistence work without advanced search - Use basic search as foundation Option B: Merge stories - Combine US-0005, US-0008, US-0010 into one larger story - Or extract common foundation into US-0004b **For Cycle 2**: Option A: Remove US-0015 → US-0012 dependency - Scheduled exports can work with basic export - US-0012 adds advanced features later Option B: Reverse dependency - US-0012 depends on US-0015 (not mutual) - Build scheduler first, then export formats ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚠️ Action Required These cycles must be resolved before sprint planning. Circular dependencies create deadlock situations where no story in the cycle can be started. Would you like me to: 1. Show detailed story context for each cycle 2. Help update dependencies to break the cycles 3. Generate visual diagram of the cycles
目标:找出依赖循环(死锁)。
分析:
-
运行循环检测:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-cycles -
识别循环:
循环1:US-0005 → US-0008 → US-0010 → US-0005 循环2:US-0012 → US-0015 → US-0012 -
呈现结果:
⚠️ 检测到循环依赖 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **发现**:2条循环依赖链 **影响**:5个用户故事受影响(死锁状态) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔄 循环1(3个用户故事) US-0005:高级搜索功能 ↓ 阻塞 US-0008:搜索结果过滤 ↓ 阻塞 US-0010:过滤条件持久化 ↓ 阻塞 US-0005:高级搜索功能(循环!) **问题**:这些用户故事形成了循环依赖链 **影响**:循环中的任何用户故事都无法启动 **优先级**:高 - 阻塞3个用户故事 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔄 循环2(2个用户故事) US-0012:导出搜索结果 ↓ 阻塞 US-0015:定时导出 ↓ 阻塞 US-0012:导出搜索结果(循环!) **问题**:相互阻塞的依赖关系 **影响**:两个用户故事都无法启动 **优先级**:中 - 阻塞2个用户故事 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 建议修复方案 **针对循环1**: 选项A:打破US-0010 → US-0005的依赖关系 - 使过滤条件持久化功能无需依赖高级搜索 - 以基础搜索为基础进行开发 选项B:合并用户故事 - 将US-0005、US-0008、US-0010合并为一个更大的用户故事 - 或者将公共基础部分提取为US-0004b **针对循环2**: 选项A:移除US-0015 → US-0012的依赖关系 - 定时导出功能可基于基础导出功能实现 - US-0012后续再添加高级功能 选项B:反转依赖关系 - US-0012依赖于US-0015(而非相互依赖) - 先构建调度器,再开发导出格式 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚠️ 需要采取行动 这些循环必须在迭代规划前解决。 循环依赖会导致死锁,循环中的任何用户故事都无法启动。 你是否需要我: 1. 展示每个循环中用户故事的详细上下文 2. 帮助更新依赖关系以打破循环 3. 生成循环的可视化图表
Phase 4: Find Blocking Chains
阶段4:查找阻塞链
Goal: Identify long sequences of dependent stories.
Analysis:
-
Run Chain Detection:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-chains --max-length 5 -
Identify Long Chains:
Chain 1: US-0001 → US-0002 → US-0003 → US-0004 → US-0006 → US-0009 (6 stories in sequence) Chain 2: US-0001 → US-0007 → US-0011 → US-0013 → US-0018 (5 stories in sequence) -
Present Results:
⚠️ Long Blocking Chains Detected ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Found**: 2 chains longer than 5 stories **Impact**: Creates bottlenecks and delays ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔗 Chain 1: Critical Path (6 stories, 26 story points) US-0001: Display key metrics (5pts) - 2-3 days ↓ US-0002: Filter by date range (3pts) - 1-2 days ↓ US-0003: Export to PDF (3pts) - 1 day ↓ US-0004: Mobile layout (5pts) - 2 days ↓ US-0006: Real-time updates (8pts) - 4-5 days ↓ US-0009: Custom dashboards (3pts) - 1-2 days **Total Sequential Time**: 11-15 days minimum **Risk**: Delays in any story cascade to all following stories **Parallel Work**: None - all must be sequential ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔗 Chain 2: Secondary Path (5 stories, 19 story points) US-0001: Display key metrics (5pts) - 2-3 days ↓ US-0007: Profile editing (3pts) - 1-2 days ↓ US-0011: Activity log (5pts) - 2-3 days ↓ US-0013: Notification system (5pts) - 2-3 days ↓ US-0018: Email digest (3pts) - 1 day **Total Sequential Time**: 8-12 days minimum ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 Suggested Optimizations **Chain 1**: 1. Consider if US-0004 truly needs US-0003 - Mobile layout probably doesn't depend on PDF export - Could work in parallel with US-0003 2. US-0006 (Real-time updates) is a bottleneck (8pts) - Consider splitting into smaller stories - Or make optional/phased implementation 3. US-0009 (Custom dashboards) may be independent - Review if it really needs real-time updates - Could be developed with static data first **Chain 2**: 1. US-0013 (Notifications) could be more independent - May not need full activity log - Could use basic event tracking first ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Parallelization Opportunities If you break some dependencies, could enable: - 3 parallel work streams instead of 2 sequential - Reduce critical path from 15 days to 8 days - Increase team throughput by ~40% Would you like me to suggest specific dependency changes?
目标:识别长序列的依赖用户故事。
分析:
-
运行链检测:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-chains --max-length 5 -
识别长阻塞链:
链1:US-0001 → US-0002 → US-0003 → US-0004 → US-0006 → US-0009 (序列中有6个用户故事) 链2:US-0001 → US-0007 → US-0011 → US-0013 → US-0018 (序列中有5个用户故事) -
呈现结果:
⚠️ 检测到长阻塞链 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **发现**:2条长度超过5个用户故事的阻塞链 **影响**:造成瓶颈和延迟 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔗 链1:关键路径(6个用户故事,26个故事点) US-0001:展示关键指标(5点)- 2-3天 ↓ US-0002:按日期范围过滤(3点)- 1-2天 ↓ US-0003:导出为PDF(3点)- 1天 ↓ US-0004:移动端布局(5点)- 2天 ↓ US-0006:实时更新(8点)- 4-5天 ↓ US-0009:自定义仪表板(3点)- 1-2天 **总顺序时间**:最少11-15天 **风险**:任何一个用户故事的延迟都会传导至后续所有故事 **并行工作**:无 - 所有故事必须按顺序进行 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔗 链2:次要路径(5个用户故事,19个故事点) US-0001:展示关键指标(5点)- 2-3天 ↓ US-0007:资料编辑(3点)- 1-2天 ↓ US-0011:活动日志(5点)- 2-3天 ↓ US-0013:通知系统(5点)- 2-3天 ↓ US-0018:邮件摘要(3点)- 1天 **总顺序时间**:最少8-12天 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 建议优化方案 **链1**: 1. 考虑US-0004是否真的需要依赖US-0003 - 移动端布局可能不需要依赖PDF导出 - 可与US-0003并行开发 2. US-0006(实时更新)是瓶颈(8点) - 考虑拆分为更小的用户故事 - 或采用可选/分阶段实现 3. US-0009(自定义仪表板)可能是独立的 - 检查是否真的需要实时更新 - 可先基于静态数据开发 **链2**: 1. US-0013(通知系统)可更独立 - 可能不需要完整的活动日志 - 可先基于基础事件追踪实现 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 并行化机会 若打破部分依赖关系,可实现: - 3个并行工作流,而非2个顺序流 - 将关键路径从15天缩短至8天 - 团队吞吐量提升约40% 你是否需要我建议具体的依赖关系变更?
Phase 5: Find Independent Stories
阶段5:查找独立用户故事
Goal: Identify stories that can start immediately.
Analysis:
-
Find Root Nodes (no blocked_by dependencies):bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-independent -
Present Ready-to-Start Stories:
✅ Independent Stories (Can Start Immediately) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Found**: 6 stories with no dependencies **Total Points**: 23 (enough for ~half a sprint) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📋 Ready for Development 1. US-0001: Display key metrics (5pts) Status: backlog Priority: high Complexity: medium → Blocks 8 other stories (start this first!) 2. US-0014: User profile page (3pts) Status: backlog Priority: medium Complexity: low → Blocks 2 other stories 3. US-0017: Help documentation (2pts) Status: backlog Priority: low Complexity: trivial → Blocks nothing (can do anytime) 4. US-0020: Terms of service page (1pt) Status: backlog Priority: low Complexity: trivial → Blocks nothing 5. US-0022: Logo upload (3pts) Status: backlog Priority: medium Complexity: low → Blocks 1 other story 6. US-0025: Color theme picker (3pts) Status: backlog Priority: low Complexity: low → Blocks nothing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Recommendations **Start with**: US-0001 (blocks many others - critical path) **Parallel work**: - Team 1: US-0001 (5pts) + US-0014 (3pts) = 8pts - Team 2: US-0022 (3pts) + US-0025 (3pts) = 6pts - Team 3: US-0017 (2pts) + US-0020 (1pt) = 3pts This enables maximum parallel progress while unblocking future stories as quickly as possible.
目标:识别可立即启动的用户故事。
分析:
-
查找根节点(无blocked_by依赖):bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-independent -
呈现可立即启动的用户故事:
✅ 独立用户故事(可立即启动) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **发现**:6个无依赖的用户故事 **总故事点**:23(约半个迭代的工作量) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📋 可开始开发的用户故事 1. US-0001:展示关键指标(5点) 状态:待办列表 优先级:高 复杂度:中 → 阻塞8个其他用户故事(优先启动!) 2. US-0014:用户资料页面(3点) 状态:待办列表 优先级:中 复杂度:低 → 阻塞2个其他用户故事 3. US-0017:帮助文档(2点) 状态:待办列表 优先级:低 复杂度:极低 → 不阻塞任何故事(可随时开发) 4. US-0020:服务条款页面(1点) 状态:待办列表 优先级:低 复杂度:极低 → 不阻塞任何故事 5. US-0022:Logo上传(3点) 状态:待办列表 优先级:中 复杂度:低 → 阻塞1个其他用户故事 6. US-0025:颜色主题选择器(3点) 状态:待办列表 优先级:低 复杂度:低 → 不阻塞任何故事 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 建议 **优先启动**:US-0001(阻塞多个其他故事 - 关键路径) **并行工作安排**: - 团队1:US-0001(5点) + US-0014(3点) = 8点 - 团队2:US-0022(3点) + US-0025(3点) = 6点 - 团队3:US-0017(2点) + US-0020(1点) = 3点 这能实现最大程度的并行进展,同时尽快解锁后续用户故事。
Phase 6: Identify Bottleneck Stories
阶段6:识别瓶颈用户故事
Goal: Find stories that block many others.
Analysis:
-
Find High-Degree Nodes:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-bottlenecks --threshold 3 -
Present Bottleneck Stories:
⚠️ Bottleneck Stories Detected ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Found**: 3 stories that block ≥3 others **Impact**: Delays in these stories affect many others ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🚧 Critical Bottlenecks 1. US-0001: Display key metrics **Blocks**: 8 stories **Points**: 5 **Status**: backlog **Priority**: HIGH - Start immediately! Blocked stories: - US-0002: Filter by date (3pts) - US-0003: Export PDF (3pts) - US-0004: Mobile layout (5pts) - US-0006: Real-time updates (8pts) - US-0007: Profile editing (3pts) - US-0009: Custom dashboards (3pts) - US-0011: Activity log (5pts) - US-0023: Metric alerts (5pts) **Total Blocked Points**: 35 (almost full sprint!) 2. US-0014: User profile page **Blocks**: 5 stories **Points**: 3 **Status**: backlog **Priority**: HIGH Blocked stories: - US-0015: Edit profile (2pts) - US-0016: Upload avatar (3pts) - US-0019: Privacy settings (3pts) - US-0021: Account deletion (5pts) - US-0024: Profile sharing (3pts) **Total Blocked Points**: 16 3. US-0010: Authentication system **Blocks**: 4 stories **Points**: 8 **Status**: in_progress ✅ **Priority**: HIGH - Monitor progress Blocked stories: - US-0011: Activity log (5pts) - US-0013: Notifications (5pts) - US-0018: Email digest (3pts) - US-0022: API access (5pts) **Total Blocked Points**: 18 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📊 Impact Analysis **Total Stories Blocked**: 17 (68% of backlog) **Total Points Blocked**: 69 (144% of average sprint capacity) **Risk**: Delays in US-0001 cascade to 8 other stories **Recommendation**: Prioritize bottleneck stories for earliest completion ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 Mitigation Strategies **US-0001 (Blocks 8)**: 1. Assign to most experienced developer 2. Review dependencies - are all 8 truly blocked? 3. Consider extracting shared foundation to unblock others sooner 4. Add extra testing/review to avoid rework **US-0014 (Blocks 5)**: 1. Start immediately after US-0001 begins 2. Can work in parallel with US-0001 3. Profile stories are all low-medium complexity **US-0010 (In Progress)**: 1. Monitor daily progress 2. Ensure no blockers for this story 3. 4 stories waiting - communicate timeline ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Dependency Reduction Ideas Consider if these dependencies are truly required: - Does US-0007 (Profile editing) need US-0001 (Metrics)? - Does US-0023 (Metric alerts) need full US-0001, or just API? - Can any blocked stories use mock/partial data? Reducing unnecessary dependencies could unblock 2-3 stories.
目标:找出阻塞大量其他故事的用户故事。
分析:
-
查找高度数节点:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-bottlenecks --threshold 3 -
呈现瓶颈用户故事:
⚠️ 检测到瓶颈用户故事 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **发现**:3个阻塞≥3个其他故事的用户故事 **影响**:这些故事的延迟会影响大量其他故事 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🚧 关键瓶颈 1. US-0001:展示关键指标 **阻塞**:8个用户故事 **故事点**:5 **状态**:待办列表 **优先级**:高 - 立即启动! 被阻塞的故事: - US-0002:按日期过滤(3点) - US-0003:导出PDF(3点) - US-0004:移动端布局(5点) - US-0006:实时更新(8点) - US-0007:资料编辑(3点) - US-0009:自定义仪表板(3点) - US-0011:活动日志(5点) - US-0023:指标告警(5点) **被阻塞的总故事点**:35(几乎是一个完整迭代的工作量!) 2. US-0014:用户资料页面 **阻塞**:5个用户故事 **故事点**:3 **状态**:待办列表 **优先级**:高 被阻塞的故事: - US-0015:编辑资料(2点) - US-0016:上传头像(3点) - US-0019:隐私设置(3点) - US-0021:账号删除(5点) - US-0024:资料分享(3点) **被阻塞的总故事点**:16 3. US-0010:认证系统 **阻塞**:4个用户故事 **故事点**:8 **状态**:进行中 ✅ **优先级**:高 - 监控进展 被阻塞的故事: - US-0011:活动日志(5点) - US-0013:通知系统(5点) - US-0018:邮件摘要(3点) - US-0022:API访问(5点) **被阻塞的总故事点**:18 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📊 影响分析 **被阻塞的总用户故事数**:17(占待办列表的68%) **被阻塞的总故事点**:69(是平均迭代容量的144%) **风险**:US-0001的延迟会传导至8个其他故事 **建议**:优先完成瓶颈用户故事 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 缓解策略 **US-0001(阻塞8个故事)**: 1. 分配给最有经验的开发人员 2. 审查依赖关系 - 这8个故事是否真的都被阻塞? 3. 考虑提取共享基础部分,以便更早解锁其他故事 4. 增加额外的测试/评审以避免返工 **US-0014(阻塞5个故事)**: 1. US-0001启动后立即开始 2. 可与US-0001并行开发 3. 资料相关故事的复杂度均为低至中等 **US-0010(进行中)**: 1. 每日监控进展 2. 确保该故事无阻塞 3. 有4个故事在等待 - 及时沟通时间线 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 减少依赖的思路 考虑这些依赖是否真的必要: - US-0007(资料编辑)是否需要依赖US-0001(指标)? - US-0023(指标告警)是否需要完整的US-0001,还是仅需API? - 被阻塞的故事能否使用模拟/部分数据? 减少不必要的依赖可解锁2-3个用户故事。
Phase 7: Generate Dependency Graph
阶段7:生成依赖图谱
Goal: Create visual Mermaid diagram.
Analysis:
-
Generate Diagram:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-diagram deps.mmd -
Read Mermaid File:mermaid
graph TD US0001[US-0001: Display key metrics<br/>5pts - HIGH] US0002[US-0002: Filter by date<br/>3pts - MEDIUM] US0003[US-0003: Export PDF<br/>3pts - MEDIUM] US0004[US-0004: Mobile layout<br/>5pts - MEDIUM] US0001 --> US0002 US0001 --> US0003 US0001 --> US0004 US0002 --> US0006 US0003 --> US0006 classDef bottleneck fill:#ff6b6b classDef independent fill:#51cf66 classDef blocked fill:#ffd43b class US0001 bottleneck class US0002,US0003,US0004 blocked -
Present Diagram:
📊 Dependency Graph Generated ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **File**: stories/analysis/dependency-graph.mmd **Stories**: 25 **Dependencies**: 32 **Layers**: 6 (max dependency depth) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎨 Color Legend 🔴 Red (Bottleneck): Blocks ≥3 stories 🟢 Green (Independent): No dependencies, can start now 🟡 Yellow (Blocked): Waiting on other stories ⚪ White (Normal): Standard dependency ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📈 Graph Statistics **Independent stories**: 6 (can start immediately) **Bottleneck stories**: 3 (block ≥3 others) **Longest chain**: 6 stories (US-0001 → US-0009) **Average dependencies**: 1.3 per story ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 How to View Option 1: GitHub/GitLab - Push the .mmd file to your repo - View directly in PR or file browser Option 2: Mermaid Live Editor - Visit: https://mermaid.live - Paste contents of dependency-graph.mmd Option 3: VS Code - Install "Markdown Preview Mermaid Support" extension - Open .mmd file and preview Option 4: Embed in documentation - Copy .mmd contents into markdown file - Surround with ```mermaid code fence
目标:创建可视化Mermaid图表。
分析:
-
生成图表:bash
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-diagram deps.mmd -
读取Mermaid文件:mermaid
graph TD US0001[US-0001: Display key metrics<br/>5pts - HIGH] US0002[US-0002: Filter by date<br/>3pts - MEDIUM] US0003[US-0003: Export PDF<br/>3pts - MEDIUM] US0004[US-0004: Mobile layout<br/>5pts - MEDIUM] US0001 --> US0002 US0001 --> US0003 US0001 --> US0004 US0002 --> US0006 US0003 --> US0006 classDef bottleneck fill:#ff6b6b classDef independent fill:#51cf66 classDef blocked fill:#ffd43b class US0001 bottleneck class US0002,US0003,US0004 blocked -
呈现图表:
📊 已生成依赖图谱 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **文件**:stories/analysis/dependency-graph.mmd **用户故事数**:25 **依赖数**:32 **层数**:6(最大依赖深度) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎨 颜色图例 🔴 红色(瓶颈):阻塞≥3个用户故事 🟢 绿色(独立):无依赖,可立即启动 🟡 黄色(被阻塞):等待其他故事 ⚪ 白色(正常):标准依赖 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📈 图谱统计 **独立用户故事数**:6(可立即启动) **瓶颈用户故事数**:3(阻塞≥3个其他故事) **最长链**:6个用户故事(US-0001 → US-0009) **平均依赖数**:每个故事1.3个 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 查看方式 选项1:GitHub/GitLab - 将.mmd文件推送到仓库 - 在PR或文件浏览器中直接查看 选项2:Mermaid在线编辑器 - 访问:https://mermaid.live - 粘贴dependency-graph.mmd的内容 选项3:VS Code - 安装"Markdown Preview Mermaid Support"扩展 - 打开.mmd文件并预览 选项4:嵌入文档 - 将.mmd内容复制到Markdown文件 - 用```mermaid代码块包裹
Phase 8: Optimization Suggestions
阶段8:优化建议
Goal: Recommend ways to improve dependency structure.
Analysis:
💡 Dependency Optimization Recommendations
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
**Goal**: Reduce blocking, enable parallel work
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 High-Impact Changes
1. **Break US-0004 → US-0003 dependency**
Current: Mobile layout depends on PDF export
Suggested: Remove this dependency (likely unnecessary)
Impact: Enables 1 story to work in parallel (+5 pts capacity)
2. **Split US-0001 into foundation + enhancements**
Current: US-0001 blocks 8 stories (major bottleneck)
Suggested:
- US-0001a: Basic metrics display (3pts)
- US-0001b: Advanced metrics features (2pts)
Impact: Unblocks 5 stories earlier (saves ~3-5 days)
3. **Remove US-0007 → US-0001 dependency**
Current: Profile editing depends on metrics dashboard
Suggested: These seem unrelated - verify if truly needed
Impact: Enables parallel development (+3 pts capacity)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 Medium-Impact Changes
4. **Merge US-0012 ↔ US-0015 (circular dependency)**
Current: Mutual blocking (deadlock)
Suggested: Merge into single story or reverse dependency
Impact: Resolves deadlock, enables 2 stories
5. **Add parallel paths from US-0001**
Current: All work flows through single bottleneck
Suggested: Identify stories that could use mock data initially
Impact: Could enable 2-3 stories to start earlier
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Projected Impact
**Before optimizations**:
- Parallel capacity: ~15 story points
- Critical path: 15 days
- Stories ready to start: 6
**After optimizations**:
- Parallel capacity: ~28 story points (+87%)
- Critical path: 8-9 days (-40%)
- Stories ready to start: 11 (+83%)
**Result**: ~50% faster feature delivery with same team size
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Would you like me to:
1. Show detailed analysis for specific dependencies
2. Help update story YAMLs to implement these changes
3. Generate new dependency graph showing optimized structure目标:提出改进依赖结构的建议。
分析:
💡 依赖优化建议
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
**目标**:减少阻塞,实现并行工作
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 高影响变更
1. **打破US-0004 → US-0003的依赖关系**
当前:移动端布局依赖PDF导出
建议:移除该依赖(可能不必要)
影响:使1个故事可并行开发(+5点容量)
2. **将US-0001拆分为基础版+增强版**
当前:US-0001阻塞8个故事(主要瓶颈)
建议:
- US-0001a:基础指标展示(3点)
- US-0001b:高级指标功能(2点)
影响:提前解锁5个故事(节省约3-5天)
3. **移除US-0007 → US-0001的依赖关系**
当前:资料编辑依赖指标仪表盘
建议:这些功能看似无关 - 验证是否真的需要依赖
影响:实现并行开发(+3点容量)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 中影响变更
4. **合并US-0012 ↔ US-0015(循环依赖)**
当前:相互阻塞(死锁)
建议:合并为单个故事或反转依赖关系
影响:解决死锁,启用2个故事
5. **从US-0001添加并行路径**
当前:所有工作都通过单个瓶颈
建议:识别可初始使用模拟数据的故事
影响:可使2-3个故事更早启动
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 预计影响
**优化前**:
- 并行容量:约15个故事点
- 关键路径:15天
- 可启动的故事数:6
**优化后**:
- 并行容量:约28个故事点(+87%)
- 关键路径:8-9天(-40%)
- 可启动的故事数:11(+83%)
**结果**:相同团队规模下,功能交付速度提升约50%
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
你是否需要我:
1. 展示特定依赖关系的详细分析
2. 帮助更新用户故事YAML以实现这些变更
3. 生成展示优化后结构的新依赖图谱Summary Report Format
汇总报告格式
Comprehensive analysis output:
📊 Dependency Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Generated: 2025-01-03 15:30:00
Stories Analyzed: 25
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 Overall Statistics
Total Stories: 25
Total Dependencies: 32
Average Dependencies per Story: 1.28
Max Dependency Depth: 6 levels
Status Breakdown:
- Backlog: 18 stories (72%)
- In Progress: 5 stories (20%)
- Done: 2 stories (8%)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Independent Stories: 6
Ready to start immediately (no blockers)
Total points available: 23
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚧 Bottleneck Stories: 3
Stories blocking ≥3 others
Total downstream impact: 69 story points
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 Longest Chains: 2
Max chain length: 6 stories
Critical path: 15 days minimum
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ Issues Detected: 2
Circular Dependencies: 2 cycles (5 stories affected)
Long Chains: 2 chains (>5 stories each)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Dependency Health Score: 72/100
Breakdown:
- No circular deps: 0/25 (critical issue)
- Reasonable chain length: 15/25 (2 long chains)
- Balanced dependencies: 20/25 (3 bottlenecks)
- Independent stories: 12/25 (good)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Key Recommendations
1. CRITICAL: Resolve 2 circular dependencies (blocks 5 stories)
2. HIGH: Address bottleneck stories (especially US-0001)
3. MEDIUM: Review long chains for optimization opportunities
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📁 Files Generated
- stories/analysis/dependency-graph.mmd (visual diagram)
- stories/analysis/dependency-report.json (full data)
- stories/analysis/independent-stories.txt (ready to start)
- stories/analysis/bottlenecks.txt (high-priority stories)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━全面分析输出:
📊 依赖分析报告
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
生成时间:2025-01-03 15:30:00
分析的用户故事数:25
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 总体统计
总用户故事数:25
总依赖数:32
每个故事的平均依赖数:1.28
最大依赖深度:6层
状态分布:
- 待办列表:18个故事(72%)
- 进行中:5个故事(20%)
- 已完成:2个故事(8%)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ 独立用户故事:6个
可立即启动(无阻塞)
可用总故事点:23
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚧 瓶颈用户故事:3个
阻塞≥3个其他故事的用户故事
下游总影响:69个故事点
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 最长链:2条
最大链长度:6个用户故事
关键路径:最少15天
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ 检测到的问题:2个
循环依赖:2个循环(影响5个用户故事)
长链:2条链(每条>5个用户故事)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 依赖健康评分:72/100
细分:
- 无循环依赖:0/25(关键问题)
- 合理链长度:15/25(2条长链)
- 平衡依赖:20/25(3个瓶颈)
- 独立故事:12/25(良好)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 关键建议
1. 关键:解决2个循环依赖(阻塞5个故事)
2. 高优先级:处理瓶颈用户故事(尤其是US-0001)
3. 中优先级:审查长链以寻找优化机会
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📁 生成的文件
- stories/analysis/dependency-graph.mmd(可视化图表)
- stories/analysis/dependency-report.json(完整数据)
- stories/analysis/independent-stories.txt(可立即启动的故事)
- stories/analysis/bottlenecks.txt(高优先级故事)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Integration with Scripts
与脚本集成
Main Analysis Script
主分析脚本
bash
undefinedbash
undefinedFull analysis with JSON output
完整分析并输出JSON
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-json
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-json
Generate Mermaid diagram
生成Mermaid图表
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-diagram deps.mmd
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --output-diagram deps.mmd
Find specific issues
查找特定问题
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-cycles
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-chains --max-length 5
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-independent
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-bottlenecks --threshold 3
undefinedpython3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-cycles
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --check-chains --max-length 5
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-independent
python3 .claude/skills/dependency-analyzer/scripts/check_dependencies.py --find-bottlenecks --threshold 3
undefinedError Handling
错误处理
No Stories Found
未找到用户故事
⚠️ No stories found
Directory: stories/yaml-source/
Files found: 0
This usually means:
- No stories have been created yet
- Stories are in a different directory
- File permissions prevent reading
Create stories first using user-story-generator skill.⚠️ 未找到用户故事
目录:stories/yaml-source/
找到的文件数:0
通常原因:
- 尚未创建任何用户故事
- 用户故事位于其他目录
- 文件权限限制导致无法读取
请先使用user-story-generator skill创建用户故事。Invalid Dependency Reference
无效依赖引用
⚠️ Invalid dependency detected
In story: US-0005
References: US-9999 (does not exist)
This story references a non-existent story.
Fix options:
1. Remove the invalid dependency
2. Create US-9999 if it should exist
3. Correct the story ID (typo?)
Would you like me to show US-0005 details?⚠️ 检测到无效依赖
在用户故事:US-0005
引用:US-9999(不存在)
该用户故事引用了一个不存在的故事。
修复选项:
1. 移除无效依赖
2. 若US-9999应存在则创建它
3. 修正故事ID(输入错误?)
你是否需要我展示US-0005的详细信息?Conflicting Dependencies
冲突依赖
⚠️ Conflicting dependencies
US-0005:
dependencies:
blocked_by: [US-0008]
US-0008:
dependencies:
blocks: [US-0010] # Does not list US-0005
Inconsistency: US-0005 says it's blocked by US-0008,
but US-0008 doesn't list US-0005 in its "blocks" field.
Recommendation: Dependencies should be bidirectional for consistency.
Auto-fix: Add US-0005 to US-0008's "blocks" array? (yes/no)⚠️ 检测到冲突依赖
US-0005:
dependencies:
blocked_by: [US-0008]
US-0008:
dependencies:
blocks: [US-0010] # 未将US-0005列入其中
不一致:US-0005表示它被US-0008阻塞,
但US-0008的"blocks"字段中未列出US-0005。
建议:依赖关系应保持双向一致。
自动修复:将US-0005添加到US-0008的"blocks"数组中?(是/否)Configuration
配置
Uses settings from :
.claude/skills/user-story-generator/config/automation-config.yamlyaml
dependencies:
check_circular: true
max_depth: 10 # Warn if dependency chain exceeds this
warn_on_long_chains: true
max_chain_length: 5 # Chains longer than this trigger warning
bottleneck_threshold: 3 # Stories blocking ≥ this many are bottlenecks使用中的设置:
.claude/skills/user-story-generator/config/automation-config.yamlyaml
dependencies:
check_circular: true
max_depth: 10 # 若依赖链超过此值则发出警告
warn_on_long_chains: true
max_chain_length: 5 # 超过此长度的链会触发警告
bottleneck_threshold: 3 # 阻塞≥此数量故事的用户故事被视为瓶颈Best Practices
最佳实践
Dependency Management
依赖管理
- Keep chains short (≤5 stories ideal)
- Avoid circular dependencies (always)
- Minimize bottlenecks (stories blocking many)
- Maximize independent stories (enables parallel work)
- 保持链短(理想≤5个故事)
- 始终避免循环依赖
- 尽量减少瓶颈(阻塞大量故事的用户故事)
- 最大化独立用户故事(实现并行工作)
When to Analyze
分析时机
- Always: Before sprint planning
- Usually: After adding/modifying stories
- Sometimes: Mid-sprint to check progress
- Rarely: During development (changes are risky)
- 始终:迭代规划前
- 通常:添加/修改用户故事后
- 有时:迭代中期检查进展
- 很少:开发期间(变更风险高)
Interpreting Results
结果解读
- Independent stories: Start these first to maximize progress
- Bottleneck stories: Prioritize to unblock others
- Long chains: Look for optimization opportunities
- Circular dependencies: Must be resolved immediately
- 独立用户故事:优先启动以最大化进展
- 瓶颈用户故事:优先处理以解锁其他故事
- 长链:寻找优化机会
- 循环依赖:必须立即解决
Examples
示例
Example 1: Quick Check
示例1:快速检查
Input: "Check dependencies"
Output:
📊 Quick Dependency Check
Stories: 25
Dependencies: 32
Independent: 6 ✅
Bottlenecks: 3 ⚠️
Circular: 0 ✅
Long chains: 2 ⚠️
Overall: Generally healthy with some optimizations possible输入:"检查依赖关系"
输出:
📊 快速依赖检查
用户故事数:25
依赖数:32
独立故事:6个 ✅
瓶颈:3个 ⚠️
循环依赖:0个 ✅
长链:2条 ⚠️
总体:整体健康,存在一些优化空间Example 2: Pre-Sprint Planning
示例2:迭代规划前分析
Input: "Analyze dependencies for sprint planning"
Output:
[Full analysis with all sections]
Sprint Planning Recommendations:
- 6 stories can start immediately (23 pts)
- Prioritize US-0001 (blocks 8 others)
- Resolve circular dependency before sprint
- Plan for 2-3 parallel work streams输入:"为迭代规划分析依赖关系"
输出:
[包含所有部分的完整分析]
迭代规划建议:
- 6个故事可立即启动(23点)
- 优先处理US-0001(阻塞8个其他故事)
- 迭代前解决循环依赖
- 规划2-3个并行工作流Remember
注意事项
- Visual First: Dependency graphs are powerful communication tools
- Action-Oriented: Always provide specific next steps
- Risk-Aware: Highlight blocking issues prominently
- Optimization-Focused: Suggest improvements
- Planning-Friendly: Format output for sprint planning use
- 可视化优先:依赖图谱是强大的沟通工具
- 面向行动:始终提供具体的下一步操作
- 风险感知:突出显示阻塞问题
- 聚焦优化:提出改进建议
- 便于规划:输出格式适合迭代规划使用