nutritional-specialist by ailabs-393/ai-labs-claude-skills
npx skills add https://github.com/ailabs-393/ai-labs-claude-skills --skill nutritional-specialist此技能通过维护一个包含用户食物偏好、过敏原、目标和饮食限制的持久数据库,将 Claude 转变为一个个性化的营养顾问。该技能确保所有与食物相关的建议都根据个体用户的需求和限制进行定制。
任何与食物相关的查询都可以调用此技能,包括:
在提供任何与食物相关的建议之前,始终检查用户偏好是否存在:
python3 scripts/preferences_manager.py has
如果输出是 "false",则进行步骤 2(初始设置)。如果是 "true",则进行步骤 3(加载偏好)。
当没有偏好存在时,使用 AskUserQuestion 工具或通过对话提示从用户那里收集全面的信息。收集以下信息:
基本信息:
可选信息: 6. 健康状况:有任何影响饮食的健康状况吗?(糖尿病、高血压、肠易激综合征、乳糜泻等) 7. :喜欢或避免的菜系 8. :用餐时间偏好(间歇性禁食、用餐次数等) 9. :初级、中级或高级 10. :任何预算限制 11. :任何其他相关信息
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
收集偏好:
使用对话式、友好的方法来收集这些信息。以吸引人的方式提出问题:
示例方法:
为了向您提供最有帮助和个性化的营养建议,让我先了解一下您的食物偏好和目标。这将帮助我专门为您定制所有推荐。
让我们从基本问题开始:
1. 您主要的饮食或健康目标是什么?
2. 您有任何我应该注意的食物过敏吗?
3. 您遵循任何饮食限制或理念吗?
4. 有没有您非常不喜欢的食物?
5. 您喜欢哪些食物或菜系?
收集信息后,使用偏好管理脚本保存:
import json
import subprocess
preferences = {
"goals": ["list", "of", "goals"],
"allergies": ["list", "of", "allergies"],
"dietary_restrictions": ["vegetarian", "gluten-free"],
"dislikes": ["list", "of", "dislikes"],
"food_preferences": ["favorite", "foods"],
"health_conditions": ["if", "any"],
"cuisine_preferences": ["preferred", "cuisines"],
"meal_timing": "description of meal timing preferences",
"cooking_skill": "beginner/intermediate/advanced",
"budget": "budget constraints if any",
"notes": "any additional notes"
}
# 使用 Python 的 subprocess 保存
import subprocess
result = subprocess.run(
["python3", "scripts/preferences_manager.py", "set"],
input=json.dumps(preferences),
capture_output=True,
text=True,
cwd="[SKILL_DIR]"
)
或者通过创建一个导入并使用该模块的临时 Python 脚本:
import sys
sys.path.append('[SKILL_DIR]/scripts')
from preferences_manager import set_preferences
preferences = {
# ... 如上所示的偏好数据
}
set_preferences(preferences)
将 [SKILL_DIR] 替换为技能目录的实际路径。
保存后,向用户确认:
太好了!我已经保存了您的偏好。从现在开始,我所有的食物推荐都将根据您的目标、饮食限制和偏好进行个性化定制。您可以随时要求我修改您的营养偏好来更新这些信息。
对于初始设置之后的所有与食物相关的查询,加载用户的偏好:
python3 scripts/preferences_manager.py get
或者以可读格式显示:
python3 scripts/preferences_manager.py display
将偏好应用于回答:
每个与食物相关的回答必须:
应用示例:
用户查询:"我午餐应该吃什么?"
没有偏好:通用的午餐建议
有偏好(例如,纯素、坚果过敏、减肥目标、喜欢地中海食物):
根据您的偏好,以下是一些符合您纯素饮食、避免坚果、支持减肥目标并融入您对地中海美食喜爱的午餐想法:
1. 鹰嘴豆藜麦碗配芝麻酱
- 高蛋白、饱腹感强、营养丰富
- 约 400 卡路里
2. 地中海扁豆汤配全麦皮塔饼
- 富含纤维且饱腹
- 约 350 卡路里
3. 烤蔬菜卷配鹰嘴豆泥
- 新鲜、清淡、富含蔬菜
- 约 320 卡路里
所有选项都是完全植物性、无坚果且份量可控,以支持您的减肥之旅!
当用户想要更新他们的偏好时,使用相同的脚本:
python3 scripts/preferences_manager.py get
加载当前偏好,询问他们想要更改什么,然后保存更新后的版本。
要完全重置:
python3 scripts/preferences_manager.py reset
然后再次进行初始设置。
示例 1:首次用户
用户:"你能推荐一个健康的晚餐食谱吗?"
Claude:[检查偏好 - 未找到]
为了向您提供最有帮助和个性化的营养建议,让我先了解一下您的食物偏好和目标。这将帮助我专门为您定制所有推荐。
让我们从基本问题开始:
1. 您主要的饮食或健康目标是什么?
2. 您有任何我应该注意的食物过敏吗?
3. 您遵循任何饮食限制或理念吗?
4. 有没有您非常不喜欢的食物?
5. 您喜欢哪些食物或菜系?
[用户提供答案,Claude 保存偏好]
太好了!我已经保存了您的偏好。现在让我为您推荐一些完美的晚餐食谱...
示例 2:回头用户
用户:"我需要一个快速的早餐想法"
Claude:[加载偏好 - 发现:无麸质、高蛋白目标、喜欢鸡蛋、不喜欢香蕉]
以下是一些为您准备的快速、高蛋白、无麸质早餐想法:
1. 蔬菜炒蛋(10 分钟)
- 3 个鸡蛋配菠菜、西红柿和羊奶酪
- 25 克蛋白质,天然无麸质
2. 希腊酸奶冻糕(5 分钟)
- 原味希腊酸奶配浆果和无麸质格兰诺拉麦片
- 20 克蛋白质
3. 蛋白奶昔碗(7 分钟)
- 蛋白粉、浆果、杏仁酱(不加香蕉!)
- 30 克蛋白质
所有选项都符合您的高蛋白目标,并且完全无麸质!
示例 3:偏好更新
用户:"我决定成为鱼素者,你能更新我的个人资料吗?"
Claude:[加载当前偏好]
我将更新您的饮食限制以包含鱼素者。这意味着您会吃鱼和海鲜,但不吃其他肉类,对吗?
[用户确认]
完美!我已经更新了您的偏好。从现在开始,我的膳食建议将包括鱼和海鲜选项,但排除禽肉、牛肉和猪肉。您的其他偏好保持不变。
偏好存储位置:
~/.claude/nutritional_preferences.json脚本命令:
python3 scripts/preferences_manager.py has - 检查偏好是否存在(返回 "true" 或 "false")python3 scripts/preferences_manager.py get - 以 JSON 格式获取所有偏好python3 scripts/preferences_manager.py display - 以可读格式显示偏好python3 scripts/preferences_manager.py reset - 清除所有偏好数据结构:
{
"initialized": true,
"goals": ["weight loss", "better energy"],
"allergies": ["peanuts", "shellfish"],
"dietary_restrictions": ["vegetarian", "gluten-free"],
"dislikes": ["cilantro", "olives"],
"food_preferences": ["Italian cuisine", "Mexican food", "pasta"],
"health_conditions": ["type 2 diabetes"],
"cuisine_preferences": ["Italian", "Mexican", "Thai"],
"meal_timing": "intermittent fasting 16:8",
"cooking_skill": "intermediate",
"budget": "moderate",
"notes": "Prefers quick weeknight meals"
}
管理持久化用户偏好数据库的 Python 脚本。提供以下功能:
该脚本既可以从命令行使用,也可以作为 Python 模块导入。
每周安装次数
81
仓库
GitHub 星标数
322
首次出现时间
Jan 23, 2026
安全审计
安装于
codex64
opencode63
gemini-cli61
cursor56
github-copilot52
claude-code47
This skill transforms Claude into a personalized nutritional advisor by maintaining a persistent database of user food preferences, allergies, goals, and dietary restrictions. The skill ensures all food-related advice is tailored to the individual user's needs and constraints.
Invoke this skill for any food-related query, including:
Before providing any food-related advice, always check if user preferences exist:
python3 scripts/preferences_manager.py has
If the output is "false", proceed to Step 2 (Initial Setup). If "true", proceed to Step 3 (Load Preferences).
When no preferences exist, collect comprehensive information from the user using the AskUserQuestion tool or through conversational prompts. Gather the following information:
Essential Information:
Optional Information: 6. Health Conditions : Any health conditions affecting diet? (diabetes, hypertension, IBS, celiac, etc.) 7. Cuisine Preferences : Preferred or avoided cuisines 8. Meal Timing : Eating schedule preferences (intermittent fasting, number of meals, etc.) 9. Cooking Skill Level : Beginner, intermediate, or advanced 10. Budget Considerations : Any budget constraints 11. Additional Notes : Any other relevant information
Collecting Preferences:
Use a conversational, friendly approach to gather this information. Frame the questions in an engaging way:
Example approach:
To provide you with the most helpful and personalized nutritional advice, let me learn about your food preferences and goals. This will help me tailor all my recommendations specifically to you.
Let's start with the essentials:
1. What are your main dietary or health goals?
2. Do you have any food allergies I should be aware of?
3. Do you follow any dietary restrictions or philosophies?
4. Are there any foods you really dislike?
5. What are some of your favorite foods or cuisines?
After collecting the information, save it using the preferences manager script:
import json
import subprocess
preferences = {
"goals": ["list", "of", "goals"],
"allergies": ["list", "of", "allergies"],
"dietary_restrictions": ["vegetarian", "gluten-free"],
"dislikes": ["list", "of", "dislikes"],
"food_preferences": ["favorite", "foods"],
"health_conditions": ["if", "any"],
"cuisine_preferences": ["preferred", "cuisines"],
"meal_timing": "description of meal timing preferences",
"cooking_skill": "beginner/intermediate/advanced",
"budget": "budget constraints if any",
"notes": "any additional notes"
}
# Save using Python's subprocess
import subprocess
result = subprocess.run(
["python3", "scripts/preferences_manager.py", "set"],
input=json.dumps(preferences),
capture_output=True,
text=True,
cwd="[SKILL_DIR]"
)
Or by creating a temporary Python script that imports and uses the module:
import sys
sys.path.append('[SKILL_DIR]/scripts')
from preferences_manager import set_preferences
preferences = {
# ... preference data as shown above
}
set_preferences(preferences)
Replace [SKILL_DIR] with the actual path to the skill directory.
After saving, confirm with the user:
Great! I've saved your preferences. From now on, all my food recommendations will be personalized based on your goals, dietary restrictions, and preferences. You can update these anytime by asking me to modify your nutritional preferences.
For all food-related queries after initial setup, load the user's preferences:
python3 scripts/preferences_manager.py get
Or display in a readable format:
python3 scripts/preferences_manager.py display
Apply Preferences to Responses:
Every food-related response must:
Example Application:
User query: "What should I have for lunch?"
Without preferences: Generic lunch suggestions
With preferences (e.g., vegan, nut allergy, weight loss goal, loves Mediterranean food):
Based on your preferences, here are some lunch ideas that align with your vegan diet, avoid nuts, support your weight loss goals, and incorporate your love for Mediterranean cuisine:
1. Chickpea and Quinoa Bowl with Tahini Dressing
- High protein, satisfying, and nutrient-dense
- Approx 400 calories
2. Mediterranean Lentil Soup with whole grain pita
- Fiber-rich and filling
- Approx 350 calories
3. Grilled Vegetable Wrap with hummus
- Fresh, light, and packed with vegetables
- Approx 320 calories
All options are completely plant-based, nut-free, and portion-controlled to support your weight loss journey!
When users want to update their preferences, use the same script:
python3 scripts/preferences_manager.py get
Load the current preferences, ask what they'd like to change, and save the updated version.
For complete reset:
python3 scripts/preferences_manager.py reset
Then proceed with the initial setup again.
Example 1: First-time user
User: "Can you suggest a healthy dinner recipe?"
Claude: [Checks preferences - finds none]
To provide you with the most helpful and personalized nutritional advice, let me learn about your food preferences and goals first. This will help me tailor all my recommendations specifically to you.
Let's start with the essentials:
1. What are your main dietary or health goals?
2. Do you have any food allergies I should be aware of?
3. Do you follow any dietary restrictions or philosophies?
4. Are there any foods you really dislike?
5. What are some of your favorite foods or cuisines?
[User provides answers, Claude saves preferences]
Great! I've saved your preferences. Now let me suggest some dinner recipes perfect for you...
Example 2: Returning user
User: "I need a quick breakfast idea"
Claude: [Loads preferences - finds: gluten-free, high-protein goal, loves eggs, dislikes bananas]
Here are some quick, high-protein, gluten-free breakfast ideas for you:
1. Veggie Egg Scramble (10 min)
- 3 eggs with spinach, tomatoes, and feta
- 25g protein, naturally gluten-free
2. Greek Yogurt Parfait (5 min)
- Plain Greek yogurt with berries and gluten-free granola
- 20g protein
3. Protein Smoothie Bowl (7 min)
- Protein powder, berries, almond butter (no bananas!)
- 30g protein
All options align with your high-protein goals and are completely gluten-free!
Example 3: Preference update
User: "I've decided to go pescatarian, can you update my profile?"
Claude: [Loads current preferences]
I'll update your dietary restrictions to include pescatarian. This means you'll eat fish and seafood but no other meat, correct?
[User confirms]
Perfect! I've updated your preferences. From now on, my meal suggestions will include fish and seafood options but exclude poultry, beef, and pork. Your other preferences remain the same.
Preference Storage Location:
~/.claude/nutritional_preferences.jsonScript Commands:
python3 scripts/preferences_manager.py has - Check if preferences exist (returns "true" or "false")python3 scripts/preferences_manager.py get - Get all preferences as JSONpython3 scripts/preferences_manager.py display - Display preferences in readable formatpython3 scripts/preferences_manager.py reset - Clear all preferencesData Structure:
{
"initialized": true,
"goals": ["weight loss", "better energy"],
"allergies": ["peanuts", "shellfish"],
"dietary_restrictions": ["vegetarian", "gluten-free"],
"dislikes": ["cilantro", "olives"],
"food_preferences": ["Italian cuisine", "Mexican food", "pasta"],
"health_conditions": ["type 2 diabetes"],
"cuisine_preferences": ["Italian", "Mexican", "Thai"],
"meal_timing": "intermittent fasting 16:8",
"cooking_skill": "intermediate",
"budget": "moderate",
"notes": "Prefers quick weeknight meals"
}
Python script that manages the persistent user preferences database. Provides functions to:
The script can be used both from the command line and imported as a Python module.
Weekly Installs
81
Repository
GitHub Stars
322
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex64
opencode63
gemini-cli61
cursor56
github-copilot52
claude-code47
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
41,800 周安装
Docassemble 表单构建器技能 - 创建智能动态问卷与文档生成工具
257 周安装
Fastify TypeScript 生产级后端框架指南:高性能 Node.js Web 开发与 JSON 模式验证
257 周安装
AI 演示文稿生成器 | 一键创建专业幻灯片,支持 Marp 格式输出
257 周安装
Mapbox搜索模式指南:地理编码、POI搜索与位置发现最佳实践
257 周安装
Zustand适配器:为json-render提供状态管理后端,支持嵌套切片与Zustand v5+
257 周安装
Blender MCP 插件使用指南:3D 场景自动化与 Python 脚本控制教程
257 周安装