← 返回 Skills 市场
734818028

diet-record

作者 mijufeng · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
91
总下载
2
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install diet-record
功能描述
Diet recording skill. Log meals via text description or food photo upload, auto-recognize food items and estimate nutrition/calories. Activate when user send...
使用说明 (SKILL.md)

Diet Logger

Record meals via photo or text, auto-recognize food items and calculate nutrition.

Data Storage

All diet records are stored in diet-log.jsonl (same directory as this skill file, one JSON object per line). Create the file if it doesn't exist.

Each record schema:

{
  "id": "uuid",
  "timestamp": "ISO-8601",
  "meal_type": "breakfast|lunch|dinner|snack",
  "items": [
    {
      "name": "食物名称",
      "portion_g": 150,
      "calories_kcal": 230,
      "protein_g": 12,
      "fat_g": 8,
      "carb_g": 28,
      "fiber_g": 2
    }
  ],
  "total_calories": 460,
  "notes": ""
}

User Preferences

Stored in diet-preferences.json (same directory as this skill file). Create the file if it doesn't exist.

{
  "photo_auto_log": null,
  "dietary_restrictions": [],
  "allergies": [],
  "disliked_foods": [],
  "favorite_foods": [],
  "diet_goal": null,
  "daily_calorie_target": null,
  "meal_routine": null,
  "notes": ""
}

Fields:

  • photo_auto_log: true = auto-log on photo upload, false = confirm first, null = not yet set.
  • dietary_restrictions: e.g. ["素食", "清真", "无麸质", "低碳水"]
  • allergies: e.g. ["花生", "海鲜", "乳糖不耐"]
  • disliked_foods: foods user explicitly dislikes
  • favorite_foods: frequently eaten or preferred foods
  • diet_goal: e.g. "减脂", "增肌", "维持体重", "均衡饮食"
  • daily_calorie_target: e.g. 1800 (kcal), null if not set
  • meal_routine: e.g. "一日三餐", "16:8轻断食", "少食多餐"
  • notes: any other dietary habits or notes from user

Preference Discovery

Photo auto-log preference: On the first food photo upload (or when photo_auto_log is null), recognize items as usual, then ask: "以后发食物照片时,要自动帮你记录饮食吗?还是每次先确认再记录?"

Dietary habits: Whenever user mentions dietary preferences, restrictions, allergies, goals, or habits in conversation, extract and save to the corresponding fields. Examples:

  • "我对花生过敏" → add "花生" to allergies
  • "我在减脂" → set diet_goal to "减脂"
  • "我不吃香菜" → add "香菜" to disliked_foods
  • "我每天控制在1500卡" → set daily_calorie_target to 1500
  • "我在做16:8轻断食" → set meal_routine to "16:8轻断食"

Preferences are accumulated over time — update individual fields without overwriting unrelated ones. Read preferences before each interaction to provide personalized feedback (e.g. warn if a meal exceeds calorie target, flag allergens in recognized food).

Workflow

Photo Input

  1. Receive food photo from user
  2. Read diet-preferences.json to check photo_auto_log
  3. Analyze the image: identify each food item, estimate portion size
  4. Look up nutrition data per item (use the reference table below)
  5. If photo_auto_log is null: present result, ask preference (see above), then log
  6. If photo_auto_log is true: calculate totals, log directly, respond with summary
  7. If photo_auto_log is false: present recognized items — ask user to confirm or correct, then log
  8. Append record to diet-log.jsonl

Text Input

  1. Parse food description (e.g. "一碗牛肉面加个煎蛋")
  2. Break into individual items with estimated portions
  3. Look up nutrition and calculate totals
  4. Append record

Daily Summary

When user asks "今天吃了什么" or "daily summary":

python3 -c "
import json, datetime
today = datetime.date.today().isoformat()
with open('diet-log.jsonl') as f:
    meals = [json.loads(l) for l in f if today in l]
