time-series
Skill0 starsChanged 38 days agoMITView on GitHub
Decomposes and forecasts time-indexed data with STL, ARIMA/SARIMA, and Prophet, validated by time-ordered backtests against a seasonal-naive baseline. Use when someone asks "forecast next quarter's demand", "is this series seasonal", "why is my ARIMA forecast flat", "how do I backtest a forecast", or has any metric indexed by time that needs prediction or decomposition. Do NOT use for explaining what a trend means for strategy - use trend-analysis instead; for estimating the causal impact of an intervention on a series use causal-inference; for translating a forecast into an ARR or MRR plan use revenue-modeling.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- drarunmitra/research-skillstheir own version, first seen Nov 8, 2026
- Abdox-menara/guard-skillstheir own version, first seen Aug 24, 2026
- ffsshhttiikk/opencode-agents-skillstheir own version, first seen Feb 28, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- drarunmitra/research-skills★ 4same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- Abdox-menara/guard-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- clickhouse-analyticsSkill
- data-qualitySkill
- kafka-pipelinesSkill
- ml-feature-engineeringSkill
- mongodb-expertSkill
- spark-jobsSkill
- sql-query-optimizerSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Read the components: if the seasonal panel's amplitude dwarfs the residual panel, seasonality is real.
- Distinctive: line 36
Test stationarity with ADF:
- Distinctive: line 103
Always show the confidence interval, and say plainly that uncertainty grows with horizon.
- Distinctive: line 115
Do not validate with a random train/test split.
- Distinctive: line 116
Do not ship any model that has not been compared against seasonal-naive on the same folds.
- Distinctive: line 117
Do not model through a known level shift (launch, pricing change) as if it were trend.
- Distinctive: line 118
Do not quote 1-step-ahead error for a 6-step-ahead decision.
- Distinctive: line 119
Do not over-difference; d + D above 2 is almost always a specification error, not a cure.
- Distinctive: line 120
Do not extrapolate confidently past ~20% of the history length without flagging it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Time Series Analysis
Time series work fails in two characteristic ways: validating on a random split (which leaks the future into training and produces accuracy numbers that evaporate in production), and shipping a model that never had to beat the dumbest possible baseline. The discipline below exists to prevent both - every forecast is backtested in time order and compared against seasonal-naive before anyone sees it.
Operating procedure
Order matters: exploration decides the seasonal period, the period decides the decomposition and model structure, and validation only means something after the model choices are frozen.
Step 1: gather inputs
- The series itself, its frequency, and its business meaning. Reindex to a regular frequency before anything else (
series.asfreq("D")); missing timestamps must become explicit NaNs, then be imputed or modeled, never silently skipped. - The forecast horizon and what decision it feeds. A 12-month forecast from 18 months of history is a guess - say so. Rules of thumb: require at least 2 full seasonal cycles of history (prefer 3+) before fitting a seasonal model, and keep the horizon under roughly 20% of history length or widen the caveats.
- Known interventions: launches, price changes, outages. Mark them; a level shift modeled as trend poisons everything downstream. If the question is "what did the intervention cause", stop and use causal-inference.
- The seasonal period, from the data's rhythm: 7 for daily data with weekly cycles, 12 for monthly, 52 for weekly, 24 for hourly-with-daily-cycle. Label a guessed period as a guess and verify it in Step 2.
Step 2: explore before modeling
- Plot the raw series. Look for trend, seasonality, level shifts, outliers, and variance that grows with level (a candidate for a log transform).
- Decompose:
from statsmodels.tsa.seasonal import STL
result = STL(series, period=12).fit()
result.plot()Read the components: if the seasonal panel's amplitude dwarfs the residual panel, seasonality is real; if the residual still shows structure, the period is wrong or a second cycle exists.
- Test stationarity with ADF:
from statsmodels.tsa.stattools import adfuller
stat, pvalue, *_ = adfuller(series.dropna())p < 0.05 rejects the unit root - treat the series as stationary. Otherwise difference.
Step 3: make the series stationary (for ARIMA)
Difference once for trend, seasonally difference for seasonality:
diff = series.diff().dropna()
seasonal_diff = series.diff(12).dropna()Almost never difference more than twice total (d + D ≤ 2); over-differencing injects noise and shows up as a strongly negative lag-1 ACF. Read ACF/PACF on the differenced series to choose orders: PACF cutting off after lag p suggests AR(p); ACF cutting off after lag q suggests MA(q).
Step 4: fit candidate models
SARIMA:
from statsmodels.tsa.statespace.sarimax import SARIMAX
model = SARIMAX(series, order=(1, 1, 1), seasonal_order=(1, 1, 1, 12))
fit = model.fit(disp=False)
forecast = fit.get_forecast(steps=12)
ci = forecast.conf_int()pmdarima.auto_arima can search orders by AIC, but treat its winner as a candidate, not an answer - verify residuals (Step 6) before trusting it.
Prophet, for business series with strong multiple seasonality and holiday effects:
from prophet import Prophet
m = Prophet(yearly_seasonality=True, weekly_seasonality=True)
m.add_country_holidays(country_name="US")
m.fit(df) # columns: ds, y
fc = m.predict(m.make_future_dataframe(periods=90))Apply a log transform first when seasonal amplitude scales with the level (multiplicative seasonality), for either model family.
Step 5: validate in time order - never a random split
Backtest with rolling or expanding windows that respect time:
from sklearn.model_selection import TimeSeriesSplit
tscv = TimeSeriesSplit(n_splits=5)Report MAPE, MAE, and RMSE on held-out future windows only - in-sample fit is not evidence. Always fit the seasonal-naive baseline (predict the value from one season ago) through the same backtest. The acceptance threshold: the model's error must beat seasonal-naive (MASE < 1, or lower MAPE on the same folds). A sophisticated model that loses to naive ships the naive.
Step 6: diagnose residuals
Residuals from a correct model are white noise:
- Ljung-Box test: p > 0.05 means no remaining autocorrelation. p below that means structure is left - revisit orders or the seasonal period.
- Residual ACF plot: no bars beyond the significance band.
- Residual histogram roughly normal if the prediction intervals will be quoted; heavy tails mean the intervals are too narrow and should be widened or bootstrapped.
Step 7: present with honest uncertainty
Always show the confidence interval, and say plainly that uncertainty grows with horizon. Report the backtest error at the actual decision horizon (the 6-month-ahead MAPE for a 6-month decision), not the flattering 1-step-ahead number.
Worked artifact: model-choice decision
Monthly revenue, 36 points, clear December spike, variance growing with level. Decision trail: period = 12 (monthly with annual cycle, 3 full cycles available - enough). Log transform (multiplicative seasonality). ADF on log series p = 0.41 → difference; on differenced series p = 0.01 → proceed with d = 1, D = 1. ACF/PACF suggest (1,1,1)(0,1,1,12). Backtest on 5 expanding folds at horizon 6: SARIMA MAPE 7.2% vs seasonal-naive 11.8% - model earns its keep, ship with intervals from the log-scale fit back-transformed.
Deliverable
Produce a forecast package containing: the decomposition plot with a one-line reading, the stationarity and transform decisions with test p-values, the chosen model and orders with the rejected candidates named, backtest error (MAPE/MAE/RMSE) at the decision horizon side-by-side with seasonal-naive, residual diagnostics (Ljung-Box p-value, residual ACF), and the forecast with confidence intervals.
Do NOT
- Do not validate with a random train/test split; shuffling leaks the future and the reported accuracy is fiction.
- Do not ship any model that has not been compared against seasonal-naive on the same folds.
- Do not model through a known level shift (launch, pricing change) as if it were trend; segment the series or add the intervention as a regressor.
- Do not quote 1-step-ahead error for a 6-step-ahead decision.
- Do not over-difference; d + D above 2 is almost always a specification error, not a cure.
- Do not extrapolate confidently past ~20% of the history length without flagging it.
Quality bar
Ship only when: the seasonal period is verified by decomposition, not assumed; all accuracy numbers come from time-ordered held-out windows at the decision horizon; the model beats seasonal-naive; Ljung-Box shows no residual autocorrelation; intervals accompany every point forecast; and every data gap, transform, and intervention is documented.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

