liangdabiao/dingtalk-cli-workflow · Archived

dingtalk-workflow-health-diary

健康日记 — 通过对话记录饮食和身体状态,AI 分析?

First seen Apr 14, 2026

Installation

$ npx skills add liangdabiao/dingtalk-cli-workflow --skill dingtalk-workflow-health-diary

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from liangdabiao/dingtalk-cli-workflow · top by installs.

npx skills add liangdabiao/dingtalk-cli-workflow

Browse all from liangdabiao/dingtalk-cli-workflow

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 8
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.1.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 15,377 B
  • docs SUMMARY.md 211 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

健康日记 (dingtalk-workflow-health-diary)

通过对话记录饮食和身体状态,AI 分析食物与身体不适的关联模式。
相比飞书版本,钉钉独有优势:可整合考勤打卡数据间接推断作息规律。

触发方式

"记录饮食"  "健康日记"  "吃了什么"  "身体不舒服"  "健康追踪"  "午餐记录"

工作模式

模式 1: 文字描述记录

触发: "午餐吃了红烧牛肉面和一杯冰美式" / "今天早餐吃了一个三明治"

工作流:

Step 0: 确保数据表已初始化(见下方"数据初始化"章节)
    └── dws aitable base list → 检查是否存在"健康日记" Base
        不存在 → 执行完整初始化流程(创建 Base → 创建表 → 创建字段)

Step 1: 解析用户输入
├── 提取餐次(早餐/午餐/晚餐/加餐)
├── 提取食物列表和份量
└── 推断日期("昨天"→-1天、"前天"→-2天,默认今天)

Step 2: AI 检查关联风险
└── dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --keyword "<食物名>" --yes -f json
    如果有高风险食物(关联强度="高") → 立即提醒

Step 3: 写入饮食记录(⚠️ 必须包含"标题"主字段)
└── dws aitable record create --base-id <hd-base-id> --table-id <diet-table-id> --records '[{"cells":{"标题":"2026-04-06 午餐","日期":"2026-04-06","餐次":"午餐","食物列表":"红烧牛肉面, 冰美式"}}]' --yes -f json

Step 4: 如果有风险,发送提醒
└── dws ding message send --robot-code "bot_code" --users "manager6950" --content "..." --type "1" --yes

输出格式:

已记录饮食:
| 日期 | 餐次 | 食物 |
|------|------|------|
| 2026-04-06 | 午餐 | 红烧牛肉面(一大碗), 冰美式(大杯) |

⚠️ 提醒:之前 3 次喝冰美式后 1-2 小时内都出现了胃部不适,请注意观察。

模式 2: 身体状态记录

触发: "下午胃有点不舒服" / "今天睡得不好" / "头有点晕"

工作流:

Step 1: 解析身体状态
├── 状态描述(胃部不适/头痛/疲劳/失眠等)
├── 严重程度(轻微/中度/严重)
└── 时间(自动记录当前时间,格式 "YYYY-MM-DDTHH:mm:ss")

Step 2: AI 回溯检查今日饮食
└── dws aitable record query --base-id <hd-base-id> --table-id <diet-table-id> --limit 50 --yes -f json
    → 从中筛选今日记录,检查时间差

Step 3: 查询历史关联模式
└── dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --limit 50 --yes -f json
    → 查看是否有食物关联

Step 4: 写入身体状态记录
└── dws aitable record create --base-id <hd-base-id> --table-id <health-table-id> --records '[{"cells":{"标题":"2026-04-06 胃部不适","时间":"2026-04-06T15:00:00","状态描述":"胃部不适","严重程度":"轻微"}}]' --yes -f json

Step 5: 如果发现新的关联模式,更新关联分析表
└── dws aitable record create --base-id <hd-base-id> --table-id <correlation-table-id> --records '[{"cells":{"标题":"冰美式-胃部不适","食物":"冰美式","状态":"胃部不适","时间差":"1-2小时","出现次数":1,"关联强度":"中"}}]' --yes -f json
    或更新已有记录:
    dws aitable record update --base-id <hd-base-id> --table-id <correlation-table-id> --records '[{"recordId":"<id>","cells":{"出现次数":3,"关联强度":"高"}}]' --yes -f json