total = sum(m['total_calories'] for m in meals)
print(f'Today: {len(meals)} meals, {total:.0f} kcal')
for m in meals:
    items = ', '.join(i['name'] for i in m['items'])
    print(f\"  {m['meal_type']}: {m['total_calories']:.0f} kcal — {items}\")
"

Nutrition Reference (per 100g)

Common foods for quick lookup (no API needed):

Food kcal Protein Fat Carb
白米饭 116 2.6 0.3 25.9
面条(煮) 110 3.5 0.5 22
鸡胸肉 133 31 1.2 0
鸡蛋(煮) 144 13 10 1.1
牛肉(瘦) 125 20 4.2 0.2
三文鱼 208 20 13 0
豆腐 73 8.1 3.7 1.5
西兰花 34 2.8 0.4 5
番茄 18 0.9 0.2 3.9
苹果 52 0.3 0.2 13.8
香蕉 89 1.1 0.3 22.8
牛奶(全脂) 61 3.2 3.3 4.8
酸奶(原味) 61 3.5 3.3 4.7
全麦面包 247 13 3.4 41
燕麦片 379 13 6.5 67

For unlisted foods, estimate based on similar items or ask the user for specifics.

Cooking Method Calorie Adjustments

  • 清蒸/水煮: baseline
  • 炒(少油): +10-15%
  • 炒(多油): +20-30%
  • 油炸: +30-50%
  • 烧烤: -5% (fat drips off)

Portion Estimation

  • 一碗米饭 ≈ 200g
  • 一盘菜 ≈ 200-300g
  • 一个拳头 ≈ 150g (水果/肉)
  • 一汤匙油 ≈ 10g (90 kcal)
  • 一杯(240ml)牛奶 ≈ 245g

Key Rules

  • Present results in a clean table format
  • When recognition confidence is low, ask user to confirm before logging
  • Auto-detect meal_type from time: 06-10 breakfast, 11-14 lunch, 17-20 dinner, else snack
  • Remind if daily protein is under 1.2g/kg body weight (when user weight is known)
  • Never make moral judgments about food choices
安全使用建议
This skill appears to do what it says: it will read/write two local files (diet-log.jsonl and diet-preferences.json) and automatically extract and store diet-related preferences and allergy information from conversations. Before installing, consider: (1) privacy — these files contain health-related data and will be stored in the skill directory (check where that is on your system and whether it is backed up or accessible to other processes); (2) the photo-auto-log option — enabling it will let the skill log meals automatically when you upload photos, so confirm you want that behavior; (3) retention and deletion — decide how to delete/export logs if you stop using the skill; (4) platform capabilities — the skill assumes the agent can perform image recognition locally (if your platform lacks vision features, photo recognition may not work); (5) if you require encryption or stronger access controls for health data, consider guarding or relocating these files. Overall there are no hidden endpoints, no credential requests, and no downloads, but treat stored diet and allergy data as sensitive.
功能分析
Type: OpenClaw Skill Name: diet-record Version: 1.0.1 The diet-record skill is a legitimate tool for logging meals and tracking nutrition. It uses local JSONL and JSON files for data storage and includes a small, safe Python snippet in SKILL.md to calculate daily calorie totals, with no evidence of data exfiltration or malicious intent.
能力评估
Purpose & Capability
The name/description (diet recording, photo/text input, nutrition estimation) aligns with the SKILL.md and the provided JSON templates. No unrelated credentials, binaries, or external services are requested. Photo analysis is described but no external API is required in the instructions — this is consistent for an instruction-only skill that expects the agent/platform to provide vision capabilities.
Instruction Scope
The instructions read and write two local files (diet-log.jsonl and diet-preferences.json) in the skill directory and accumulate personal diet/preferences data. This behavior is consistent with a logging skill but is a privacy-relevant action the user should be aware of. The SKILL.md also asks the agent to extract and persist dietary preferences from casual conversation (allergies, goals, etc.), which is expected but means the skill will store personal health-related data over time.
Install Mechanism
Instruction-only skill with no install spec, no downloads, and no code files that would be executed. This is the lowest-risk install profile and matches the skill's simple data-logging purpose.
Credentials
No environment variables, no external credentials, and no system config paths are requested. The only resources used are local files stored next to the skill, which is proportionate to a personal logger. There are no unexpected secret requests.
Persistence & Privilege
The skill is not marked always:true and uses only its own files; it does not request system-wide configuration changes or access to other skills' credentials. Autonomous invocation is allowed (platform default) but not combined with any broad credential access.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install diet-record
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /diet-record 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Added two new template files: diet-preferences.json and record-schema.json for easier setup and reference. - No functional logic changes to the skill code or documentation. - Provides sample schemas for user preference and diet record data storage.
v1.0.0
Initial release of diet-record skill. - Log meals with text or food photo; automatic recognition and nutrition estimation for common foods. - Support for dietary preferences, restrictions, allergies, and nutrition goals — stored and updated over time. - All meal and preference data stored locally in JSON files. - Personalized responses based on user preferences; alerts for allergens and calorie limits. - Daily meal summaries and clean table-format result presentations. - Triggers include both Chinese and English dietary logging phrases.
元数据
Slug diet-record
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

diet-record 是什么?

Diet recording skill. Log meals via text description or food photo upload, auto-recognize food items and estimate nutrition/calories. Activate when user send... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 91 次。

如何安装 diet-record?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install diet-record」即可一键安装,无需额外配置。

diet-record 是免费的吗?

是的,diet-record 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

diet-record 支持哪些平台?

diet-record 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 diet-record?

由 mijufeng(@734818028)开发并维护,当前版本 v1.0.1。

💬 留言讨论