mcpField
O
on-call-handoff-patterns

on-call-handoff-patterns

github.com/oimiragieo云与 DevOps4453 次安装17 周前更新
代码仓库

关于 on-call-handoff-patterns

面向值班工程师的认知型技能,通过 Agent 上下文提供交接流程、模板和检查清单,帮助在轮班之间传递事件与调查进展。内容还涵盖交接会议、告警验证和升级处理。

主要功能

  1. 01提供交接文档模板
  2. 02整理事件与调查状态
  3. 03提供交接检查清单
  4. 04说明升级与告警验证流程
  5. 05包含轮班会议议程

适用场景

  1. 01记录正在处理的事件以便交班
  2. 02交接尚未完成的调查及后续步骤
  3. 03为新值班人员准备状态与运行信息
  4. 04建立轮班前后的检查流程

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/oimiragieo/agent-studio --skill on-call-handoff-patterns

安装后在 Claude Code 中输入/on-call-handoff-patterns确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

commands/
on-call-handoff-patterns.md
hooks/
post-execute.cjs
pre-execute.cjs
references/
research-requirements.md
rules/
on-call-handoff-patterns.md
schemas/
input.schema.json
output.schema.json
scripts/
main.cjs
templates/
implementation-template.md

详细介绍

模式:认知/提示词驱动 — 没有独立的实用脚本;通过 Agent 上下文使用。

值班交接模式

有效的值班交接模式,确保跨班次的连续性、上下文传递和可靠的事件响应。

何时使用此技能

  • 交接值班职责
  • 撰写班次交接摘要
  • 记录正在进行的调查
  • 制定值班轮换流程
  • 提高交接质量
  • 帮助新的值班工程师熟悉工作

核心概念

1. 交接内容
内容用途
活动事件当前出现故障的内容
正在进行的调查正在调试的问题
近期变更部署、配置
已知问题正在使用的临时解决方案
即将发生的事件维护、发布
2. 交接时间
Recommended: 30 min overlap between shifts

Outgoing:
├── 15 min: Write handoff document
└── 15 min: Sync call with incoming

Incoming:
├── 15 min: Review handoff document
├── 15 min: Sync call with outgoing
└── 5 min: Verify alerting setup

模板

模板 1:班次交接文档
# On-Call Handoff: Platform Team

**Outgoing**: @alice (2024-01-15 to 2024-01-22)
**Incoming**: @bob (2024-01-22 to 2024-01-29)
**Handoff Time**: 2024-01-22 09:00 UTC

---

## Active Incidents

### None currently active

No active incidents at handoff time.

---

## Ongoing Investigations

### 1. Intermittent API Timeouts (ENG-1234)

**Status**: Investigating
**Started**: 2024-01-20
**Impact**: ~0.1% of requests timing out

**Context**:

- Timeouts correlate with database backup window (02:00-03:00 UTC)
- Suspect backup process causing lock contention
- Added extra logging in PR #567 (deployed 01/21)

**Next Steps**:

- [ ] Review new logs after tonight's backup
- [ ] Consider moving backup window if confirmed

**Resources**:

