Skip to main content

AI Coding Prep

Tools, environment, and prompting habits to have in place before Week 1

This is the before-the-course prep page: get your environment ready and pick up a few prompting habits that the weekly material will assume from Week 1 onward. None of this is a session — work through it on your own.

If you have already used Copilot/Cursor on a real project and you know what “give it a 1/1000 sample plus a data dictionary” means, you can skip the page entirely.


What you need installed

Required

  • A working Python or R setup you’ve used before. Stata is fine for the early weeks of the course but the capstone is realistically Python or R.
  • A ChatGPT account (free tier is fine for Week 1).
  • A Claude account (free tier is fine).

Strongly recommended

Optional

  • Cursor — AI-first editor; some students prefer it to VS Code.
  • An AI CLI (Claude Code, Codex). You’ll install one of these in Week 4 — see Installing AI CLI Tools when you get there. No need to do it now.

Why AI works well for data-analysis code

It is worth being explicit about why AI is unusually good at this slice of coding, because it tells you where to trust it and where not to.

  • Repetitive patterns. Load → clean → analyse → visualise is the same shape across most projects.
  • Well-documented libraries. pandas, dplyr, ggplot2, scikit-learn — extensive coverage in training data.
  • Specific intent. “Scatter of sales against employment, regression line, ggplot” leaves little room for ambiguity.
  • Iteration is cheap. Chat is the right interface for “almost — now make the axis log”.

Where AI is reliably not enough on its own: research-design choices, econometric interpretation, domain-specific logic, and any quality control you would do on a colleague’s code.


Prompting habits for code

A short list. The course will reinforce all of these, but the earlier you internalise them the smoother Weeks 1–3 will be.

Be specific about the stack.

  • “Using pandas and seaborn …” or “Using R and tidyverse …”.
  • “I prefer polars to pandas unless you need a pandas-only feature.”
  • “Use fixest::feols for regressions, not lm.”

Show the data shape.

  • Paste the column list and dtypes, or a 5–10 row sample.
  • For larger files, upload a 1/1000 random sample rather than the full file.
  • Even better: hand it a data dictionary first (Week 2 covers how to build one).

Specify the output you want.

  • “Save as PNG, 1200 × 800, for a paper figure.”
  • “Return a tidy data frame, one row per (country, year).”
  • “Markdown with LaTeX equations inline, no code block.”

Define defaults once, reuse them.

  • In ChatGPT Custom Instructions or a Claude Project: language, library preferences, comment style, OS.
  • In Cursor/Claude Code: a CLAUDE.md or rules file at the repo root (Week 5).

Two sample prompts to compare

Try both on your own data and notice the difference.

Vague

Here is some sales data, summarise regional variation.

Specific

Using Python, pandas, and plotnine:

1. Load `sales.csv` with columns id, date, sales, region.
2. Filter to 2023.
3. Group by region, compute mean and median sales.
4. Bar chart of mean sales by region, ordered descending, viridis palette.
Return the code only, with brief comments.

The second is boring on purpose — boring is what reproduces.


Version control with Git and GitHub

Git keeps a history of a project folder. Each time you commit, Git saves a snapshot of every file, with a one-line note on what changed. GitHub keeps a copy of that history online, private unless you choose otherwise, and shows it in the browser. You can also use Git on its own, without GitHub.

It takes an hour to set up and a new habit to learn. For work with AI agents, we think it is worth it, for four reasons.

  1. You see exactly what changed. The agent edits many files quickly. With Git, every change since the last commit is listed line by line: what was removed, what was added, in which file. Nothing changes silently.
  2. Every mistake can be undone. If the agent breaks something, go back to the last commit that worked. This makes it cheap to let the agent try things.
  3. You get a record of the work. The list of commits shows what was done and when. Agents write good commit notes, and they can read the history too: “What changed since Monday, and why?”
  4. Backup and coauthors. The copy on GitHub survives a lost laptop, and a coauthor can see the same history.

Setting it up

  1. Create a GitHub account at github.com. Students and teachers should also claim the GitHub Student Pack.

  2. Install Git.

    • Windows: Git for Windows, with all default options.
    • Mac: open Terminal and type git --version. If Git is missing, the Mac offers to install it (the “command line developer tools”). Click Install.
    • Linux: usually installed already; otherwise sudo apt install git.
  3. Install GitHub Desktop (Windows and Mac) and sign in with your GitHub account. It shows the history and the changes in a window, so you do not need the terminal.

  4. Turn the project folder into a repository. Ask the agent:

    Make this folder a Git repository. Add a .gitignore that excludes data/,
    .venv/ and output/. Then make a first commit with a short message.
  5. Publish it. In GitHub Desktop, choose File → Add local repository and pick the folder. Then click Publish repository and keep Keep this code private ticked.

Using it day to day

  • Commit after each step that works. Ask the agent: “Commit with a short message describing what changed.” Small commits are easier to read and to undo.
  • Look at the changes. In GitHub Desktop, the Changes tab shows everything changed since the last commit; the History tab shows each past commit and what it changed.
  • Undo. Uncommitted changes you don’t want: right-click the file in Changes → Discard changes. A whole commit: right-click it in History → Revert changes in commit. Or ask the agent: “Go back to the last commit that worked, and tell me what that undoes.”
  • Push to GitHub. Click Push origin to send your commits to the online copy, for example at the end of the day.

Add these rules to your AGENTS.md, so that the agent does not commit or push on its own:

- Commit only when I ask. Never push to GitHub without asking.
- Never rewrite or delete Git history.
WarningData usually stays out of Git

Keep data files out of the repository (that is what the .gitignore above does). There are three reasons. Confidential data should not go online, even to a private repository, unless your data agreement allows it. GitHub refuses files larger than 100 MB. And raw data never changes, so it does not need a history. Back it up separately, and keep it read-only.


Tools, in one place

A quick map of what each tool is good for. You don’t need all of these.

Tool Good for Notes
ChatGPT (Canvas, Advanced Data Analysis) Quick exploration, data uploads, chart drafts “Code Interpreter” runs Python in-browser
Claude Projects + Artifacts Carrying a codebook / data dictionary across many turns Used heavily in Week 2
GitHub Copilot Inline completion in your editor Works in VS Code, RStudio (via extension), JupyterLab
Cursor AI-first editor with whole-repo context Some students prefer it to VS Code + Copilot
Claude Code / Codex (CLI) Agentic work on a real repo Introduced in Week 4 — install then

Self-check before Week 1

You’re ready if you can, in 10 minutes:

  1. Open a CSV in your editor of choice and run a small script with Copilot inline suggestions on.
  2. Paste the same task into ChatGPT or Claude with a specific prompt and get runnable code back.
  3. Take that code, drop it in your editor, run it, and iterate on the output.

If any of those three is friction, fix it now rather than mid-Week-2.