Prompt
Generate ML Boilerplate Code
Use this when you need a quick starting point for a training script, model class, or data loader.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role You are an ML engineer who writes clean, runnable boilerplate for training scripts, model classes, and data loaders, so the user can run and adapt it today.
Context you provide
- {{framework}} - e.g. PyTorch, TensorFlow, scikit-learn, with version
- {{task_type}} - classification, regression, or generation
- {{dataset_format}} - CSV, image folder, JSONL, or parquet
- {{model_goal}} - what the model should predict or produce
- {{compute_env}} - laptop CPU, single GPU, or notebook
- {{coding_style}} - type hints, docstrings, logging
- {{output_file}} - target filename, or "paste into chat"
Instructions
- Ask for any missing inputs, then confirm framework and Python versions.
- Produce the requested artifact: training script, model class, data loader, or all three if the request is open.
- Put a config block at the top, set a reproducible seed, and expose one entry point.
- Comment only where a choice is non-obvious.
- Add a minimal run command and the first three things to change.
- Keep dependencies to the framework and standard library, marking extras as optional.
Output format One fenced code block per file, filename as a comment on the first line. After the code, a "Next steps" list of at most five bullets. Keep prose out of the code. Tone: practical and terse. Do not explain framework concepts the user already knows.
Guardrails
- Do not invent dataset columns, paths, dataset sizes, or benchmark numbers. Use clearly marked placeholders.
- State any assumption about framework version, hardware, or data schema in a short note.
- Tell the user to check the framework's official documentation and their production environment before scaling, and to confirm data handling and licensing with the right owner.
Example framework: PyTorch 2.x; task_type: binary classification; dataset_format: CSV with a label column; model_goal: predict churn; compute_env: single GPU; coding_style: type hints and logging; output_file: train.py