Your First Safe Agent-Driven Change
Make your first real code change with AI assistance, with safety rails and verification steps.
What you'll accomplish
Successfully make a small, reversible change to a codebase using AI assistance.
Prerequisites
- A code editor (VS Code, Cursor, or similar)
- Git installed on your system
- A simple project to work with (or use our example)
Overview
In this lesson, you'll make your first AI-assisted code change. We'll use a simple task with built-in safety rails so you can learn the workflow without risk.
Tip
The key to safe vibecoding is small, reversible changes. Always work in a way where you can easily undo if something goes wrong.
Step 1: Set Up a Safe Environment
Before making any changes, ensure you can undo them.
Step 2: Plan Your Change
Before asking AI for help, know what you want:
- Current state: A simple Python script that prints "Hello, World!"
- Desired state: The script takes a name as input and greets that person
- Constraint: Keep it simple, no external dependencies
Step 3: Ask for Help
Use this prompt with your AI tool of choice:
Simple Enhancement Request
A constrained request for a small feature addition
I have a simple Python script in main.py that currently prints "Hello, World!". I want to modify it to: 1. Ask the user for their name 2. Greet them by name 3. Keep it simple - no external libraries Please show me the modified code and explain what changed.
Step 4: Review the Output
The AI should give you something like:
python# main.py - Personalized greeting name = input("What's your name? ") print(f"Hello, {name}!")
Before applying this:
- Does the code make sense?
- Are there any unexpected imports or dependencies?
- Does it match what you asked for?
Step 5: Apply and Test
Step 6: Commit Your Change
If the change works correctly:
bashgit add main.py git commit -m "Add personalized greeting"
How to Undo
If something went wrong:
bash# Discard all changes and go back to the last commit git checkout . # Or if you already committed: git reset --hard HEAD~1
Danger
git reset --hard is destructive! It permanently removes uncommitted changes. Always commit frequently so you can roll back safely.
Common Failures and Fixes
| Problem | Solution |
|---|---|
| "python3 not found" | Try python instead, or install Python |
| Git not initialized | Run git init in your project directory |
| AI gave complex code | Ask for a simpler version |
Verify Your Understanding
You've completed this lesson if you can:
Next: Learn how to ask for fixes without spiraling into complexity.