关于 cause-and-effect
一项使用鱼骨图(Ishikawa)从六个类别分析问题成因的技能,并引导用户逐步筛选根因、确定优先级和提出解决方案。
主要功能
- 01按六个类别进行鱼骨分析
- 02通过连续追问 why 深挖
- 03区分促成因素与根因
- 04按影响和可能性排序
- 05为优先问题提出方案
适用场景
- 01调查反复出现的测试失败
- 02分析功能交付延期
- 03探查 API 延迟原因
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ neolabhq/ context-engineering-kit --skill cause-and-effect安装后在 Claude Code 中输入/cause-and-effect确认已加载。
详细介绍
因果分析
应用鱼骨图(石川图)分析,系统地探索问题在多个类别中的所有潜在原因。
描述
系统地检查六个类别中的潜在原因:人员、流程、技术、环境、方法和材料。创建结构化的“鱼骨图”视图,识别促成问题的因素。
用法
/cause-and-effect [problem_description]
变量
- PROBLEM:要分析的问题(默认:提示输入)
- CATEGORIES:要探索的类别(默认:全部六类)
步骤
- 清晰陈述问题(鱼头)
- 针对每个类别,集思广益,列出潜在原因:
- 人员:技能、培训、沟通、团队动态
- 流程:工作流、规程、标准、评审
- 技术:工具、基础设施、依赖项、配置
- 环境:工作空间、部署目标、外部因素
- 方法:方法、模式、架构、实践
- 材料:数据、依赖项、第三方服务、资源
- 针对每个潜在原因,继续追问“为什么”,以深入挖掘
- 判断哪些原因是促成因素,哪些是根本原因
- 按影响和可能性对原因排序
- 针对优先级最高的原因提出解决方案
示例
示例 1:API 响应延迟
Problem: API responses take 3+ seconds (target: <500ms)
PEOPLE
├─ Team unfamiliar with performance optimization
├─ No one owns performance monitoring
└─ Frontend team doesn't understand backend constraints
PROCESS
├─ No performance testing in CI/CD
├─ No SLA defined for response times
└─ Performance regression not caught in code review
TECHNOLOGY
├─ Database queries not optimized
│ └─ Why: No query analysis tools in place
├─ N+1 queries in ORM
│ └─ Why: Eager loading not configured
├─ No caching layer
│ └─ Why: Redis not in tech stack
└─ Synchronous external API calls
└─ Why: No async architecture in place
ENVIRONMENT
├─ Production uses smaller database instance than needed
├─ No CDN for static assets
└─ Single region deployment (high latency for distant users)
METHODS
├─ REST API design requires multiple round trips
├─ No pagination on large datasets
└─ Full object serialization instead of selective fields
MATERIALS
├─ Large JSON payloads (unnecessary data)
├─ Uncompressed responses
└─ Third-party API (payment gateway) is slow
└─ Why: Free tier with rate limiting
ROOT CAUSES:
- No performance requirements defined (Process)
- Missing performance monitoring tooling (Technology)
- Architecture doesn't support caching/async (Methods)
SOLUTIONS (Priority Order):
1. Add database indexes (quick win, high impact)
2. Implement Redis caching layer (medium effort, high impact)
3. Make external API calls async with webhooks (high effort, high impact)
4. Define and monitor performance SLAs (low effort, prevents regression)
示例 2:测试套件时好时坏
Problem: 15% of test runs fail, passing on retry
PEOPLE
├─ Test-writing skills vary across team
├─ New developers copy existing flaky patterns
└─ No one assigned to fix flaky tests
PROCESS
├─ Flaky tests marked as "known issue" and ignored
├─ No policy against merging with flaky tests
└─ Test failures don't block deployments
TECHNOLOGY
├─ Race conditions in async test setup
├─ Tests share global state
├─ Test database not isolated per test
├─ setTimeout used instead of proper waiting
└─ CI environment inconsistent (different CPU/memory)
ENVIRONMENT
├─ CI runner under heavy load
├─ Network timing varies (external API mocks flaky)
└─ Timezone differences between local and CI
METHODS
├─ Integration tests not properly isolated
├─ No retry logic for legitimate timing issues
└─ Tests depend on execution order
MATERIALS
├─ Test data fixtures overlap
├─ Shared test database polluted
└─ Mock data doesn't match production patterns
ROOT CAUSES:
- No test isolation strategy (Methods + Technology)
- Process accepts flaky tests (Process)
- Async timing not handled properly (Technology)
SOLUTIONS:
1. Implement per-test database isolation (high impact)
2. Replace setTimeout with proper async/await patterns (medium impact)
3. Add pre-commit hook blocking flaky test patterns (prevents new issues)
4. Enforce policy: flaky test = block merge (process change)
示例 3:功能开发耗时 3 个月,而非 3 周
Problem: Simple CRUD feature took 12 weeks vs. 3 week estimate
PEOPLE
├─ Developer unfamiliar with codebase
├─ Key architect on vacation during critical phase
└─ Designer changed requirements mid-development
PROCESS
├─ Requirements not finalized before starting
├─ No code review for first 6 weeks (large diff)
├─ Multiple rounds of design revision
└─ QA started late (found issues in week 10)
TECHNOLOGY
├─ Codebase has high coupling (change ripple effects)
├─ No automated tests (manual testing slow)
├─ Legacy code required refactoring first
└─ Development environment setup took 2 weeks
ENVIRONMENT
├─ Staging environment broken for 3 weeks
├─ Production data needed for testing (compliance delay)
└─ Dependencies blocked by another team
METHODS
├─ No incremental delivery (big bang approach)
├─ Over-engineering (added future features "while we're at it")
└─ No design doc (discovered issues during implementation)
MATERIALS
├─ Third-party API changed during development
├─ Production data model different than staging
└─ Missing design assets (waited for designer)
ROOT CAUSES:
- No requirements lock-down before start (Process)
- Architecture prevents incremental changes (Technology)
- Big bang approach vs. iterative (Methods)
- Development environment not automated (Technology)
SOLUTIONS:
1. Require design doc + finalized requirements before starting (Process)
2. Implement feature flags for incremental delivery (Methods)
3. Automate dev environment setup (Technology)
4. Refactor high-coupling areas (Technology, long-term)
注意事项
- 鱼骨图能揭示跨领域的系统性问题
- 问题往往由多种原因共同导致
- 不要在每个类别找到第一个原因后就停止——要继续深入
- 有些原因横跨多个类别(请标注)
- 根本原因通常存在于流程或方法中(而不只是技术)
- 可搭配
/why命令,深入分析具体原因 - 按以下公式确定解决方案的优先级:影响 × 可行性 ÷ 工作量
- 解决根本原因,而不只是处理症状
评论
支持 Markdown