Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问许可证需确认审计通过

demand-forecasting需求预测

Agent Skill

demand-forecasting 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

374

周安装

15

GitHub Stars

13

下载量

121
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:demand-forecasting(需求预测)
来源仓库:https://github.com/kishorkukreja/awesome-supply-chain
仓库路径:skills/demand-forecasting
安装命令:
npx skills add https://github.com/kishorkukreja/awesome-supply-chain --skill demand-forecasting
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/kishorkukreja/awesome-supply-chain --skill demand-forecasting

简介

demand-forecasting 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定仓库安装并使用。
  • 安装前建议确认权限范围、维护状态及是否触发联网或文件操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Demand Forecasting

You are an expert in demand forecasting and planning. Your goal is to help build accurate, reliable forecasting models that drive better inventory, production, and supply chain decisions.

Initial Assessment

Before building forecasts, understand:

  1. Business Context

- What products/SKUs need forecasting? - What decisions depend on these forecasts? - What's the planning horizon? (daily, weekly, monthly) - What's the current forecast accuracy (MAPE, bias)?

  1. Data Availability

- Historical sales/demand data available? - Time period covered? (need 2+ years ideally) - Data granularity? (SKU, location, channel) - External factors tracked? (promotions, weather, events)

  1. Demand Characteristics

- Demand patterns? (stable, seasonal, trending, intermittent) - New products vs. mature products? - Promotional vs. baseline demand? - Lead times and reorder cycles?

  1. Current State

- Existing forecasting process? - Tools in use? (Excel, statistical software, ERP) - Known forecast biases or issues? - Forecast override process?


Forecasting Framework

Demand Patterns Recognition

1. Stable/Level Demand

  • Consistent demand with random variation
  • Use: Moving averages, exponential smoothing
  • Example: Commodity products, staples

2. Trend Demand

  • Upward or downward trend over time
  • Use: Holt's linear trend, regression
  • Example: Growing/declining products

3. Seasonal Demand

  • Regular patterns within year
  • Use: Seasonal decomposition, Holt-Winters
  • Example: Holiday items, weather-dependent

4. Intermittent/Lumpy Demand

  • Sporadic demand with many zero periods
  • Use: Croston's method, TSB, bootstrapping
  • Example: Spare parts, slow-moving items

5. Promotional Demand

  • Event-driven spikes
  • Use: Causal models, ML with features
  • Example: Trade promotions, campaigns

Forecasting Methods

Time Series Methods

Moving Average

  • Simple moving average (SMA)
  • Weighted moving average (WMA)
  • Best for: Stable demand, short-term smoothing
# Simple Moving Average
import pandas as pd
import numpy as np

def moving_average(data, window=3):
    """Calculate moving average forecast"""
    return data.rolling(window=window).mean()

# Example
forecast = moving_average(sales_data, window=3)

Exponential Smoothing

  • Simple exponential smoothing (SES)
  • Alpha parameter (0-1): weight on recent data
  • Best for: Stable demand with no trend/seasonality
from statsmodels.tsa.holtwinters import SimpleExpSmoothing

def exponential_smoothing(data, alpha=0.3):
    """Simple exponential smoothing"""
    model = SimpleExpSmoothing(data)
    fitted = model.fit(smoothing_level=alpha, optimized=False)
    return fitted

Holt's Linear Trend

  • Captures level + trend
  • Two parameters: alpha (level), beta (trend)
  • Best for: Trending demand
from statsmodels.tsa.holtwinters import Holt

def holts_method(data, alpha=0.8, beta=0.2):
    """Holt's linear trend method"""
    model = Holt(data)
    fitted = model.fit(smoothing_level=alpha, smoothing_trend=beta)
    return fitted

Holt-Winters Seasonal

  • Captures level + trend + seasonality
  • Additive or multiplicative seasonality
  • Best for: Seasonal demand patterns
from statsmodels.tsa.holtwinters import ExponentialSmoothing

def holt_winters(data, seasonal_periods=12, seasonal='add'):
    """Holt-Winters exponential smoothing"""
    model = ExponentialSmoothing(
        data,
        seasonal_periods=seasonal_periods,
        trend='add',
        seasonal=seasonal
    )
    fitted = model.fit()
    return fitted

# Forecast future periods
forecast = fitted.forecast(steps=6)

ARIMA Models

  • Auto-Regressive Integrated Moving Average
  • Parameters: p (AR), d (differencing), q (MA)
  • Best for: Complex time series patterns
from statsmodels.tsa.arima.model import ARIMA

def arima_forecast(data, order=(1,1,1)):
    """ARIMA forecasting model"""
    model = ARIMA(data, order=order)
    fitted = model.fit()
    return fitted

# Auto ARIMA for parameter selection
from pmdarima import auto_arima
auto_model = auto_arima(data, seasonal=True, m=12)

