SuperAPI AI Directory

lark-workflow-calendar-optimizer

Office & productivity

View repository

Updated 10-16 10:16

About this skill

Schedule Optimization Assistant Workflow

CRITICAL — Before starting, you MUST first use the Read tool to read lark-shared/SKILL.md, which contains authentication, permission handling, and security rules.

Applicable Scenarios

  • "Help me optimize tomorrow's schedule" / "Handle schedule conflicts"
  • "See what's wrong with my schedule" / "Is my schedule reasonable"
  • "Which meetings can be pushed off" / "My schedule is too full, how can I optimize it"
  • "Help me organize this week's schedule" / "Calendar optimizer"
  • "There's a schedule conflict tomorrow" / "Help me reschedule my schedule"

Complementary to the existing smart-scheduler(scheduling new meetings: find free slots → create schedule), this Skill focuses ondiagnosis and optimization of existing schedules: detect problems → analyze causes → suggest solutions. Forming the "Schedule Twin Suite".

Prerequisites

Supports user identity. Ensure authorization before execution:

lark-cli auth login --domain calendar

Workflow

指定分析范围 ──► calendar +agenda(获取全部日程)
                       │
                       ▼
                  日程分析引擎
              ┌────────┼────────┐
              ▼        ▼        ▼
          冲突检测  碎片分析  效率评估
                       │
                       ▼
              诊断报告 + 优化方案
                       │
                       ▼(用户确认)
              calendar events patch / events delete(可选执行)

Step 1: Get schedule data

Refer to lark-calendar/SKILL.md。

# 获取目标日期的日程
lark-cli calendar +agenda --start "<start>" --end "<end>"

Note: Dates are calculated using the date command.

# 获取明天
date -v+1d "+%Y-%m-%dT00:00:00%z"
date -v+1d "+%Y-%m-%dT23:59:59%z"

# 获取本周
date -v-monday "+%Y-%m-%dT00:00:00%z"
date -v+friday "+%Y-%m-%dT23:59:59%z"

Step 2: Schedule analysis engine

2.1 Conflict detection:

Iterate through the schedule list (sorted by start time) and check adjacent events:

冲突类型:
A. 完全重叠:事件 B 完全在事件 A 的时间范围内
B. 部分重叠:事件 B 的开始时间 < 事件 A 的结束时间
C. 首尾相连(无缓冲):事件 B 开始时间 == 事件 A 结束时间

For schedules that have been declined (decline): mark as not occupying time and exclude from conflict detection.

2.2 Fragmented time analysis:

碎片 = 两个会议之间的空闲段

碎片分类:
- 微碎片(< 15分钟):几乎无法利用
- 小碎片(15-30分钟):只能做简单任务
- 有效空闲(30-60分钟):可以处理中等任务
- 专注时段(> 60分钟):适合深度工作

2.3 Efficiency assessment:

Metric Calculation Method Healthy Threshold
Meeting proportion Total meeting duration / working hours < 40%
Longest continuous meeting Total duration of continuous uninterrupted meetings < 2 hours
Number of focus blocks Number of blocks with > 1 hour of continuous free time ≥ 2 blocks
Lunch break protection Whether there are meetings from 12:00-13:00 No meetings
Buffer time Proportion of adjacent meetings with ≥ 15 minutes between them > 70%

Step 3: Generate diagnostic report

## 🗓️ 日程诊断报告({日期})

### 整体评估
- **日程总数**:{N} 场
- **会议总时长**:{X} 小时(占工作时间 {P}%)
- **健康度**:{🟢 健康 / 🟡 偏满 / 🔴 过载}

### ⚠️ 发现的问题

#### 🔴 时间冲突({N} 处)
| # | 冲突事件 | 时间 | 类型 |
|---|---------|------|------|
| 1 | 「产品评审」 vs 「技术方案讨论」 | 14:00-15:00 | 部分重叠 |
| 2 | 「1v1」 vs 「团队周会」 | 16:00-17:00 | 完全重叠 |

