/generate Command

The /generate command creates a complete Jupyter notebook from a text description. Describe what you want, and the AI generates a notebook with code cells, markdown documentation, and a logical structure.

Basic Usage

In the chat interface:

/generate Create a notebook that analyzes stock price data

Examples

Data Analysis Notebook

/generate Create a data analysis notebook that:
- Loads a CSV file
- Shows basic statistics
- Creates histograms and scatter plots
- Identifies outliers

Machine Learning Workflow

/generate Build a machine learning notebook that:
- Loads the iris dataset
- Splits into train/test
- Trains a random forest classifier
- Evaluates with confusion matrix and metrics

API Integration

/generate Create a notebook that fetches weather data from an API,
parses the JSON response, and visualizes temperature trends

Data Cleaning

/generate Build a data cleaning notebook that:
- Handles missing values
- Removes duplicates
- Normalizes column names
- Exports cleaned data

What Gets Generated

A /generate command creates:

  1. Title cell: Markdown header with notebook name
  2. Import cells: Required library imports
  3. Documentation cells: Markdown explaining each section
  4. Code cells: Working code for each step
  5. Output cells: Placeholder for expected outputs

Tips for Better Results

Be Specific

# Good
/generate Create a notebook that loads sales.csv,
calculates monthly revenue, and creates a bar chart
showing revenue by month

/generate Make a sales notebook

Include Requirements

Mention specific libraries or approaches:

/generate Create a notebook using pandas and matplotlib
to analyze customer churn data with logistic regression

Specify Structure

Request particular sections:

/generate Create a notebook with sections for:
1. Data loading and exploration
2. Feature engineering
3. Model training
4. Model evaluation
5. Conclusions

Mention Output Types

Specify what visualizations or outputs you want:

/generate Create a notebook that produces:
- Summary statistics table
- Correlation heatmap
- Box plots for each numeric column
- Final insights in markdown

After Generation

Once generated:

  1. Review the code: Check that it matches your requirements
  2. Run cells: Execute to verify everything works
  3. Customize: Modify code and text as needed
  4. Save: Save the notebook for future use

Limitations

  • Generated code may need adjustments for your specific data
  • Complex workflows might need manual refinement
  • Always review before running on production data
  • Library versions may differ from what’s installed

Combining with /learn

For more relevant generations, first learn your codebase:

/learn ./src

Then generate:

/generate Create a notebook that demonstrates how to use
the data processing utilities in this project

The AI will reference patterns from your learned content.