360 Secure SkillHub
360 安全技能中心

Food Expiration Calculator

核心功能:根据食品的生产/购买日期(格式YYYY-MM-DD)和保质期(如“6个月”),计算过期日期、剩余或已过期天数,并判定食品处于“新鲜”“即将过期”或“过期”状态。典型场景:用户需确认食品是否可安全食用时使用。输入为指定格式的产品日期和保质期描述,输出含到期信息、天数及状态,也可通过Python脚本命令行调用。

goog
goog
热度 43.56
最近更新 2026-05-11 17:36:19
分类:生活依赖:代码执行应用场景:健康

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add food-cal
Metadata
name
food-cal
description
Food expiration calculator. Use when user wants to check if a food product has expired based on production/purchase date and shelf life. Calculates expiration date and tells user if food is still good, expired, or close to expiration.
category
daily life tool
contact
googcheng@qq.com

Food Expiration Calculator

This skill calculates whether a food product has expired based on the product date and shelf life.

Usage

User provides:

  • Product date: The production date, manufacture date, or purchase date (format: YYYY-MM-DD)
  • Shelf life: How long the product lasts (e.g., "6 months", "2 years", "18 months")

Output

The calculator returns:

  • Expiration date
  • Days remaining until expiration (or days since expiration)
  • Status: "Fresh" (more than 30 days left), "Expiring Soon" (less than 30 days), or "Expired"

Script

Use the Python script scripts/food_expiry.py to calculate:

python scripts/food_expiry.py --date 2025-06-01 --shelf-life "6 months"

Arguments:

  • --date or -d: Product date (YYYY-MM-DD)
  • --shelf-life or -s: Shelf life (e.g., "6 months", "2 years", "18 days")

The script outputs the expiration date, days remaining, and status.