intermediate 45 min

How to write code you don't know how to write with AI

Ship a working script or feature even if you've never used the language before — safely.

Mark Barclay
Guide curated and reviewed byMark BarclayLast reviewed July 2026 · Next review October 2026

Before you start

  • A clear goal
  • A safe copy of the data or environment

Tools you'll use

  • ChatGPT
  • Claude
  • Cursor

Course modules

  1. 1.Describe the goal, not the code
  2. 2.Ask for the smallest working version
  3. 3.Read every line before you run it
  4. 4.Test on a copy of your data
  5. 5.Ask for the failure modes

Modules

  1. 1

    Describe the goal, not the code

    "A Python script that reads this CSV, groups by column X, and writes a summary CSV." Not "a pandas groupby."

  2. 2

    Ask for the smallest working version

    Do not accept 100 lines. Ask for the shortest thing that works, then iterate.

  3. 3

    Read every line before you run it

    Ask the assistant to explain any line you do not understand. Never run code you cannot explain to yourself.

  4. 4

    Test on a copy of your data

    Never let AI-generated code touch production data on the first run. Copy the file first.

  5. 5

    Ask for the failure modes

    "What could go wrong with this script? Add error handling for the top three."

What you'll have at the end

A working, tested script that solves a real problem — with you understanding every line.