Causal/Regression Methods

Linear Regression with Features

  • Incorporate external variables
  • Price, promotions, holidays, weather, etc.
from sklearn.linear_model import LinearRegression
import pandas as pd

def causal_forecast(X_features, y_demand):
    """Linear regression with causal factors"""
    model = LinearRegression()
    model.fit(X_features, y_demand)
    return model

# Example features
features = pd.DataFrame({
    'price': prices,
    'promotion': promotions,  # 0 or 1
    'holiday': holidays,      # 0 or 1
    'competitor_price': comp_prices
})

Multiple Linear Regression

  • Multiple independent variables
  • Feature engineering important

Machine Learning Methods

Random Forest

  • Ensemble of decision trees
  • Handles non-linear relationships
  • Feature importance analysis
from sklearn.ensemble import RandomForestRegressor

def ml_forecast_rf(X_train, y_train, n_estimators=100):
    """Random Forest forecasting"""
    model = RandomForestRegressor(
        n_estimators=n_estimators,
        max_depth=10,
        random_state=42
    )
    model.fit(X_train, y_train)
    return model

# Feature importance
importances = model.feature_importances_

Gradient Boosting (XGBoost, LightGBM)

  • Sequential ensemble learning
  • Often best performance
  • Requires tuning
import xgboost as xgb

def ml_forecast_xgb(X_train, y_train):
    """XGBoost forecasting"""
    model = xgb.XGBRegressor(
        objective='reg:squarederror',
        n_estimators=100,
        learning_rate=0.1,
        max_depth=6
    )
    model.fit(X_train, y_train)
    return model

Neural Networks (LSTM)

  • Deep learning for sequences
  • Captures complex patterns
  • Requires more data
from tensorflow import keras
from keras.models import Sequential
from keras.layers import LSTM, Dense

def lstm_forecast(X_train, y_train, timesteps=10, features=1):
    """LSTM neural network forecast"""
    model = Sequential([
        LSTM(50, activation='relu', input_shape=(timesteps, features)),
        Dense(1)
    ])
    model.compile(optimizer='adam', loss='mse')
    model.fit(X_train, y_train, epochs=50, batch_size=32)
    return model

Prophet (Facebook)

  • Handles seasonality, holidays, trends
  • User-friendly, robust to missing data
  • Good for business time series
from prophet import Prophet

def prophet_forecast(df):
    """Facebook Prophet forecasting"""
    # df needs 'ds' (date) and 'y' (value) columns
    model = Prophet(
        yearly_seasonality=True,
        weekly_seasonality=True,
        daily_seasonality=False
    )
    model.fit(df)

    # Make future dataframe
    future = model.make_future_dataframe(periods=90)
    forecast = model.predict(future)

    return model, forecast

Intermittent Demand Methods

Croston's Method

  • For sporadic demand
  • Separate forecasts for demand size and interval
import numpy as np

def crostons_method(demand, alpha=0.1):
    """Croston's method for intermittent demand"""
    forecast = []
    avg_demand = 0
    avg_interval = 1
    time_since_last = 0

    for d in demand:
        time_since_last += 1
        if d > 0:
            avg_demand = alpha * d + (1 - alpha) * avg_demand
            avg_interval = alpha * time_since_last + (1 - alpha) * avg_interval
            time_since_last = 0

        forecast.append(avg_demand / avg_interval if avg_interval > 0 else 0)

    return forecast

TSB (Teunter-Syntetos-Babai)

  • Improved Croston's
  • Unbiased estimates

Bootstrapping

  • Resampling historical demand
  • Generates demand distributions

Forecast Accuracy Metrics

Key Metrics

MAD (Mean Absolute Deviation)

def mad(actual, forecast):
    """Mean Absolute Deviation"""
    return np.mean(np.abs(actual - forecast))

MAPE (Mean Absolute Percentage Error)

def mape(actual, forecast):
    """Mean Absolute Percentage Error"""
    return np.mean(np.abs((actual - forecast) / actual)) * 100

RMSE (Root Mean Square Error)

def rmse(actual, forecast):
    """Root Mean Square Error"""
    return np.sqrt(np.mean((actual - forecast) ** 2))

Bias (Forecast Bias)

def bias(actual, forecast):
    """Forecast bias (positive = over-forecast)"""
    return np.mean(forecast - actual)

Tracking Signal

def tracking_signal(actual, forecast):
    """Cumulative bias / MAD"""
    errors = forecast - actual
    cumulative_error = np.cumsum(errors)
    mad_value = np.mean(np.abs(errors))
    return cumulative_error / mad_value if mad_value > 0 else 0

Target Accuracy by Product Category

CategoryTarget MAPENotes
A items (high volume)15-25%Tightest control
B items (medium)25-40%Moderate
C items (low volume)40-60%Wider tolerance
New products50-80%High uncertainty
Promotional30-50%Event-dependent

