Vibe Coding How-To

Getting Started with AI-Assisted Development

Developed by Stefano Morello, Zach Muhlbauer, and Stephen Zweibel

CUNY AI Lab

Table of Contents

What is Vibe Coding?

A term coined by Andrej Karpathy (AI researcher, former Tesla/OpenAI)

  • The idea: Describe what you want in plain language, let AI write the code
  • Why "vibe"? You focus on the feel and intent of what you want, not the syntax
  • How it works: You have a conversation with an AI agent that can read, write, and run code
  • You guide the direction, review the output, and iterate until it's right

Understanding AI

What's happening under the hood?

How Do LLMs Work for Coding?

  • LLMs are trained on billions of lines of code from open-source projects, documentation, and Stack Overflow
  • They predict what code should come next based on patterns
    • Can complete functions, suggest implementations, explain code, and debug errors
  • Command-line agents (like Gemini CLI) can execute commands, read/write files, and iterate on code
    • Different from chat interfaces
    • Actively interact with your development environment

Limitations of AI Coding

  • Plausible but broken code
    • Syntax may look right but logic can be flawed
  • Outdated libraries/syntax
    • May suggest deprecated methods or old versions
  • Security vulnerabilities
    • Can create code with security flaws that could be exploited
  • Limited context
    • Can't see your entire codebase at once

Critical Questions

Before we build, let's pause and reflect

  • Academic Integrity - How do we cite AI-assisted work? What's collaboration vs. offloading?
  • Bias & Fairness - AI models reflect biases in their training data
  • Environmental Impact - Training and running AI systems consume significant energy
  • Who builds these systems? - Often underpaid workers label data and moderate content
  • Who controls AI? - Major tech companies control development and access
  • Privacy concerns - What data are you sharing? How is it used for training?

Why Use AI Coding Tools, Then?

  • Prototyping and exploring ideas quickly
  • Helps learn new languages/frameworks by example
  • Debugging assistance and explaining error messages
  • Documentation and code explanation
  • Reduces context switching (stay in your terminal)
  • Democratizes access to coding for people without CS backgrounds

When NOT to Use AI

Use AI as a tool, not a replacement for understanding

  • When learning fundamentals for the first time
  • For sensitive or confidential data/code
  • When you need guaranteed accuracy (medical, legal, safety-critical)
  • When the goal is to develop your own problem-solving skills
  • When it would violate academic or professional policies

Prompt Engineering Basics

How you ask matters as much as what you ask

  • Be specific: "Create a Python function that sorts a list of dictionaries by the 'date' key" vs. "Help me sort some data"
  • Provide context: Share relevant code, error messages, project structure
  • Iterate: Refine your prompts based on results

Command Line Basics

Let's get comfortable with the terminal

What is the Terminal?

A terminal (or command line) is a text-based interface for controlling your computer

Instead of clicking buttons and icons, you type commands

Why use it?

  • More powerful and precise control
  • Essential for development work
  • How AI coding agents interact with your system

Opening Your Terminal

Mac:

  1. Press Cmd + Space
  2. Type "Terminal"
  3. Press Return

Windows:

  1. Press Windows key
  2. Type "PowerShell"
  3. Press Enter

Essential Commands

ls List files & folders in current directory
mkdir <name> Create a new folder
cd <name> Move into a specific folder
pwd Show your current location
cd .. Move up one level to parent directory

Installing Gemini CLI

Installation

Windows (PowerShell)

  • Install Node.js LTS: nodejs.org
  • Reopen PowerShell
  • Install Gemini CLI:
npm install -g @google/gemini-cli

macOS (Terminal)

  • Install Homebrew: copy command from brew.sh and run in Terminal
  • Add Homebrew to PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' \
  >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
  • Install Gemini CLI:
brew install gemini-cli

Login Setup

  • After installation, run gemini to authenticate with Google
  • Choose "Login with Google" and follow the browser prompt
  • Free tier: 60 requests/min, 1,000 requests/day
  • Having technical issues? Just ask!

Working with Gemini

Building your first project

Starting a Session

Each time you run gemini, you start a new session

  • Important: Always open Gemini from your project folder
    • The agent works with files in your current directory
  • Create a project folder:
    mkdir my-project
  • Enter the folder:
    cd my-project
  • Start Gemini:
    gemini

Start with a Plan

  • Use Plan Mode: Press Shift + Tab to toggle plan mode
    • In plan mode, Gemini will plan before taking action
  • Tip: Write your idea in a project-idea.md file first
    • Create the file in your project folder before starting Gemini
    • Then ask: "Read project-idea.md and create a plan"
  • The plan should include:
    • What the project will do
    • What files will be created
    • Key features or components
  • Review the plan and ask for changes before saying "go ahead"

Example Prompt & Plan

Your prompt:

"I want to build a personal portfolio website with my name, a short bio, and links to my social media. Write a plan first."

Agent's plan:

  • index.html - Main page with your name and bio
  • style.css - Styling for colors, fonts, layout
  • Sections: Header, About Me, Social Links, Footer
  • Mobile-friendly responsive design

