ai-ml-timeseries
Time series forecasting — LightGBM, Transformers, temporal validation, feature engineering, and production deployment. Use when building TS models.
What this skill does
# Time Series Forecasting — Modern Patterns & Production Best Practices
**Modern Best Practices (January 2026)**:
- Treat **time** as a first-class axis: temporal splits, rolling backtests, and point-in-time correctness.
- Default to **strong baselines** (naive/seasonal naive) before complex models.
- Prevent leakage: feature windows and aggregations must use only information available at prediction time.
- Evaluate by **horizon** and **segment**; a single aggregate metric hides failures.
- Prefer **probabilistic** forecasts when decisions are risk-sensitive (quantiles/intervals); evaluate calibration (coverage) and use pinball/CRPS.
- For many related series, consider **global + hierarchical** approaches (shared models + reconciliation); validate across levels and key segments.
- Treat **time zones/DST** as first-class; validate timestamp alignment before feature generation.
- Define retraining cadence and degraded modes (fallback model, last-known-good forecast).
This skill provides **operational, copy-paste-ready workflows** for forecasting with recent advances: TS-specific EDA, temporal validation, lag/rolling features, model selection, multi-step forecasting, backtesting, generative AI (Chronos, TimesFM), and production deployment with drift monitoring.
It focuses on **hands-on forecasting execution**, not theory.
---
## When to Use This Skill
Claude should invoke this skill when the user asks for **hands-on time series forecasting**, e.g.:
- "Build a time series model for X."
- "Create lag features / rolling windows."
- "Help design a forecasting backtest."
- "Pick the right forecasting model for my data."
- "Fix leakage in forecasting."
- "Evaluate multi-horizon forecasts."
- "Use LLMs or generative models for TS."
- "Set up monitoring for a forecast system."
- "Implement LightGBM for time series."
- "Use transformer models (TimesFM, Chronos) for forecasting."
- "Apply temporal classification/survival modelling for event prediction."
If the user is asking about **general ML modelling, deployment, or infrastructure**, prefer:
- [ai-ml-data-science](../ai-ml-data-science/SKILL.md) - General data science workflows, EDA, feature engineering, evaluation
- [ai-mlops](../ai-mlops/SKILL.md) - Model deployment, monitoring, drift detection, retraining automation
If the user is asking about **LLM/RAG/search**, prefer:
- [ai-llm](../ai-llm/SKILL.md) - LLM fine-tuning, prompting, evaluation
- [ai-rag](../ai-rag/SKILL.md) - RAG pipeline design and optimization
---
## Quick Reference
| Task | Tool/Framework | Command | When to Use |
|------|----------------|---------|-------------|
| TS EDA & Decomposition | Pandas, statsmodels | `seasonal_decompose()`, `df.plot()` | Identifying trend, seasonality, outliers |
| Lag/Rolling Features | Pandas, NumPy | `df.shift()`, `df.rolling()` | Creating temporal features for ML models |
| Model Training (Tree-based) | LightGBM, XGBoost | `lgb.train()`, `xgb.train()` | Tabular TS with seasonality, covariates |
| Deep Learning (Sequence models) | Transformers, RNNs | `model.forecast()` | Long-term dependencies, complex patterns |
| Event forecasting | Binary/time-to-event models | Temporal labeling + rolling validation | Sparse events and alerts |
| Backtesting | Custom rolling windows | `for window in windows: train(), test()` | Temporal validation without leakage |
| Metrics Evaluation | scikit-learn, custom | `mean_absolute_error()`, MAPE, MASE | Multi-horizon forecast accuracy |
| Production Deployment | MLflow, Airflow | Scheduled pipelines | Automated retraining, drift monitoring |
---
## Decision Tree: Choosing Time Series Approach
```text
User needs time series forecasting for: [Data Type]
├─ Strong Seasonality?
│ ├─ Simple patterns? → LightGBM with seasonal features
│ ├─ Complex patterns? → LightGBM + Prophet comparison
│ └─ Multiple seasonalities? → Prophet or TBATS
│
├─ Long-term Dependencies (>50 steps)?
│ ├─ Transformers (TimesFM, Chronos) → Best for complex patterns
│ └─ RNNs/LSTMs → Good for sequential dependencies
│
├─ Event Forecasting (binary outcomes)?
│ └─ Temporal classification / survival modelling → validate with time-based splits
│
├─ Intermittent/Sparse Data (many zeros)?
│ ├─ Croston/SBA → Classical intermittent methods
│ └─ LightGBM with zero-inflation features → Modern approach
│
├─ Multiple Covariates?
│ ├─ LightGBM → Best with many features
│ └─ TFT/DeepAR → If deep learning needed
│
└─ Explainability Required (healthcare, finance)?
├─ LightGBM → SHAP values, feature importance
└─ Linear models → Most interpretable
```
---
## Core Concepts (Vendor-Agnostic)
- **Time axis**: splits, features, and labels must respect time ordering and availability.
- **Non-stationarity**: seasonality, trend, and regime shifts are normal; monitor and retrain intentionally.
- **Evaluation**: rolling/expanding backtests; report horizon-wise and segment-wise performance.
- **Operationalization**: define retraining cadence, fallback models, and data freshness contracts.
- **Data governance**: treat time series as potentially sensitive; enforce access control, retention, and PII scrubbing in logs.
## Implementation Practices (Tooling Examples)
- Build features with explicit time windows; store cutoff timestamps with each training run.
- Backtest with a standardized harness (rolling/expanding windows, horizon-wise metrics).
- Log production forecasts with metadata (model version, horizon, data cut) to enable debugging.
- Implement fallbacks (baseline model, last-known-good, “insufficient data” handling) for outages and anomalies.
## Do / Avoid
**Do**
- Do start with naive/seasonal naive baselines and compare against learned models (Forecasting: Principles and Practice: https://otexts.com/fpp3/).
- Do backtest with rolling windows and preserve point-in-time correctness.
- Do monitor for data pipeline changes (missing timestamps, level shifts, calendar changes).
- Do align metrics/loss to the decision: asymmetric costs, service levels, and probabilistic targets (quantiles/intervals) when needed.
**Avoid**
- Avoid random splits for forecasting problems.
- Avoid features that use future information (future aggregates, leakage via target encoding).
- Avoid optimizing only aggregate metrics; always inspect horizon-wise errors and worst segments.
- Avoid MAPE when the target can be 0 or near-0; prefer MASE/WAPE/sMAPE and horizon-wise reporting.
## Navigation: Core Patterns
### Time Series EDA & Data Preparation
- **[TS EDA Best Practices](references/ts-eda-best-practices.md)**
- Frequency detection, missing timestamps, decomposition
- Outlier detection, level shifts, seasonality analysis
- Granularity selection and stability checks
### Feature Engineering
- **[Lag & Rolling Patterns](references/lag-rolling-patterns.md)**
- Lag features (lag_1, lag_7, lag_28 for daily data)
- Rolling windows (mean, std, min, max, EWM)
- Avoiding leakage, seasonal lags, datetime features
### Model Selection
- **[Model Selection Guide](references/model-selection-guide.md)**
- Decision rules: Strong seasonality → LightGBM, Long-term → Transformers
- Benchmark comparison: LightGBM vs Prophet vs Transformers vs RNNs
- Explainability considerations for mission-critical domains
- **[LightGBM TS Patterns](references/lightgbm-ts-patterns.md)** *(feature-based forecasting best practices)*
- Why LightGBM excels: performance + efficiency + explainability
- Feature engineering for tree-based models
- Hyperparameter tuning for time series
### Forecasting Strategies
- **[Multi-Step Forecasting Patterns](references/multistep-forecasting-patterns.md)**
- Direct strategy (separate models per horizon)
- Recursive strategy (feed predictions back)
- Seq2Seq strategy (Transformers, RNNs for long horizons)
- **[Intermittent Demand Patterns](references/intermittent-demand-patterns.mRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.