
Ljg Calendar
- 5 installs
- 8 repo stars
- Updated February 27, 2026
- lijigang/ljg-skill-calendar
Helps with ai & agent building tasks.
About
ljg-calendar is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- ljg-calendar
- AI & Agent Building
- AI-coding skill
Ljg Calendar by the numbers
- 5 all-time installs (skills.sh)
- Ranked #13,065 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/lijigang/ljg-skill-calendar --skill ljg-calendarAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 5 |
|---|---|
| repo stars | ★ 8 |
| Last updated | February 27, 2026 |
| Repository | lijigang/ljg-skill-calendar ↗ |
What it does
Helps with ai & agent building tasks.
Files
Usage
<example> User: 加到日历 [附带聊天截图或文本描述] Assistant: [Calls ljg-calendar, parses content, writes to Calendar] </example>
<example> User: 明天下午3点开会,在望京SOHO,帮我加到日历 Assistant: [Calls ljg-calendar with the text] </example>
<example> User: 下周有什么安排 Assistant: [Calls ljg-calendar, queries next week's events] </example>
约束
本 skill 不生成文件,直接操作 macOS Calendar,因此 L0 org-mode/denote 规范不适用。
核心约束:
- AppleScript 日期构造 禁止字符串解析,必须逐字段赋值(详见
references/applescript-patterns.md) - 字段赋值顺序:year → month → day → hours → minutes → seconds
- 默认写入
"个人"日历,用户指定其他日历时按指定写入 - 解析不确定时,向用户确认后再写入
Instructions
为了执行本项技能,请严格按照以下步骤操作:
0. 判断操作类型
根据用户意图分流:
- 查询("下周安排"、"这周有什么事"、"明天日程")→ 跳到步骤 Q
- 写入("加到日历"、附带事件信息的文本/图片)→ 跳到步骤 1
---
Q. 查询日历事件
读取 references/applescript-patterns.md,使用查询模式。
时间范围推断:
- "下周" → 下周一 00:00 到下周日 24:00
- "这周" → 本周一 00:00 到本周日 24:00
- "明天" → 明天 00:00 到明天 24:00
- "最近" → 今天到未来 7 天
通过 AppleScript 遍历所有日历,按日期排序输出。区分全天事件和定时事件,定时事件显示时间和地点。
执行方式:Bash 工具使用 run_in_background: true 执行 osascript,再通过 TaskOutput 取回结果。用户端只看到最终格式化表格,不暴露原始脚本和输出。
结果用表格呈现。完成后结束,不继续后续步骤。
---
1. 读取参考资料
读取 references/applescript-patterns.md,加载 AppleScript 安全模式。
2. 解析事件信息
从用户输入(文本或图片)中提取以下字段:
| 字段 | 必填 | 说明 |
|---|---|---|
| 标题 (summary) | 是 | 事件名称 |
| 日期 (date) | 是 | 年月日 |
| 开始时间 (start) | 否 | 缺省则创建全天事件 |
| 结束时间 (end) | 否 | 缺省则开始时间 +2h |
| 地点 (location) | 否 | |
| 备注 (description) | 否 | |
| 目标日历 | 否 | 缺省 "个人" |
图片输入:先识别图片中的文字内容(聊天记录、海报、邮件截图等),再从中提取事件信息。
日期推断:
- "明天" "下周三" 等相对日期 → 基于当前日期计算
- "3.4" "3/4" "3月4号" → 当年对应日期
- 缺少年份 → 默认当年;如该日期已过且距今 < 30天 → 仍用当年;否则用下一年
3. 确认(仅在模糊时)
如果所有字段都能明确提取,直接执行写入,不需确认。
仅在以下情况向用户确认:
- 日期不明确(如 "过阵子"、"最近")
- 存在多个可能的事件
- 关键信息矛盾
4. 构造 AppleScript 并执行
使用 Bash 工具执行 osascript -e '...',设置 run_in_background: true,再通过 TaskOutput 取回结果。
日期构造模板(严格遵循):
set startD to current date
set year of startD to {YEAR}
set month of startD to {MONTH}
set day of startD to {DAY}
set hours of startD to {HOUR}
set minutes of startD to {MINUTE}
set seconds of startD to 0全天事件:allday event:true,end date 设为次日 00:00。
5. 报告结果
写入成功后,用一行简洁确认:
已添加:{日期} {时间} — {标题} @ {地点}AppleScript 日历操作模式
核心原则:日期构造
永远不要 用字符串构造日期(如 date "2026-03-04 19:00:00"),AppleScript 的日期字符串解析因 locale 不同会产生灾难性错误。
唯一正确方式:从 current date 出发,逐字段赋值。
set d to current date
set year of d to 2026
set month of d to 3
set day of d to 4
set hours of d to 19
set minutes of d to 0
set seconds of d to 0注意:字段赋值顺序建议 year → month → day,避免月末溢出(如 3月31日 → 设month为2 → 溢出)。
创建事件
tell application "Calendar"
tell calendar "个人"
make new event with properties {summary:"标题", location:"地点", start date:startD, end date:endD, description:"备注"}
end tell
end tell创建全天事件
tell application "Calendar"
tell calendar "个人"
make new event with properties {summary:"标题", allday event:true, start date:startD, end date:endD}
end tell
end tell查询事件
tell application "Calendar"
set startDate to current date
-- set fields...
set endDate to startDate + 7 * days
repeat with cal in calendars
set evts to (every event of cal whose start date ≥ startDate and start date < endDate)
repeat with e in evts
-- process event
end repeat
end repeat
end tell默认日历
- 写入目标:
"个人"日历(用户 iCloud 主日历) - 如用户指定其他日历(如 "工作"),按指定写入
常见陷阱
1. 日期字符串解析 — 已禁止,见上 2. 月末溢出 — 设 day 为 31 后改 month 为 2 会出错,先设 year/month 再设 day 3. 全天事件的 end date — 应为次日 00:00,不是当天 23:59 4. 时区 — current date 自动使用系统时区,无需手动处理