Then you can say: "Looks good, but add a section for my projects too"

The Iterative Process

Vibe coding is a conversation, not a one-shot command

  • Review output - Check what the agent created before moving on
  • Give feedback - Tell the agent what to fix, improve, or change
  • Build incrementally - Add features one at a time, testing as you go
  • Ask questions - If you don't understand something, ask the agent to explain

Slash Commands

Type / followed by a command name for quick actions

/help List all available commands
/model Change the AI model
/settings Open settings menu
/init Create project memory file
/restore Undo the last file changes
/clear Clear the screen
/quit Exit Gemini (or press Ctrl+C twice)

Choosing a Model

Different models have different strengths

  • Select a model: Type /model in Gemini
    • Auto (recommended) - Gemini picks the best model for each task
    • Pro - Best for complex reasoning tasks
    • Flash - Faster responses, good for simple tasks
  • Enable Gemini 3: Use /settings and turn on Preview Features
    • Then /model → select Auto (Gemini 3) or Pro
  • Note: Free tier has daily limits

Saving Project Memory

Help the agent remember your project context across sessions

  • First time: Use /init to create a GEMINI.md file
    • Stores project structure, conventions, and preferences
    • Agent reads this automatically when you start a new session
  • To update: Say "Update my memory file"
    • /init won't update an existing file
    • Explicitly ask the agent to update it with new learnings

Previewing Your Website

For websites and web apps, you'll want to see your work in a browser

  • Simple HTML: Double-click the index.html file to open in browser
  • Live server: Ask Gemini: "Start a local server so I can preview my site"
    • Updates automatically when you make changes
  • View in browser: Go to http://localhost:8000 (or the port Gemini tells you)
  • Stop the server: Press Ctrl+C in the terminal running the server

Privacy Settings in Gemini

Control what data Google collects from your sessions

  • Why it matters: Especially with a free account, Google may use your prompts and code to improve their models
  • Check your settings: Type /privacy in Gemini
    • Shows the privacy notice and lets you change consent
  • To opt out: Use /settings and disable data collection
    • Or set "usageStatisticsEnabled": false in your settings.json
  • Good news: Gemini automatically redacts passwords, API keys, and secrets from commands

Version Control

Saving and sharing your work

Why Version Control?

AI agents can break things - version control is your safety net

  • Save checkpoints: Capture working versions before making big changes
  • Undo mistakes: Roll back if the agent breaks something
  • Track history: See what changed and when
  • Backup your work: Push to GitHub so you don't lose everything

What is GitHub?

A website that stores your code in the cloud

  • Git = the version control system (runs on your computer)
  • GitHub = a website that hosts your git repositories online
  • Sign up: github.com/signup (free account)
  • Visibility:
    • Public repos: Anyone can see your code (good for portfolios)
    • Private repos: Only you can see your code (good for work in progress)

Using Git with Gemini

You can ask Gemini to handle version control for you

  • Initialize a repo: "Set up git for this project"
  • Save a checkpoint: "Commit my changes with the message 'added homepage'"
  • Push to GitHub: "Create a GitHub repo and push my code"
    • First time may require GitHub authentication
  • Check status: "Show me the git status"

Rolling Back Changes

When things go wrong, you can revert to a previous version

  • See history: "Show me the commit history"
  • Undo last commit: "Undo the last commit but keep my files"
  • Go back further: "Revert to the commit where the homepage was working"
  • Tip: Commit often with clear messages so you can find the right version

GitHub Tips

  • GitHub Education: Free perks for students & educators
  • Don't share sensitive data!
    • Passwords, API keys, personal info should never be pushed
    • Ask Gemini: "Add my .env file to .gitignore so it won't be uploaded"

Tips & Troubleshooting

When things go wrong

Debugging with Gemini

When something breaks, Gemini can help you fix it

  • Share the error: Copy and paste the full error message into Gemini
  • Ask questions:
    • "What went wrong?"
    • "Why am I getting this error?"
    • "Fix this error"
  • Give context: Tell Gemini what you were trying to do when the error happened
  • Be patient: Sometimes it takes a few tries to find the fix

When to Start Fresh

Sometimes it's better to start a new session

  • Signs you should restart:
    • Gemini keeps making the same mistake over and over
    • Responses seem confused or off-topic
    • You've changed direction significantly from where you started
    • Too many errors have piled up
  • To start fresh: Type /quit, then run gemini again
  • Your GEMINI.md file will help the new session understand your project

Other Vibe Coding Tools

We use Gemini CLI because students can get it free, but the same principles apply to other tools

  • Claude Code - Recommended for advanced projects
  • Kimi K2.5 - If you prefer open-weight models
  • OpenAI Codex / ChatGPT - Another popular option
  • The skills transfer: Planning, iterating, version control, and debugging work the same way

Happy Vibing!

Reach out: ailab@gc.cuny.edu

Visit us: ailab.gc.cuny.edu