模式 3: 关联分析

触发: "吃什么容易胃不舒服?" / "分析一下饮食和健康的关系" / "有没有食物关联"

工作流:

Step 1: 查询所有饮食记录和身体状态记录
├── dws aitable record query --base-id <hd-base-id> --table-id <diet-table-id> --limit 100 --yes -f json
└── dws aitable record query --base-id <hd-base-id> --table-id <health-table-id> --limit 100 --yes -f json

Step 2: 查询已有关联分析
└── dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --limit 50 --yes -f json

Step 3: AI 执行关联分析
├── 按食物分组统计身体状态出现频率
├── 计算时间差模式(吃X后多久出现症状)
├── 计算关联强度(高/中/低,基于出现次数和时间一致性)
└── 排除偶然关联(出现次数 < 2 的不报告)

Step 4: 更新关联分析表并输出报告
└── 对每对新的食物-状态关联,写入或更新 correlation 表

模式 4: 周报生成

触发: "生成本周健康报告" / "健康周报"

工作流:

Step 1: 查询本周数据
├── dws aitable record query --base-id <hd-base-id> --table-id <diet-table-id> --limit 100 --yes -f json
├── dws aitable record query --base-id <hd-base-id> --table-id <health-table-id> --limit 100 --yes -f json
└── dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --limit 50 --yes -f json

Step 2: 查询考勤数据(钉钉独有)
└── dws attendance record get --user "manager6950" --date "2026-04-06" --yes -f json
    → 推断作息规律(上班时间 → 间接了解起床时间)
    → 注意:dws attendance summary 不可用,仅使用 record get 获取考勤数据

Step 3: AI 生成周报

周报格式:

## 健康周报(MM/DD - MM/DD)

### 饮食概览
- 记录天数:N 天
- 总餐次:M 次
- 饮食规律性:较好/一般/较差

### 身体状态
- 不适记录:N 次
- 主要症状:胃部不适 X 次、疲劳 Y 次

### 作息规律(钉钉独有)
- 平均上班打卡时间:HH:MM
- 平均下班打卡时间:HH:MM
- 工作时长:约 N 小时

### 关联发现
| 食物 | 状态 | 出现次数 | 典型时间差 | 关联强度 |
|------|------|---------|-----------|---------|
| 冰美式 | 胃部不适 | 3次 | 1-2小时 | 高 |
| 辣味火锅 | 失眠 | 1次 | 6-8小时 | 中 |

### 建议
- 冰美式与胃部不适有强关联,建议减少摄入或改用热饮
- 辣味火锅建议避免晚餐食用

模式 5: 主动提醒

触发: 用户记录含有高风险食物的饮食时自动触发(嵌入在模式 1 的 Step 2 中)

工作流:

Step 1: 用户记录饮食 → 提取食物名称关键词

Step 2: 查询关联分析表
└── dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --keyword "<食物名>" --yes -f json

Step 3: 如果发现高关联强度记录(出现次数 ≥ 3 且关联强度="高") → 立即提醒

数据初始化

首次使用时,先检查 Base 是否已存在,不存在则按完整流程创建:

# Step 0: 检查是否已初始化
dws aitable base list --yes -f json | grep "健康日记"
# 如果不存在,执行以下步骤:

# Step 1: 创建 Base
dws aitable base create --name "健康日记" --yes -f json
# 返回 baseId,记为 <hd-base-id>

# Step 2: 创建 3 张表(⚠️ 每张表自动创建一个 primaryDoc 类型的"标题"主字段)
dws aitable table create --base-id <hd-base-id> --name "饮食记录" --yes -f json
# 返回 tableId,记为 <diet-table-id>
dws aitable table create --base-id <hd-base-id> --name "身体状态" --yes -f json
# 返回 tableId,记为 <health-table-id>
dws aitable table create --base-id <hd-base-id> --name "关联分析" --yes -f json
# 返回 tableId,记为 <correlation-table-id>

