/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 dataExamples
Data Analysis Notebook
/generate Create a data analysis notebook that:
- Loads a CSV file
- Shows basic statistics
- Creates histograms and scatter plots
- Identifies outliersMachine 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 metricsAPI Integration
/generate Create a notebook that fetches weather data from an API,
parses the JSON response, and visualizes temperature trendsData Cleaning
/generate Build a data cleaning notebook that:
- Handles missing values
- Removes duplicates
- Normalizes column names
- Exports cleaned dataWhat Gets Generated
A /generate command creates:
- Title cell: Markdown header with notebook name
- Import cells: Required library imports
- Documentation cells: Markdown explaining each section
- Code cells: Working code for each step
- 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 notebookInclude Requirements
Mention specific libraries or approaches:
/generate Create a notebook using pandas and matplotlib
to analyze customer churn data with logistic regressionSpecify 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. ConclusionsMention 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 markdownAfter Generation
Once generated:
- Review the code: Check that it matches your requirements
- Run cells: Execute to verify everything works
- Customize: Modify code and text as needed
- 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 ./srcThen generate:
/generate Create a notebook that demonstrates how to use
the data processing utilities in this projectThe AI will reference patterns from your learned content.