When to Use
Use when the user needs to work with CalDAV calendars through a local vdirsyncer + khal stack, especially for iCloud, Fastmail, Nextcloud, DAViCal, Radicale, or other standards-based calendar servers.
This skill is for local-first querying, event creation, safe edits, troubleshooting stale sync state, and handling ambiguous matches without corrupting recurring events or overwriting the wrong calendar.
Requirements
- -
vdirsyncer and khal must be installed and available in PATH. - The CalDAV account and collection config must already exist outside this skill.
- A TTY is required for interactive
khal edit workflows.
Core Rules
1. Sync is part of every real operation
- - Treat
vdirsyncer sync as part of the workflow, not an optional cleanup step. - Sync before reads when freshness matters, and sync again after confirmed writes so local and remote state converge.
- If collections are missing or a server path changed, use
vdirsyncer discover before assuming the calendar is empty. - Do not trust a stale
khal result until sync and cache state have been checked.
2. Use bounded windows and explicit calendar scope
- - Prefer day, 7-day, 14-day, or exact date range queries over open-ended searches.
- Narrow to a specific calendar whenever the user already knows the target calendar.
- Resolve ambiguous phrases such as "next Friday" or "this evening" into exact dates, times, and timezone assumptions before writing.
- Titles are not unique identifiers, so duplicate-event risk rises quickly when searching across every calendar at once.
3. Respect khal's editing limits
- -
khal edit is interactive and needs a TTY, so do not present it as a non-interactive batch primitive. - INLINECODE10 has only rudimentary recurrence editing and cannot edit event timezones directly, so complex recurring or timezone-sensitive events need extra caution.
- For fragile recurring series, DST-sensitive events, or uncertain matches, prefer inspect-first and recreate-only-with-approval over aggressive in-place edits.
- If the user wants bulk recurring surgery, stop and explain the risk before touching anything.
4. Verify every write with a read-back pass
- - Before changing an event, read the target window first so the agent sees the exact current state.
- After create, update, or delete, run a read-back check in the same bounded window and report the returned title, time, and calendar.
- Use title plus date/time plus calendar, or UID when available, to confirm the right event changed.
- If verification is ambiguous or inconsistent, stop and surface the conflict instead of claiming success.
5. Treat local vdir state and conflict policy as real data
- -
vdirsyncer is synchronizing real local .ics state, not just acting as a remote viewer. - The configured
conflict_resolution policy can overwrite one side, so do not assume an "a wins" or "b wins" setup is harmless. - Manual filesystem edits, cache resets, or storage path changes should be deliberate and reversible.
- Deleting
khal's cache database is a troubleshooting move for stale cache behavior, not a default fix for every mismatch.
6. Protect connection details, URLs, and certificates
- - Confirm the CalDAV base URL and collection path before debugging deeper issues.
- Certificate and TLS errors are blockers; stop and fix the trust chain before continuing.
- Keep private connection details and sync config out of summaries unless the user explicitly asks for them.
7. Finish with operational clarity
- - Every answer should end with the exact calendar scope, time window, action taken or proposed, and whether another sync is needed.
- If blocked, name the real blocker precisely: missing
vdirsyncer, missing khal, missing TTY, undiscovered collections, login failure, or ambiguous event match. - If the safest action is read-only, say so directly instead of improvising a write path.
Common Traps
- - Querying without syncing first -> stale answers and wrong scheduling decisions.
- Editing by title only -> the wrong duplicate event gets changed or deleted.
- Treating recurring events like normal one-offs -> series corruption or DST drift.
- Searching every calendar by default -> noisy matches and accidental writes to the wrong calendar.
- Using a one-sided
conflict_resolution policy blindly -> local or remote data loss. - Deleting
khal.db too early -> symptoms disappear briefly while the real sync bug remains. - Assuming any WebDAV-looking URL is a valid CalDAV calendar collection -> discovery and auth failures.
- Reporting success before read-back verification -> hidden mismatch between local cache and remote server.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
calendar-planner - Plan weeks, repair conflicts, and turn calendar state into defended scheduling decisions. - INLINECODE21 - Handle general scheduling requests when the user needs timing help beyond raw CalDAV operations.
- INLINECODE22 - Use provider-specific Fastmail mail and calendar APIs when CalDAV is not enough.
- INLINECODE23 - Turn calendar deadlines and follow-ups into reminder workflows.
Feedback
- - If useful: INLINECODE24
- Stay updated: INLINECODE25
技能名称: CalDAV
详细描述:
使用场景
当用户需要通过本地的 vdirsyncer + khal 工具栈操作 CalDAV 日历时使用,尤其适用于 iCloud、Fastmail、Nextcloud、DAViCal、Radicale 或其他基于标准的日历服务器。
此技能适用于本地优先的查询、事件创建、安全编辑、排查同步状态过期问题,以及处理模糊匹配,同时避免破坏重复事件或覆盖错误的日历。
前置要求
- - 必须安装 vdirsyncer 和 khal,且它们位于 PATH 环境变量中。
- CalDAV 账户和集合配置必须已在此技能之外预先存在。
- 交互式 khal edit 工作流需要 TTY 终端。
核心规则
1. 同步是每次实际操作的一部分
- - 将 vdirsyncer sync 视为工作流的一部分,而非可选的清理步骤。
- 当数据新鲜度重要时,在读取前进行同步;在确认写入后再次同步,以确保本地和远程状态一致。
- 如果集合缺失或服务器路径发生变化,在假设日历为空之前,先使用 vdirsyncer discover。
- 在同步和缓存状态被检查之前,不要信任过时的 khal 结果。
2. 使用有限的时间窗口和明确的日历范围
- - 优先选择按天、7天、14天或精确日期范围的查询,而非开放式搜索。
- 当用户已知目标日历时,将范围缩小到特定日历。
- 在写入之前,将模糊的短语(如下周五或今晚)解析为精确的日期、时间和时区假设。
- 标题不是唯一标识符,因此同时搜索所有日历时,重复事件的风险会迅速增加。
3. 尊重 khal 的编辑限制
- - khal edit 是交互式的,需要 TTY 终端,因此不要将其作为非交互式的批量操作来使用。
- khal 只有基本的重复事件编辑功能,无法直接编辑事件的时区,因此复杂的重复事件或涉及时区的事件需要格外谨慎。
- 对于脆弱的重复系列、夏令时敏感事件或不确定的匹配,优先采用先检查、经批准后再重新创建的方式,而非激进地原地编辑。
- 如果用户想要批量修改重复事件,在操作任何内容之前,先停下来解释风险。
4. 通过回读验证每次写入操作
- - 在更改事件之前,先读取目标时间窗口,以便代理了解当前的精确状态。
- 在创建、更新或删除之后,在同一有限时间窗口内执行回读检查,并报告返回的标题、时间和日历。
- 使用标题加日期/时间加日历,或可用时的 UID,来确认正确的事件已被更改。
- 如果验证结果模糊不清或不一致,停止操作并揭示冲突,而不是声称成功。
5. 将本地 vdir 状态和冲突策略视为真实数据
- - vdirsyncer 同步的是真实的本地 .ics 状态,而不仅仅是充当远程查看器。
- 配置的 conflict_resolution 策略可能会覆盖其中一方,因此不要认为a 胜出或b 胜出的设置是无害的。
- 手动编辑文件系统、重置缓存或更改存储路径应当经过深思熟虑且可逆。
- 删除 khal 的缓存数据库是解决缓存状态过期问题的排查手段,而不是解决所有不匹配问题的默认修复方法。
6. 保护连接详情、URL 和证书
- - 在深入调试更复杂的问题之前,先确认 CalDAV 基础 URL 和集合路径。
- 证书和 TLS 错误是阻塞性问题;在继续之前,先停下来修复信任链。
- 除非用户明确要求,否则不要在摘要中包含私密的连接详情和同步配置。
7. 以操作清晰性结束
- - 每个回答都应包含精确的日历范围、时间窗口、已执行或建议的操作,以及是否需要再次同步。
- 如果被阻塞,请精确指出真正的阻塞原因:缺少 vdirsyncer、缺少 khal、缺少 TTY、未发现的集合、登录失败或模糊的事件匹配。
- 如果最安全的操作是只读,请直接说明,而不是临时拼凑一个写入路径。
常见陷阱
- - 未先同步就进行查询 -> 得到过时的答案和错误的日程安排决策。
- 仅通过标题进行编辑 -> 错误的重复事件被更改或删除。
- 将重复事件视为普通的一次性事件 -> 系列事件损坏或夏令时漂移。
- 默认搜索所有日历 -> 匹配结果杂乱,并意外写入错误的日历。
- 盲目使用单方面的 conflict_resolution 策略 -> 本地或远程数据丢失。
- 过早删除 khal.db -> 症状短暂消失,但真正的同步错误依然存在。
- 假设任何看起来像 WebDAV 的 URL 都是有效的 CalDAV 日历集合 -> 发现和认证失败。
- 在回读验证之前就报告成功 -> 本地缓存与远程服务器之间存在隐藏的不匹配。
相关技能
如果用户确认,使用 clawhub install 安装:
- - calendar-planner - 规划周计划、修复冲突,并将日历状态转化为有依据的日程安排决策。
- schedule - 当用户需要超出原始 CalDAV 操作的时间安排帮助时,处理一般的日程安排请求。
- fastmail-api - 当 CalDAV 不够用时,使用特定于 Fastmail 提供商的邮件和日历 API。
- remind - 将日历截止日期和后续事项转化为提醒工作流。
反馈
- - 如果觉得有用:clawhub star caldav
- 保持更新:clawhub sync