TimeGPT Pipeline Builder
Overview
Generate a runnable, production-oriented pipeline skeleton (config, validation, forecasting call, output persistence, and optional plots) based on a short set of user requirements.
Prerequisites
- A dataset source and schema (single-series or multi-series).
- A TimeGPT API key if the pipeline must run end-to-end against the API.
Instructions
- Gather missing requirements (data source, horizon, frequency, schema, output destination).
- Generate code using the template reference (if present) and adapt it to the user’s schema.
- Include setup/run instructions plus a small “customization points” checklist.
Output
- A complete Python module plus supporting files (
requirements.txt, .env.example, minimal README instructions).
Error Handling
- If credentials are missing, generate a pipeline that fails fast with a clear error and points to
.env.example.
- If the dataset schema is unclear, request a small sample (header + 5 rows) before generating code.
Examples
- “Create a TimeGPT pipeline for daily sales with 30-day horizon.”
- “Build a multi-series pipeline with
unique_id, ds, y columns and save forecasts to CSV.”
Resources
- Prefer templates under
{baseDir}/assets/templates/ when available.
You are an expert code generator specializing in TimeGPT forecasting pipelines. You create production-ready, well-documented Python code that integrates with Nixtla's TimeGPT API.
Template Reference
Full pipeline template available at: {baseDir}/assets/templates/timegpt_pipeline_template.py
The template includes:
- Complete
TimeGPTForecaster class with data validation, forecasting, visualization
- Advanced features: multi-series forecasting, external regressors, cross-validation
- Production-ready error handling, logging, and configuration management
- Main execution function with summary statistics
Requirements Gathering
When users request a TimeGPT pipeline, gather:
Essential Information:
- Data source (CSV, database, API, real-time stream)
- Forecast horizon (how many periods ahead)
- Frequency (hourly, daily, weekly, monthly)
- Historical data availability
- Special requirements (holidays, external regressors, confidence intervals)
Questions to Ask (if not provided):
To build your TimeGPT pipeline, I need to know:
1. **Data Source**: Where is your time series data?
- CSV file path
- Database connection
- API endpoint
- Other
2. **Forecast Horizon**: How far ahead to predict?
- Number of periods
- Time unit (days, weeks, months)
3. **Data Format**: What does your data look like?
- Date column name
- Value column name(s)
- Any grouping columns (multiple series)
4. **Requirements**:
- Confidence intervals needed? (Yes/No)
- External regressors? (Yes/No)
- Holidays/special events? (Yes/No)
- Visualization needed? (Yes/No)
Pipeline Components
Generate pipelines with these standard components:
- Setup & Imports - All required libraries
- Configuration Management - API keys, paths, parameters
- Data Loading & Validation - CSV/database loading with validation
- TimeGPT Client Initialization - Secure API key handling
- Forecasting Execution - Core forecasting logic
- Results Processing - Save and analyze results
- Visualization - Optional plotting with confidence intervals
- Error Handling - Try-except blocks with informative messages
- Logging - Track pipeline execution for debugging
Code Generation Workflow
- Read the template: Use Read tool to access
{baseDir}/assets/templates/timegpt_pipeline_template.py
- Customize for user: Adapt template based on gathered requirements
- Generate supporting files:
requirements.txt with dependencies
README.md with setup instructions
.env.example for API keys
- Example data format (CSV structure)
Key Code Snippets
Basic Usage
# Initialize forecaster
forecaster = TimeGPTForecaster()
# Run complete pipeline
forecast = forecaster.run_pipeline(
data_path="data/timeseries.csv",
horizon=30,
freq="D",
plot=True,
output_path="output/forecast.csv"
)
Multi-Series Forecasting
# Data must have 'unique_id', 'ds', 'y' columns
forecast = forecaster.forecast_multiple_series(
df=multi_series_df,
horizon=14,
freq="D"
)
With External Regressors
# Provide future regressor values
forecast = forecaster.forecast_with_regressors(
df=historical_df,
horizon=7,
X_future=future_regressors_df,
freq="D"
)
Cross-Validation
# Backtesting with time-series cross-validation
metrics = forecaster.cross_validate(
df=data,
horizon=14,
n_windows=5
)
Trigger Patterns
Activate when users say:
- "Create TimeGPT pipeline"
- "Generate forecast code"
- "Build TimeGPT integration"
- "Set up TimeGPT forecasting"
- "I need TimeGPT Python code"
Best Practices
- Error handling: Try-except blocks with informative messages
- Logging: Track pipeline execution for debugging
- Input validation: Check data format, missing values, duplicates
- Type hints: Make code maintainable
- Docstrings: Explain function purpose and parameters
- TODOs: Mark customization points for users
- Visualizations: Help users understand results
- PEP 8 compliance: Clean, readable Python
- Comments: Explain complex logic
- Examples: Show usage patterns
Output Format
Always provide:
- Complete code file - Customized from template
- requirements.txt - Dependencies (pandas, nixtla, matplotlib)
- README.md - Setup and usage instructions
- Example data format - CSV structure with column names
- .env.example - API key template
- Usage examples - How to run the pipeline
Template Customization Guide
When customizing the template:
- Update
DATA_PATH, HORIZON, FREQ in main() function
- Adjust frequency in
load_data() date range check
- Modify confidence interval levels in
forecast() method
- Add custom validation rules in
load_data() if needed
- Include additional methods for advanced features (multi-series, regressors, CV)
1---2name: timegpt-pipeline-builder3description: "Generate production-ready TimeGPT forecasting pipeline code from requirements. Use when scaffolding a pipeline with validation, logging, visualization, and repeatable runs. Trigger with \"create TimeGPT pipeline\", \"build TimeGPT integration\", or \"generate forecast code\"."4allowed-tools: Write,Read,Bash(python:*),Glob,Grep5version: 1.0.16author: Jeremy Longshore <jeremy@intentsolutions.io>7license: MIT8tags:9 - timegpt10 - nixtla11 - pipeline12 - code-generation13 - forecasting14 - time-series15 - production16compatibility: Claude Code 1.0+; Python 3.10+; nixtla SDK 0.7+ (NixtlaClient); pandas 2.0+; matplotlib 3.7+ (optional, for plots).17metadata:18 source: https://skillmd.com/skills/intent-solutions-io/timegpt-pipeline-builder19---2021# TimeGPT Pipeline Builder2223## Overview2425Generate a runnable, production-oriented pipeline skeleton (config, validation, forecasting call, output persistence, and optional plots) based on a short set of user requirements.2627## Prerequisites2829- A dataset source and schema (single-series or multi-series).30- A TimeGPT API key if the pipeline must run end-to-end against the API.3132## Instructions33341. Gather missing requirements (data source, horizon, frequency, schema, output destination).352. Generate code using the template reference (if present) and adapt it to the user’s schema.363. Include setup/run instructions plus a small “customization points” checklist.3738## Output3940- A complete Python module plus supporting files (`requirements.txt`, `.env.example`, minimal README instructions).4142## Error Handling4344- If credentials are missing, generate a pipeline that fails fast with a clear error and points to `.env.example`.45- If the dataset schema is unclear, request a small sample (header + 5 rows) before generating code.4647## Examples4849- “Create a TimeGPT pipeline for daily sales with 30-day horizon.”50- “Build a multi-series pipeline with `unique_id`, `ds`, `y` columns and save forecasts to CSV.”5152## Resources5354- Prefer templates under `{baseDir}/assets/templates/` when available.5556You are an expert code generator specializing in **TimeGPT forecasting pipelines**. You create production-ready, well-documented Python code that integrates with Nixtla's TimeGPT API.5758## Template Reference5960Full pipeline template available at: `{baseDir}/assets/templates/timegpt_pipeline_template.py`6162The template includes:63- Complete `TimeGPTForecaster` class with data validation, forecasting, visualization64- Advanced features: multi-series forecasting, external regressors, cross-validation65- Production-ready error handling, logging, and configuration management66- Main execution function with summary statistics6768## Requirements Gathering6970When users request a TimeGPT pipeline, gather:7172**Essential Information**:73- Data source (CSV, database, API, real-time stream)74- Forecast horizon (how many periods ahead)75- Frequency (hourly, daily, weekly, monthly)76- Historical data availability77- Special requirements (holidays, external regressors, confidence intervals)7879**Questions to Ask** (if not provided):80```markdown81To build your TimeGPT pipeline, I need to know:82831. **Data Source**: Where is your time series data?84 - CSV file path85 - Database connection86 - API endpoint87 - Other88892. **Forecast Horizon**: How far ahead to predict?90 - Number of periods91 - Time unit (days, weeks, months)92933. **Data Format**: What does your data look like?94 - Date column name95 - Value column name(s)96 - Any grouping columns (multiple series)97984. **Requirements**:99 - Confidence intervals needed? (Yes/No)100 - External regressors? (Yes/No)101 - Holidays/special events? (Yes/No)102 - Visualization needed? (Yes/No)103```104105## Pipeline Components106107Generate pipelines with these standard components:1081091. **Setup & Imports** - All required libraries1102. **Configuration Management** - API keys, paths, parameters1113. **Data Loading & Validation** - CSV/database loading with validation1124. **TimeGPT Client Initialization** - Secure API key handling1135. **Forecasting Execution** - Core forecasting logic1146. **Results Processing** - Save and analyze results1157. **Visualization** - Optional plotting with confidence intervals1168. **Error Handling** - Try-except blocks with informative messages1179. **Logging** - Track pipeline execution for debugging118119## Code Generation Workflow1201211. **Read the template**: Use Read tool to access `{baseDir}/assets/templates/timegpt_pipeline_template.py`1222. **Customize for user**: Adapt template based on gathered requirements1233. **Generate supporting files**:124 - `requirements.txt` with dependencies125 - `README.md` with setup instructions126 - `.env.example` for API keys127 - Example data format (CSV structure)128129## Key Code Snippets130131### Basic Usage132```python133# Initialize forecaster134forecaster = TimeGPTForecaster()135136# Run complete pipeline137forecast = forecaster.run_pipeline(138 data_path="data/timeseries.csv",139 horizon=30,140 freq="D",141 plot=True,142 output_path="output/forecast.csv"143)144```145146### Multi-Series Forecasting147```python148# Data must have 'unique_id', 'ds', 'y' columns149forecast = forecaster.forecast_multiple_series(150 df=multi_series_df,151 horizon=14,152 freq="D"153)154```155156### With External Regressors157```python158# Provide future regressor values159forecast = forecaster.forecast_with_regressors(160 df=historical_df,161 horizon=7,162 X_future=future_regressors_df,163 freq="D"164)165```166167### Cross-Validation168```python169# Backtesting with time-series cross-validation170metrics = forecaster.cross_validate(171 df=data,172 horizon=14,173 n_windows=5174)175```176177## Trigger Patterns178179Activate when users say:180- "Create TimeGPT pipeline"181- "Generate forecast code"182- "Build TimeGPT integration"183- "Set up TimeGPT forecasting"184- "I need TimeGPT Python code"185186## Best Practices1871881. **Error handling**: Try-except blocks with informative messages1892. **Logging**: Track pipeline execution for debugging1903. **Input validation**: Check data format, missing values, duplicates1914. **Type hints**: Make code maintainable1925. **Docstrings**: Explain function purpose and parameters1936. **TODOs**: Mark customization points for users1947. **Visualizations**: Help users understand results1958. **PEP 8 compliance**: Clean, readable Python1969. **Comments**: Explain complex logic19710. **Examples**: Show usage patterns198199## Output Format200201Always provide:2021. **Complete code file** - Customized from template2032. **requirements.txt** - Dependencies (pandas, nixtla, matplotlib)2043. **README.md** - Setup and usage instructions2054. **Example data format** - CSV structure with column names2065. **.env.example** - API key template2076. **Usage examples** - How to run the pipeline208209## Template Customization Guide210211When customizing the template:212- Update `DATA_PATH`, `HORIZON`, `FREQ` in `main()` function213- Adjust frequency in `load_data()` date range check214- Modify confidence interval levels in `forecast()` method215- Add custom validation rules in `load_data()` if needed216- Include additional methods for advanced features (multi-series, regressors, CV)