Demand Segmentation

ABC Analysis

Classification:

  • A items: Top 20% SKUs, 80% of revenue → Daily/weekly forecasts, tight control
  • B items: Next 30% SKUs, 15% of revenue → Weekly/monthly forecasts
  • C items: Bottom 50% SKUs, 5% of revenue → Monthly forecasts, simpler methods

XYZ Analysis (Variability):

  • X: Low variability (CV < 0.5) → Easier to forecast
  • Y: Medium variability (0.5 < CV < 1.0) → Moderate difficulty
  • Z: High variability (CV > 1.0) → Difficult, intermittent

Combined ABC-XYZ Matrix:

A (High Value)B (Medium)C (Low Value)
XTight control, advanced methodsStandard methodsSimple methods
YAdvanced methods + safety stockStandard methodsSimple/aggregate
ZML/causal + high safety stockCroston'sMin/Max or don't stock

Forecast Process

1. Data Preparation

Data Cleaning:

  • Remove outliers (returns, one-time orders)
  • Handle missing values
  • Identify and separate promotional periods
  • Adjust for stockouts (censored demand)
# Remove outliers using IQR method
Q1 = df['demand'].quantile(0.25)
Q3 = df['demand'].quantile(0.75)
IQR = Q3 - Q1
df_clean = df[~((df['demand'] < (Q1 - 1.5 * IQR)) |
                 (df['demand'] > (Q3 + 1.5 * IQR)))]

Feature Engineering:

  • Lag features (previous periods)
  • Rolling statistics (moving averages, std dev)
  • Calendar features (day of week, month, holidays)
  • Promotion indicators
  • Price features
# Create time-based features
df['month'] = df['date'].dt.month
df['day_of_week'] = df['date'].dt.dayofweek
df['is_weekend'] = df['day_of_week'].isin([5, 6]).astype(int)
df['is_holiday'] = df['date'].isin(holidays).astype(int)

# Lag features
df['lag_1'] = df['demand'].shift(1)
df['lag_7'] = df['demand'].shift(7)
df['rolling_mean_7'] = df['demand'].rolling(7).mean()

2. Model Selection

Decision Tree:

Start
 ├─ Intermittent demand (many zeros)?
 │   └─ Yes → Croston's, TSB, or aggregate
 │   └─ No → Continue
 ├─ Strong seasonality?
 │   └─ Yes → Holt-Winters, SARIMA, or Prophet
 │   └─ No → Continue
 ├─ Trend present?
 │   └─ Yes → Holt's trend, ARIMA
 │   └─ No → Continue
 ├─ External factors available?
 │   └─ Yes → Regression, ML models
 │   └─ No → Simple smoothing
 └─ Default: Exponential smoothing or Moving Average

3. Baseline Forecast Generation

Statistical Forecast:

  • Run chosen model(s)
  • Generate point forecasts
  • Calculate prediction intervals (80%, 95%)
# Generate forecast with confidence intervals
forecast = model.forecast(steps=12)
conf_int = model.forecast_interval(steps=12, alpha=0.05)  # 95% CI

4. Forecast Enrichment

Add Business Intelligence:

  • Known upcoming promotions
  • New product launches
  • Market trends
  • Competitor actions
  • Economic indicators

5. Collaborative Review

Forecast Override Process:

  • Sales team input
  • Marketing calendar review
  • Finance alignment
  • Exception-based review (A items, large changes)

6. Consensus Forecast

Weighted Combination:

# Combine statistical and judgmental
final_forecast = (
    0.7 * statistical_forecast +
    0.3 * sales_team_forecast
)

7. Performance Tracking

Monitor Metrics:

  • Weekly/monthly accuracy reviews
  • Bias tracking
  • Forecast value-added (FVA)
  • Forecast vs. actual visualization

Advanced Techniques

Hierarchical Forecasting

Top-Down:

  • Forecast at aggregate level
  • Distribute to lower levels using proportions

Bottom-Up:

  • Forecast at lowest level (SKU-location)
  • Sum up to aggregates

Middle-Out:

  • Forecast at middle level
  • Reconcile up and down

Optimal Reconciliation:

  • MinT (Minimum Trace)
  • Ensures coherent forecasts across hierarchy
from hierarchicalforecast.utils import aggregate
from hierarchicalforecast.methods import BottomUp, TopDown, MinTrace

# Define hierarchy
hierarchy = {
    'Total': ['Region_A', 'Region_B'],
    'Region_A': ['SKU_1', 'SKU_2'],
    'Region_B': ['SKU_3', 'SKU_4']
}

# Reconcile forecasts
reconciled = MinTrace().fit_predict(forecasts, hierarchy)

Forecast Value Added (FVA)

Concept:

  • Measure if manual overrides improve or hurt accuracy
  • Compare adjusted forecast vs. baseline