#### 🟡 碎片时间({N} 段微碎片)
| # | 时间段 | 时长 | 前后会议 |
|---|--------|------|---------|
| 1 | 10:00-10:10 | 10min | 需求评审 → 技术讨论 |
| 2 | 15:00-15:15 | 15min | 客户会议 → 1v1 |

#### 🟡 连续会议(无缓冲)
- ⚠️ 09:00-12:00 连续 3 小时会议,无休息时间
- ⚠️ 14:00-16:30 连续 2.5 小时

#### 🟡 效率指标
| 指标 | 当前值 | 健康阈值 | 状态 |
|------|--------|---------|------|
| 会议占比 | 65% | < 40% | 🔴 |
| 专注时段 | 0 段 | ≥ 2 段 | 🔴 |
| 午休保护 | 有 1 场会议 | 无会议 | 🟡 |
| 缓冲时间率 | 30% | > 70% | 🔴 |

### 📅 时间线可视化

09:00 ████ Product requirements review 10:00 ████ Technical solution discussion 11:00 ████ Team weekly meeting 12:00 ████ Client lunch meeting ⚠️ Occupies lunch break 13:00 ░░░░ Free 14:00 ████ Product review ← Conflict 14:00 ████ Technical solution discussion ← Conflict 15:00 ░░ Micro-fragment (15min) 15:15 ████ 1v1 16:00 ████ 1v1 ← Conflict 16:00 ████ Team weekly meeting ← Conflict 17:00 ░░░░ Free


### 💡 优化方案

#### 方案 A:冲突解决
1. **「技术方案讨论」(14:00)** → 建议改到 **明天 10:00**(当日已无可用时段)
2. **「团队周会」(16:00)** → 建议改到 **13:30-14:00**(填充午后空闲)

#### 方案 B:增加缓冲
1. **「团队周会」(11:00)** → 缩短为 45 分钟(11:00-11:45),释放 15 分钟缓冲
2. **「客户午餐会」(12:00)** → 如非必须,建议移至 13:00

#### 方案 C:释放深度工作时间
1. 将 **「1v1」(15:15)** 移至下午最后(17:00),释放 15:00-17:00 为专注时段

选择一个方案(输入 A/B/C),或调整后确认执行。

Step 4: Execute optimization (optional, after user confirmation)

⚠️ Security rule: Schedule modifications must only be made after user confirmation.

# 修改日程时间
lark-cli calendar events patch --event "<event_id>" \
  --start "<新开始时间>" --end "<新结束时间>"

# 或取消日程(如果用户决定推掉某个会议)
lark-cli calendar events delete --event "<event_id>"

Note: Modifying schedules initiated by others may not be permitted. If it is a meeting organized by someone else, it is recommended to "decline" rather than modify the time.

# 拒绝日程
lark-cli calendar +rsvp --event "<event_id>" --rsvp "decline"

Fault Tolerance Mechanism

Exception Scenario Handling Method
No schedule on the target date Prompt "No schedule for this date", suggest choosing another date
calendar command reports permission or identity error Starting from v1.0.5, calendar no longer automatically falls back to the bot identity; explicit user login is required. Prompt the user to run lark-cli auth login --domain calendar
Cannot modify others' schedules Suggest declining or contacting the organizer to coordinate
All-day event Mark but do not include in conflict calculation (unless specified by the user)
Declined schedule Mark as "declined", do not include in conflict and time calculation

Permission table

Step Command Required scope Required
Get schedule calendar +agenda calendar:calendar.event:read ✅ Required
Modify schedule calendar events patch calendar:calendar.event:write Optional (when performing optimization)
Decline schedule calendar +rsvp calendar:calendar.event:write Optional
Delete schedule calendar events delete calendar:calendar.event:write Optional

Reference

  • lark-shared — Authentication, permissions (required reading)
  • lark-calendar — +agenda、events patch、+rsvp Detailed usage