- Dashboard: [API Latency](https://grafana/d/api-latency)
- Thread: #platform-eng (01/20, 14:32)

---

### 2. Memory Growth in Auth Service (ENG-1235)

**Status**: Monitoring
**Started**: 2024-01-18
**Impact**: None yet (proactive)

**Context**:

- Memory usage growing ~5% per day
- No memory leak found in profiling
- Suspect connection pool not releasing properly

**Next Steps**:

- [ ] Review heap dump from 01/21
- [ ] Consider restart if usage > 80%

**Resources**:

- Dashboard: [Auth Service Memory](https://grafana/d/auth-memory)
- Analysis doc: [Memory Investigation](https://docs/eng-1235)

---

## Resolved This Shift

### Payment Service Outage (2024-01-19)

- **Duration**: 23 minutes
- **Root Cause**: Database connection exhaustion
- **Resolution**: Rolled back v2.3.4, increased pool size
- **Postmortem**: [POSTMORTEM-89](https://docs/postmortem-89)
- **Follow-up tickets**: ENG-1230, ENG-1231

---

## Recent Changes

### Deployments

| Service      | Version | Time        | Notes                      |
| ------------ | ------- | ----------- | -------------------------- |
| api-gateway  | v3.2.1  | 01/21 14:00 | Bug fix for header parsing |
| user-service | v2.8.0  | 01/20 10:00 | New profile features       |
| auth-service | v4.1.2  | 01/19 16:00 | Security patch             |

### Configuration Changes

- 01/21: Increased API rate limit from 1000 to 1500 RPS
- 01/20: Updated database connection pool max from 50 to 75

### Infrastructure

- 01/20: Added 2 nodes to Kubernetes cluster
- 01/19: Upgraded Redis from 6.2 to 7.0

---

## Known Issues & Workarounds

### 1. Slow Dashboard Loading

**Issue**: Grafana dashboards slow on Monday mornings
**Workaround**: Wait 5 min after 08:00 UTC for cache warm-up
**Ticket**: OPS-456 (P3)

### 2. Flaky Integration Test

**Issue**: `test_payment_flow` fails intermittently in CI
**Workaround**: Re-run failed job (usually passes on retry)
**Ticket**: ENG-1200 (P2)

---

## Upcoming Events

| Date        | Event                | Impact              | Contact       |
| ----------- | -------------------- | ------------------- | ------------- |
| 01/23 02:00 | Database maintenance | 5 min read-only     | @dba-team     |
| 01/24 14:00 | Major release v5.0   | Monitor closely     | @release-team |
| 01/25       | Marketing campaign   | 2x traffic expected | @platform     |

---

## Escalation Reminders

| Issue Type      | First Escalation     | Second Escalation |
| --------------- | -------------------- | ----------------- |
| Payment issues  | @payments-oncall     | @payments-manager |
| Auth issues     | @auth-oncall         | @security-team    |
| Database issues | @dba-team            | @infra-manager    |
| Unknown/severe  | @engineering-manager | @vp-engineering   |

---

## Quick Reference

### Common Commands

```bash
# Check service health
kubectl get pods -A | grep -v Running

# Recent deployments
kubectl get events --sort-by='.lastTimestamp' | tail -20

# Database connections
psql -c "SELECT count(*) FROM pg_stat_activity;"

# Clear cache (emergency only)
redis-cli FLUSHDB
```
重要链接

交接检查清单

离岗工程师
  • 记录活动事件
  • 记录正在进行的调查
  • 列出近期变更
  • 说明已知问题
  • 添加即将发生的事件
  • 与接岗工程师同步
接岗工程师
  • 阅读本文档
  • 参加同步会议
  • 确认 PagerDuty 会将告警路由给你
  • 确认 Slack 通知正常
  • 检查 VPN 和访问权限是否正常
  • 查看关键仪表板

### Template 2: Quick Handoff (Async)

```markdown
# Quick Handoff: @alice → @bob

## TL;DR
- No active incidents
- 1 investigation ongoing (API timeouts, see ENG-1234)
- Major release tomorrow (01/24) - be ready for issues

## Watch List
1. API latency around 02:00-03:00 UTC (backup window)
2. Auth service memory (restart if > 80%)

## Recent
- Deployed api-gateway v3.2.1 yesterday (stable)
- Increased rate limits to 1500 RPS

## Coming Up
- 01/23 02:00 - DB maintenance (5 min read-only)
- 01/24 14:00 - v5.0 release

## Questions?
I'll be available on Slack until 17:00 today.
模板 3:事件交接(事件处理中)
# INCIDENT HANDOFF: Payment Service Degradation

**Incident Start**: 2024-01-22 08:15 UTC
**Current Status**: Mitigating
**Severity**: SEV2

---

## Current State

- Error rate: 15% (down from 40%)
- Mitigation in progress: scaling up pods
- ETA to resolution: ~30 min

## What We Know

1. Root cause: Memory pressure on payment-service pods
2. Triggered by: Unusual traffic spike (3x normal)
3. Contributing: Inefficient query in checkout flow

## What We've Done

- Scaled payment-service from 5 → 15 pods
- Enabled rate limiting on checkout endpoint
- Disabled non-critical features

## What Needs to Happen

1. Monitor error rate - should reach <1% in ~15 min
2. If not improving, escalate to @payments-manager
3. Once stable, begin root cause investigation

## Key People

- Incident Commander: @alice (handing off)
- Comms Lead: @charlie
- Technical Lead: @bob (incoming)

## Communication

- Status page: Updated at 08:45
- Customer support: Notified
- Exec team: Aware

## Resources

- Incident channel: #inc-20240122-payment
- Dashboard: [Payment Service](https://grafana/d/payments)
- Runbook: [Payment Degradation](https://wiki/runbooks/payments)

---

**Incoming on-call (@bob) - Please confirm you have:**

- [ ] Joined #inc-20240122-payment
- [ ] Access to dashboards
- [ ] Understand current state
- [ ] Know escalation path

交接同步会议

议程(15 分钟)
## Handoff Sync: @alice → @bob

1. **Active Issues** (5 min)
   - Walk through any ongoing incidents
   - Discuss investigation status
   - Transfer context and theories

2. **Recent Changes** (3 min)
   - Deployments to watch
   - Config changes
   - Known regressions

3. **Upcoming Events** (3 min)
   - Maintenance windows
   - Expected traffic changes
   - Releases planned

4. **Questions** (4 min)
   - Clarify anything unclear
   - Confirm access and alerting
   - Exchange contact info

值班最佳实践

值班前
## Pre-Shift Checklist

### Access Verification

- [ ] VPN working
- [ ] kubectl access to all clusters
- [ ] Database read access
- [ ] Log aggregator access (Splunk/Datadog)
- [ ] PagerDuty app installed and logged in

### Alerting Setup

- [ ] PagerDuty schedule shows you as primary
- [ ] Phone notifications enabled
- [ ] Slack notifications for incident channels
- [ ] Test alert received and acknowledged

### Knowledge Refresh

- [ ] Review recent incidents (past 2 weeks)
- [ ] Check service changelog
- [ ] Skim critical runbooks
- [ ] Know escalation contacts

### Environment Ready

- [ ] Laptop charged and accessible
- [ ] Phone charged
- [ ] Quiet space available for calls
- [ ] Secondary contact identified (if traveling)
值班期间
## Daily On-Call Routine

### Morning (start of day)

- [ ] Check overnight alerts
- [ ] Review dashboards for anomalies
- [ ] Check for any P0/P1 tickets created
- [ ] Skim incident channels for context

### Throughout Day

- [ ] Respond to alerts within SLA
- [ ] Document investigation progress
- [ ] Update team on significant issues
- [ ] Triage incoming pages

### End of Day

- [ ] Hand off any active issues
- [ ] Update investigation docs
- [ ] Note anything for next shift
值班后
## Post-Shift Checklist

- [ ] Complete handoff document
- [ ] Sync with incoming on-call
- [ ] Verify PagerDuty routing changed
- [ ] Close/update investigation tickets
- [ ] File postmortems for any incidents
- [ ] Take time off if shift was stressful

升级指南

何时升级
## Escalation Triggers

### Immediate Escalation

- SEV1 incident declared
- Data breach suspected
- Unable to diagnose within 30 min
- Customer or legal escalation received

### Consider Escalation

- Issue spans multiple teams
- Requires expertise you don't have
- Business impact exceeds threshold
- You're uncertain about next steps

### How to Escalate

1. Page the appropriate escalation path
2. Provide brief context in Slack
3. Stay engaged until escalation acknowledges
4. Hand off cleanly, don't just disappear

最佳实践

应做事项
  • 记录所有内容 — 未来的你会感谢自己
  • 尽早升级 — 宁可谨慎,也不要冒险
  • 适当休息 — 告警疲劳确实存在
  • 同步交接 — 异步沟通会丢失上下文
  • 测试你的配置 — 在事件发生前测试,而不是发生时
不应做的事项
  • 不要跳过交接 — 上下文丢失会导致事件
  • 不要逞英雄 — 需要时就升级
  • 不要忽略告警 — 即使看起来不严重
  • 生病时不要工作 — 改换班次即可
  • 不要失联 — 值班期间保持可联系

资源

铁律

  1. 始终在结束班次前撰写交接文档 — 仅靠同步会议并不足够;口头上下文几小时内就会被遗忘;这份文档是持久记录,接岗工程师凌晨 3 点也能查阅。
  2. 绝不跳过值班交接同步会议 — 仅异步交接会丢失细节、语气,以及回答问题的机会;15 分钟的重叠交接能避免接岗工程师花数小时困惑不解。
  3. 遇到事件处理受阻时,始终在 30 分钟内升级 — 独自调试数小时会延误解决并耗尽值班工程师的精力;升级体现的是良好判断力,而不是软弱。
  4. 绝不跳过班次开始前的告警配置验证 — 在事件处理中才发现 PagerDuty 路由配置错误就太晚了;每次值班前都要测试完整的告警链路。
  5. 始终为每项未解决的调查记录明确的后续步骤 — 没有后续步骤就交接,会迫使接岗工程师从头开始;书面行动项可将交接后的熟悉时间从数小时缩短到几分钟。

反模式

反模式失败原因正确做法
仅异步交接(没有同步通话)上下文丢失会导致事故;细节被遗漏;问题得不到解答始终进行同步通话(至少重叠 15 分钟),并提供书面文档
没有交接文档新接班的工程师不了解正在发生的问题;凌晨 3 点开始处理根本来不及每次值班结束前都撰写完整的交接文档
值班前跳过告警验证事故发生时才发现路由配置错误——为时已晚,无法修复每次值班开始前测试 PagerDuty 路由和 Slack 通知
英雄主义文化(不升级问题)个人精疲力竭;解决延迟;疲劳之下做出糟糕决策遇到阻碍后 30 分钟内升级问题;升级是明智之举
交接调查事项时不说明后续步骤接班工程师必须从头重新开始调查为每个未解决事项记录当前状态、推测、证据和明确的后续步骤

记忆协议(强制)

开始前: 阅读 .claude/context/memory/learnings.md

完成后:

  • 新模式 -> .claude/context/memory/learnings.md
  • 发现问题 -> .claude/context/memory/issues.md
  • 做出决策 -> .claude/context/memory/decisions.md

假设工作会被中断:如果没有记录在记忆中,就等于没有发生。

评论

支持 Markdown