# Step 3: 为每张表添加业务字段
# ⚠️ 字段类型必须用英文名: text / date / number / select / multiselect
# ⚠️ 字段参数名必须用 "fieldName"(不是 "name")

# 饮食记录表
dws aitable field create --base-id <hd-base-id> --table-id <diet-table-id> \
  --fields '[{"fieldName":"日期","type":"date"},{"fieldName":"餐次","type":"text"},{"fieldName":"食物列表","type":"text"}]' \
  --yes -f json

# 身体状态表
dws aitable field create --base-id <hd-base-id> --table-id <health-table-id> \
  --fields '[{"fieldName":"时间","type":"text"},{"fieldName":"状态描述","type":"text"},{"fieldName":"严重程度","type":"text"},{"fieldName":"睡眠质量","type":"text"}]' \
  --yes -f json

# 关联分析表
dws aitable field create --base-id <hd-base-id> --table-id <correlation-table-id> \
  --fields '[{"fieldName":"食物","type":"text"},{"fieldName":"状态","type":"text"},{"fieldName":"时间差","type":"text"},{"fieldName":"出现次数","type":"number"},{"fieldName":"关联强度","type":"text"}]' \
  --yes -f json

表结构总览

表1: 饮食记录 — tableId: <diet-table-id>

字段名 类型 来源 说明
标题 primaryDoc 自动创建 主字段,建议填 "YYYY-MM-DD 餐次"
日期 date 手动创建 记录日期,格式 "YYYY-MM-DD"
餐次 text 手动创建 早餐/午餐/晚餐/加餐
食物列表 text 手动创建 食物名称和份量,逗号分隔

表2: 身体状态 — tableId: <health-table-id>

字段名 类型 来源 说明
标题 primaryDoc 自动创建 主字段,建议填 "YYYY-MM-DD 状态描述"
时间 text 手动创建 状态记录时间,格式 "YYYY-MM-DDTHH:mm:ss"
状态描述 text 手动创建 如"胃部不适"、"疲劳"
严重程度 text 手动创建 轻微/中度/严重
睡眠质量 text 手动创建 好/一般/差(可选,需用户主动提供)

表3: 关联分析 — tableId: <correlation-table-id>

字段名 类型 来源 说明
标题 primaryDoc 自动创建 主字段,建议填 "食物 - 状态"
食物 text 手动创建 关联的食物
状态 text 手动创建 关联的身体状态
时间差 text 手动创建 典型延迟(如"1-2小时")
出现次数 number 手动创建 关联出现次数
关联强度 text 手动创建 高/中/低

dws CLI 命令参考

创建健康日记(完整初始化)

# 1. 创建 Base
dws aitable base create --name "健康日记" --yes -f json

# 2. 创建表(每张表自动生成"标题"主字段)
dws aitable table create --base-id <hd-base-id> --name "饮食记录" --yes -f json
dws aitable table create --base-id <hd-base-id> --name "身体状态" --yes -f json
dws aitable table create --base-id <hd-base-id> --name "关联分析" --yes -f json

# 3. 创建业务字段(类型用英文: text/date/number,参数用 fieldName)
dws aitable field create --base-id <hd-base-id> --table-id <diet-table-id> \
  --fields '[{"fieldName":"日期","type":"date"},{"fieldName":"餐次","type":"text"},{"fieldName":"食物列表","type":"text"}]' --yes -f json
dws aitable field create --base-id <hd-base-id> --table-id <health-table-id> \
  --fields '[{"fieldName":"时间","type":"text"},{"fieldName":"状态描述","type":"text"},{"fieldName":"严重程度","type":"text"},{"fieldName":"睡眠质量","type":"text"}]' --yes -f json
