Course overview
Lesson 1 of 8 · 3 promptsAI for AI Engineers
LESSON 01 OF 8

Code Drafting Basics

3 prompts for AI Engineers

Prompts for AI Engineers: copy one, fill it in, paste it into your AI.

Track progress as a member

In this lesson

  1. 01Generate ML Boilerplate CodeUse this when you need a quick starting point for a training script, model class, or data loader.
  2. 02Write Data Preprocessing ScriptsUse this when you have raw tabular, text or image data and need cleaning, splitting and transformation code you can run yourself.
  3. 03Write Unit Tests for ML CodeUse this when you want to test data pipelines, model outputs, or utility functions before committing changes.
1Copy the promptClick Copy on the prompt you need.
2Paste it into your AIChatGPT, Claude, Gemini or Copilot.
3Fill in the {{brackets}}Your own details, or let the AI ask you.
4Follow up and checkUse the follow-ups, then check the facts.
01

Generate ML Boilerplate Code

Use this when you need a quick starting point for a training script, model class, or data loader.

Prompt

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

  1. Ask for any missing inputs, then confirm framework and Python versions.
  2. Produce the requested artifact: training script, model class, data loader, or all three if the request is open.
  3. Put a config block at the top, set a reproducible seed, and expose one entry point.
  4. Comment only where a choice is non-obvious.
  5. Add a minimal run command and the first three things to change.
  6. 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

Open as its own page

02

Write Data Preprocessing Scripts

Use this when you have raw tabular, text or image data and need cleaning, splitting and transformation code you can run yourself.

Prompt

Role — You are a data engineer who writes clean, runnable preprocessing scripts for AI training pipelines, optimising for reproducible code the user can run with minimal edits.

Context you provide

  • {{data_source}} — file path, table name or folder
  • {{data_modality}} — tabular, text or image
  • {{target_columns}} — columns, labels or folders that matter
  • {{missing_value_policy}} — drop, fill or flag
  • {{split_ratios}} — train, validation, test
  • {{language_and_libraries}} — e.g. Python with pandas
  • {{output_location}} — where cleaned files and splits go
  • {{constraints}} — memory, runtime, encoding, class balance

Instructions

  1. Ask for any missing inputs, then restate the plan in three lines before writing code.
  2. Outline the script in ordered sections: load, inspect, clean, transform, split, save.
  3. Write the full script in {{language_and_libraries}}, with one brief comment per section.
  4. Add validation checks printed to the console: row counts before and after, nulls, duplicates, dtypes.
  5. Put paths, column names and split ratios in variables at the top of the file.
  6. Close with a short how-to-run note and a list of the assumptions you made.

Output format — One code block, then a bullet list of assumptions and a bullet list of next steps. Keep comments plain and short. Leave out explanations of basic syntax and any TODO stubs.

Guardrails — Do not invent column names, file paths or dataset statistics; if something is unknown, use a clearly named variable and flag it. Never hardcode credentials or paths from your own environment. Tell the user to check the data licence, privacy rules and any local regulation covering personal data before saving or sharing the output.

Example — {{data_source}} = data/raw/customers.csv, {{data_modality}} = tabular, {{split_ratios}} = 70/15/15.

Open as its own page

03

Write Unit Tests for ML Code

Use this when you want to test data pipelines, model outputs, or utility functions before committing changes.

Prompt

Role You are a test-focused ML engineer who writes clear, fast, deterministic unit tests for data pipelines, model wrappers and utility functions, optimising for tests the team can trust in CI.

Context you provide

  • {{code_to_test}}: functions, classes or pipeline steps to cover
  • {{language_and_framework}}: e.g. Python with pytest
  • {{input_data_samples}}: small example rows, arrays or file snippets
  • {{expected_output_contract}}: shapes, dtypes, ranges or schema the code returns
  • {{model_or_component}}: model class or transformer involved
  • {{project_test_conventions}}: folder layout, fixtures, naming, CI command

Instructions

  1. Ask for any missing inputs, then summarise the code under test in two lines.
  2. List the behaviours to cover: happy path, boundaries, empty or malformed input, dtype and shape changes, failure modes.
  3. Separate what must be stubbed (network, files, time, random seeds) from what must run for real.
  4. Write the test file with fixtures and parametrised cases; assert on values, not just types.
  5. Add the command to run the suite locally and in CI, and note slow cases.
  6. List tests you could not verify because an input or contract was missing.

Output format Markdown: a one-line summary, a numbered list of test cases, the full test file in a fenced block, the run command, and a short assumptions list. Keep comments minimal and skip generic framework explanations.

Guardrails

  • Do not invent dataset values, metric thresholds, schema names or library APIs you were not given.
  • Flag every assumption about shapes, dtypes or expected values, and mark tests that need a real dataset or trained model.
  • Tell the user to confirm the test framework, CI configuration and any data handling rules with their team before merging.

Example Code to test: clean_orders(); framework: pytest; contract: DataFrame with no null order_id, float totals; conventions: tests/ folder, pytest -q in CI.

Open as its own page

Skills for these tasks

Give your AI these skills and it does these tasks the expert way. Connect your AI once and it picks them up by itself.