In this lab, you will get hands-on experience with AI coding assistants. We'll use Claude Code, Anthropic's command-line assistant, as our example. You will install it on an Ubuntu machine and use it to build a small Python program through a short series of prompts, watching how a sketch can grow into something with real structure and tests.
Consider working with a partner on this one --- there's a bit of a steep learning curve, and it will make this all more fun.
Before installing anything, let's see what a "plain" chat assistant gives you when you ask for code. You'll use Google's Gemini for this. We all have access through our college Google accounts.
In the Gemini chat box, type:
Make a simple tic-tac-toe game in Python.
Read the response. Then save the code: make a directory
~/lab10-gemini, paste Gemini's code into a file there (e.g.,
tictactoe.py), and try to run it:
mkdir ~/lab10-gemini
cd ~/lab10-gemini
# paste Gemini's code into tictactoe.py using your editor
python3 tictactoe.py
Did it run on the first try? What data structure did it use for the board? Can you read it all easily?
Claude Code runs in your terminal. Open a terminal on your Ubuntu machine and follow the steps below.
Claude Code ships with an install script that drops the claude binary
into ~/.local/bin --- no sudo required.
curl -fsSL https://claude.ai/install.sh | bash
You should see output like:
✔ Claude Code successfully installed!
Version: 2.1.142
Location: ~/.local/bin/claude
You can run the binary directly from ~/.local/bin/:
~/.local/bin/claude --version
You should see the version number print. Everything lives under your
home directory; nothing was installed system-wide. We'll use the full
path ~/.local/bin/claude throughout this lab.
The instructor will provide credentials for an Anthropic account that you can use for this lab. Do not share these credentials outside the class.
Launch Claude Code from any directory:
~/.local/bin/claude
On first launch, Claude Code prompts you to sign in. Choose the browser sign-in option and follow the link it prints. In the browser, log in with the credentials the instructor provided. When sign-in completes, return to the terminal --- Claude Code should report that you are authenticated.
Type /exit (or press Ctrl-D) to quit. You only need to sign in
once per machine.
You will now reproduce a short coding session. Each step is a single prompt to Claude. After each prompt, read what Claude produced before moving to the next step.
mkdir ~/lab10
cd ~/lab10
~/.local/bin/claude
Leave Claude running and open a second terminal window (or tab).
cd into the same directory:
cd ~/lab10
You'll chat with Claude in the first terminal and run the code Claude writes (Python, tests) in the second. Having both open side-by-side makes it much easier to iterate: tweak via chat, run via shell, repeat.
Open ~/lab10 in your favorite editor (VS Code, Emacs, vim, gedit ---
whatever you like). Keep it open alongside the two terminals.
This is the most important habit in this lab: every time Claude writes or changes a file, switch to the editor and read what it wrote. Don't just trust the summary Claude prints in the chat --- look at the actual code. Ask yourself:
If something looks wrong, say so in the chat and ask Claude to fix it before moving on.
At the Claude prompt, type:
Make a simple tic-tac-toe game in Python.
Claude should create a file (for example, tictactoe.py) with a
working two-player console game. Try running it:
python3 tictactoe.py
Play a quick game to confirm it works.
Many AI-generated solutions represent the board as a flat list of nine squares. Ask Claude to do better:
Revise it to use a real data structure for the board.
Look at the diff. Did Claude switch to a 2D grid? Did it add helper functions for rows, columns, and diagonals? Run the game again to confirm it still works.
Add tests using the
unittestpackage.
Claude should create a test file (for example, test_tictactoe.py).
Run the tests:
python3 -m unittest test_tictactoe -v
All tests should pass.
So far the game is hard-coded to a 3×3 board. Ask Claude to make it work for any size:
Make the game support NxN grids.
Look at the diff. Did Claude take the size from the command line? Did it update the helper functions (rows, columns, diagonals, winner check) so they no longer assume a 3×3 board? Did it update the tests to cover larger boards?
Run the tests again, then try a 4×4 game:
python3 -m unittest test_tictactoe -v
python3 tictactoe.py 4
Now that you've seen the basic rhythm --- prompt, read the diff, run the code, prompt again --- it's your turn to drive. Pick a small project and grow it with Claude Code the same way we grew tic-tac-toe.
Choose something you'd actually enjoy playing with. A few ideas to get you started:
curses library.Or, if you'd rather build something you can open in a browser, ask
Claude for a single self-contained index.html with the JavaScript
embedded in a <script> tag. Some ideas:
<canvas> with a few balls that
bounce off the walls and each other. Add sliders for gravity and
friction.<canvas> you can draw on with the mouse, with
a color picker, clear button, and save-as-PNG.localStorage.<canvas> in real time.To view a single-file page, just open index.html (macOS) or
xdg-open index.html (Ubuntu) from the terminal --- no server
required.
Start from a fresh directory (e.g., ~/lab10-fun), launch Claude
there, and open a second terminal and an editor as before.
unittest tests for the trickier functions. Run them.While you build, try at least three of the following. Note in your write-up what each one does and whether it was useful.
/help --- list the built-in slash commands./clear --- start a fresh conversation when the context gets
cluttered. Useful when you switch tasks./rewind --- undo Claude's recent work and roll the
conversation back to an earlier point. Great when a prompt sent
things in a wrong direction and you'd rather retry than try to
patch your way out./init --- have Claude scan your project and write a
CLAUDE.md summarizing it. Useful on bigger projects so future
sessions start with context.@filename --- reference a specific file in your prompt
(e.g., "look at @game.py and add a save/load feature").I'll leave the Claude credentials active until Saturday morning, so if you'd like to keep playing around after lab --- finish your project, try another idea, or just poke at Claude's features --- feel free.