dws aitable field create --base-id <hd-base-id> --table-id <correlation-table-id> \
  --fields '[{"fieldName":"食物","type":"text"},{"fieldName":"状态","type":"text"},{"fieldName":"时间差","type":"text"},{"fieldName":"出现次数","type":"number"},{"fieldName":"关联强度","type":"text"}]' --yes -f json

记录饮食(⚠️ 必须包含"标题"主字段)

dws aitable record create --base-id <hd-base-id> --table-id <diet-table-id> \
  --records '[{"cells":{"标题":"2026-04-06 午餐","日期":"2026-04-06","餐次":"午餐","食物列表":"红烧牛肉面(一大碗), 冰美式(大杯)"}}]' \
  --yes -f json

记录身体状态(⚠️ 必须包含"标题"主字段)

dws aitable record create --base-id <hd-base-id> --table-id <health-table-id> \
  --records '[{"cells":{"标题":"2026-04-06 胃部不适","时间":"2026-04-06T15:00:00","状态描述":"胃部不适","严重程度":"轻微"}}]' \
  --yes -f json

查询记录

# 查询饮食记录
dws aitable record query --base-id <hd-base-id> --table-id <diet-table-id> --limit 50 --yes -f json

# 按关键词查询
dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --keyword "冰美式" --yes -f json

# 查询身体状态
dws aitable record query --base-id <hd-base-id> --table-id <health-table-id> --limit 50 --yes -f json

# 查询关联分析
dws aitable record query --base-id <hd-base-id> --table-id <correlation-table-id> --limit 50 --yes -f json

更新记录

# 更新关联分析记录(需要 recordId)
dws aitable record update --base-id <hd-base-id> --table-id <correlation-table-id> \
  --records '[{"recordId":"<recordId>","cells":{"出现次数":3,"关联强度":"高"}}]' --yes -f json

查询考勤(作息参考,钉钉独有)

# 获取打卡记录(测试通过;未设考勤组时返回空记录,属正常现象)
dws attendance record get --user "manager6950" --date "2026-04-06" --yes -f json

# 注意:dws attendance summary 服务端报"统计类型错误"(code C0002),不可用

DING 紧急提醒

dws ding message send --robot-code "bot_code" --users "manager6950" --content "提醒:你刚吃了冰美式,之前多次在喝完后出现胃部不适" --type "1" --yes

定时任务

任务 Cron 说明
健康周报 0 20 0 每周日 20:00 生成周报
CronCreate: cron="0 20 * * 0", prompt="生成本周的健康报告并保存到知识库", recurring=true, durable=true

联动 Skill

联动 Skill 数据交互 说明
morning-brief 提供饮食提醒 晨间简报中增加饮食注意事项
business-advisor 提供健康数据 顾问团关注工作效率与健康的关系

注意事项

  1. 所有 dws 命令必须加 --yes 标志
  2. aitable 字段创建:

- 类型必须用英文名:text / date / number / select / multiselect(不能用中文"文本"或数字编号 1/2) - 参数名必须用 "fieldName"(不能用 "name")

  1. 每张表自动创建一个 primaryDoc 类型的"标题"主字段,创建记录时必须包含该字段
  2. 关联分析需要积累至少 2 次数据才报告,避免误报
  3. 关联强度判断:出现 3 次以上 = 高,2 次 = 中,1 次 = 不报告
  4. 考勤数据仅作为作息参考,不作为健康判断依据
  5. DING 消息仅用于高风险食物提醒,避免频繁打扰
  6. 钉钉 CLI 无图片识别命令(与飞书不同),用户需文字描述食物
  7. 考勤查询 dws attendance record get 正常工作,但 dws attendance summary 服务端报错,不可用
  8. 组织未设置考勤组时,attendance record get 返回空记录,属正常现象

已知问题

  • dws attendance summary 服务端报 "统计类型错误"(code C0002),不可用。考勤数据改用 dws attendance record get 获取