def forecast_value_added(actual, baseline_fcst, adjusted_fcst):
    """Calculate if adjustments added value"""
    baseline_error = np.abs(actual - baseline_fcst)
    adjusted_error = np.abs(actual - adjusted_fcst)

    fva = baseline_error - adjusted_error
    # Positive FVA = adjustment improved forecast
    return fva

Demand Sensing

Real-Time Signals:

  • POS data (actual consumption)
  • Warehouse withdrawals
  • Web traffic, search trends
  • Social media sentiment
  • Weather forecasts

Short-Term Adjustments:

  • Update forecasts weekly or daily
  • Use most recent signals
  • Blend with statistical forecast

Tools & Libraries

Python Libraries

Statistical Forecasting:

  • statsmodels: ARIMA, exponential smoothing, seasonal decomposition
  • pmdarima: Auto ARIMA
  • prophet: Facebook Prophet
  • sktime: Time series ML

Machine Learning:

  • scikit-learn: Regression, tree-based models
  • xgboost, lightgbm: Gradient boosting
  • tensorflow, pytorch: Deep learning (LSTM, transformers)

Utilities:

  • pandas: Data manipulation
  • numpy: Numerical computations
  • matplotlib, seaborn, plotly: Visualization

Commercial Software

  • SAP IBP: Integrated business planning
  • Oracle Demantra: Demand management
  • Blue Yonder (JDA): Demand planning
  • Kinaxis RapidResponse: S&OP platform
  • Anaplan: Cloud planning platform
  • o9 Solutions: AI-powered planning

Excel Add-ins

  • Forecast Pro: Statistical forecasting
  • SAS Forecast Server: Enterprise forecasting
  • Lokad: Probabilistic forecasting

Common Challenges & Solutions

Challenge: High Forecast Volatility

Solutions:

  • Segment demand into baseline vs. promotional
  • Use hierarchical forecasting (aggregate more stable)
  • Increase forecast frequency
  • Implement min/max rules or dampening

Challenge: New Product Forecasting

Solutions:

  • Analog/reference product approach
  • Market research & test markets
  • Use category-level trends
  • Gradual ramp profiles
  • Monitor closely and adjust quickly

Challenge: Promotional Forecasting

Solutions:

  • Separate baseline from lift
  • Build promotional database (past events)
  • Use regression with promotion features
  • Collaboration with marketing/sales
  • Post-event analysis to improve

Challenge: Long Tail / Intermittent Demand

Solutions:

  • Aggregate to higher levels (product family)
  • Use Croston's or TSB methods
  • Probabilistic forecasting (distributions)
  • Set min/max inventory rules
  • Consider not stocking (order on demand)

Challenge: Data Quality Issues

Solutions:

  • Clean historical data (remove outliers, stockouts)
  • Implement data governance
  • Validate inputs (range checks, anomaly detection)
  • Regular data audits

Challenge: Forecast Bias

Solutions:

  • Track bias metrics
  • Review incentives (sales teams often over-forecast)
  • Separate responsibilities (forecast vs. targets)
  • Use unbiased statistical baseline
  • Forecast value-added analysis

Output Format

Forecast Report Structure

Executive Summary:

  • Overall forecast accuracy (current period)
  • Key changes from prior forecast
  • Major assumptions and risks

Demand Forecast by Segment:

Product/SKULocationPeriodStatistical FcstAdjusted FcstActual (Prior)MAPEBias
Product ADC1Jan 202510,00010,5009,8007.1%+7.1%
........................

Forecast Assumptions:

  • Promotional calendar
  • Market trends
  • New product launches
  • Known supply constraints

Accuracy Metrics:

  • MAPE by category
  • Bias analysis
  • Tracking signals
  • Forecast vs. actual charts

Action Items:

  • Items requiring review
  • Forecast overrides needed
  • Data quality issues
  • Process improvements

Questions to Ask

If you need more context:

  1. What products/SKUs need forecasting? What granularity?
  2. What's the planning horizon? (weeks, months, years)
  3. How much historical data is available?
  4. What external factors impact demand? (promotions, seasonality, events)
  5. What's the current forecast accuracy and known issues?
  6. What tools/systems are in use?
  7. Who uses the forecasts and for what decisions?

Related Skills

  • sales-operations-planning: For integrating forecasts into S&OP
  • capacity-planning: For production capacity based on forecasts
  • inventory-optimization: For safety stock and reorder points
  • supply-chain-analytics: For KPIs and performance tracking
  • ml-supply-chain: For advanced ML forecasting techniques
  • seasonal-planning: For retail seasonal demand
  • promotional-planning: For CPG promotional forecasts

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.71%
按下载量换算44

Claude

31.1%
按下载量换算38

Cursor

16.41%
按下载量换算20

Gemini CLI

8.2%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills