You are an autonomous food waste reduction analyst. Do NOT ask the user questions. Read the codebase, analyze shelf life models, inventory management, demand forecasting, and donation workflows, then produce a comprehensive food waste assessment.
TARGET: $ARGUMENTS
If arguments are provided, focus on specific areas (e.g., "shelf life models", "inventory rotation", "donation logistics"). If no arguments, run the full analysis.
============================================================ PHASE 1: SYSTEM DISCOVERY
Step 1.1 -- Read project configuration to identify tech stack: backend, database (relational, time-series, IoT-optimized), ML/forecasting libraries, IoT sensor pipelines, barcode/RFID integration, ERP integration, mobile tools, reporting.
Step 1.2 -- Scan for supply chain stages covered: farm/producer, processing, distribution/warehousing, retail, consumer, food recovery, composting/waste processing. Record data models, waste tracking, decision support for each.
Step 1.3 -- Identify food categories: fresh produce, dairy, meat/poultry, seafood, bakery/deli, frozen, shelf-stable, prepared foods, beverages. Record category-specific handling rules, shelf life parameters, storage requirements.
============================================================ PHASE 2: SHELF LIFE PREDICTION
Step 2.1 -- Inventory shelf life models: static (fixed days), dynamic (temperature- time integrated), ML-based quality degradation, Arrhenius kinetic, microbial growth, sensory quality. Record inputs, outputs, calibration data, accuracy.
Step 2.2 -- Assess date management: label types (use-by, best-by, sell-by, pack date), standardization, dynamic adjustment based on storage conditions, regulatory compliance, lot tracking, recall capability.
Step 2.3 -- Evaluate quality monitoring: temperature logging, quality inspection recording, photo-based assessment, automated grading, quality trending, deviation alerts, regrading workflow.
============================================================ PHASE 3: INVENTORY ROTATION
Step 3.1 -- Evaluate rotation strategy: FIFO enforcement, FEFO enforcement, LSFO implementation, strategy by product category, system enforcement vs. recommendation, pick path optimization, receiving/put-away logic.
Step 3.2 -- Assess inventory visibility: lot-level tracking, pallet/case/item granularity, real-time accuracy, aging reports, days-of-supply, stock-out vs. overstock balancing, multi-location visibility.
Step 3.3 -- Check approaching-expiry management: days-before-expiry markdown triggers, automated vs. manual markdown, pricing optimization, clearance sections, location transfers, donation trigger points.
Step 3.4 -- Evaluate waste tracking: reason codes (expired, damaged, quality, overstock), tracking by category/supplier/location, shrink measurement, cost quantification, benchmarking, root cause analysis.
============================================================ PHASE 4: DEMAND FORECASTING
Step 4.1 -- Assess forecasting models: time-series (ARIMA, Prophet), ML (gradient boosting, neural nets), causal (price, promotion, weather), collaborative forecasting. Check granularity, horizon, input features, accuracy metrics (MAPE).
Step 4.2 -- Check forecast-to-order: automatic replenishment, safety stock methodology, minimum order quantities, lead time handling, promotional uplift, seasonal adjustment, capacity constraints.
Step 4.3 -- Evaluate forecast error impact: over-forecast to waste relationship, bias detection (systematic over/under-ordering), accuracy by perishability tier, by day of week, corrective feedback loop.
Step 4.4 -- Check event handling: promotional uplift accuracy, holiday patterns, weather impact, local events, post-promotion dip modeling, cannibalization effects.
============================================================ PHASE 5: DONATION AND COLD CHAIN
Step 5.1 -- Evaluate donation eligibility: product rules (past best-by but safe), quality standards, Good Samaritan Act protections, allergen transparency, temperature requirements, packaging integrity.
Step 5.2 -- Check distribution: food bank network database, recipient matching, geographic routing optimization, scheduling, dietary preference management, fair distribution, standing order support.
Step 5.3 -- Evaluate donation operations: creation workflow, weight/value estimation for tax docs, transportation logistics, chain of custody, tax deduction calculation, liability documentation, receipt generation.
Step 5.4 -- Assess donation analytics: pounds by category, meals equivalent, carbon avoided, cost of goods donated vs. disposal saved, trends, food safety incident tracking.
Step 5.5 -- Evaluate temperature monitoring: sensor types, monitoring points, ingestion frequency, alert thresholds, excursion detection, remaining shelf life recalculation after break, transport monitoring.
Step 5.6 -- Check cold chain compliance: FSMA compliance, HACCP integration, temperature requirements by category, sanitary transport rule, record keeping, audit readiness.
============================================================ PHASE 6: SUSTAINABILITY REPORTING
Step 6.1 -- Evaluate waste measurement: units (weight, dollars, calories), measurement points, waste per revenue, composition analysis, avoidable vs. unavoidable distinction, food waste hierarchy adherence.
Step 6.2 -- Assess environmental impact: GHG emissions from waste (CO2e), water footprint, land use impact, packaging waste, methane from landfill, carbon reduction from prevention.
Step 6.3 -- Check reporting frameworks: GHG Protocol Scope 3, CDP, GRI, UN SDG 12.3 tracking, EPA Food Recovery Hierarchy, SBTi alignment, ESG requirements.
Step 6.4 -- Evaluate targets: baseline measurement, reduction targets (%, absolute), progress tracking, trend visualization, industry benchmarking, ROI calculation.
============================================================ SELF-HEALING VALIDATION (max 2 iterations)
After producing output, validate data quality and completeness:
- Verify all output sections have substantive content (not just headers).
- Verify every finding references a specific file, code location, or data point.
- Verify recommendations are actionable and evidence-based.
- If the analysis consumed insufficient data (empty directories, missing configs), note data gaps and attempt alternative discovery methods.
IF VALIDATION FAILS:
- Identify which sections are incomplete or lack evidence
- Re-analyze the deficient areas with expanded search patterns
- Repeat up to 2 iterations
IF STILL INCOMPLETE after 2 iterations:
- Flag specific gaps in the output
- Note what data would be needed to complete the analysis
============================================================ OUTPUT
Food Waste Reduction Analysis
Project: [name] Stack: [detected technologies] Supply Chain Stages: [stages] Assessment Date: [date]
Executive Summary
| Area | Status | Key Finding |
|---|---|---|
| Shelf Life Prediction | [STRONG/ADEQUATE/WEAK] | [summary] |
| Inventory Rotation | [STRONG/ADEQUATE/WEAK] | [summary] |
| Demand Forecasting | [STRONG/ADEQUATE/WEAK] | [summary] |
| Donation Logistics | [STRONG/ADEQUATE/WEAK] | [summary] |
| Cold Chain | [STRONG/ADEQUATE/WEAK] | [summary] |
| Sustainability | [STRONG/ADEQUATE/WEAK] | [summary] |
Shelf Life Models
| Model | Type | Products | Accuracy | Dynamic | Validated |
|---|---|---|---|---|---|
| [name] | [type] | [cats] | [metric] | [yes/no] | [yes/no] |
Rotation Compliance
| Strategy | Enforced | Measured | Compliance Rate |
|---|---|---|---|
| FIFO | [yes/no] | [yes/no] | [rate] |
| FEFO | [yes/no] | [yes/no] | [rate] |
Forecast Accuracy
| Category | MAPE | Bias | Waste Impact |
|---|---|---|---|
| [category] | [%] | [over/under] | [H/M/L] |
Waste Metrics
| Metric | Current | Target | Gap |
|---|---|---|---|
| Total waste rate | [%] | [%] | [gap] |
| Donation rate | [%] | [%] | [gap] |
| Landfill diversion | [%] | [%] | [gap] |
Recommendations
Critical (waste reduction):
- [action item]
High priority (improvement):
- [action item]
Enhancement (reporting):
- [action item]
============================================================ NEXT STEPS
- "Run
/climate-risk-agricultureto assess climate impact on supply chain." - "Run
/crop-yieldto analyze upstream production optimization." - "Run
/perfto assess performance during peak season." - "Run
/security-reviewto audit supply chain data access."
============================================================ SELF-EVOLUTION TELEMETRY
After producing output, record execution metadata for the /evolve pipeline.
Check if a project memory directory exists:
- Look for the project path in
~/.claude/projects/ - If found, append to
skill-telemetry.mdin that memory directory
Entry format:
### /food-waste — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
Only log if the memory directory exists. Skip silently if not found. Keep entries concise — /evolve will parse these for skill improvement signals.
============================================================ DO NOT
- Do NOT modify any code -- this is an analysis skill, not an implementation skill.
- Do NOT include real supplier names, store locations, or proprietary data in output.
- Do NOT ignore food safety -- waste reduction must not compromise safety.
- Do NOT recommend extending shelf life beyond scientifically validated limits.
- Do NOT skip donation logistics -- recovery is second-best after prevention.
- Do NOT assume one rotation strategy fits all -- perishability varies widely.
- Do NOT overlook cold chain -- temperature abuse is a leading cause of waste.
- Do NOT conflate unavoidable waste (bones, peels) with avoidable (expired stock).