Appearance
Vibe Coding with AI CLIs
"Vibe coding" just means treating natural language as your primary way of directing a codebase, telling an AI CLI what you want built, fixed, or refactored, instead of typing every line yourself. Gemini CLI is where you'll do most of that in this course, and the difference between using it casually and using it well comes down to five specific habits: giving it persistent memory of your project, scripting your own repeatable commands, feeding it real file context instead of making it guess, knowing when to let it run unattended, and always having an undo button ready when it doesn't. Five short labs, one habit each.
Run every lab below from your workspace: ~/AI_BOOTCAMP. For a deeper reference on Gemini CLI beyond these five habits, see the full tips guide.

What you'll learn
- Persistent project memory via
GEMINI.md, loaded automatically every session - Building custom slash commands to script repetitive workflows
- Checkpointing and
/restoreas a lightweight undo button for AI-made changes
🗺️ gemini-cli Training Curriculum Map
This roadmap outlines the progression of labs in this lesson, taking you from initial context setup to advanced automation and safety mechanisms:
📦 Lab 1: Persistent Project Context & Memory Setup
NOTE
Stop repeating setup instructions in your chat prompts. A local GEMINI.md holds permanent project rules; /memory stores dynamic insights you pick up during an active debug session.
🎯 Goal
Seed gemini-cli with your active environment (ai_dev conda env, PostgreSQL port 5432 from tools.yaml, and the ~/AI_BOOTCAMP folder structure) so it always knows your tech stack out-of-the-box.
🚶 Step-by-Step Instructions
- Initialize the Local Context File: Launch the terminal inside your workspace and generate the starter template:bashThis will create a
cd ~/AI_BOOTCAMP npx @google/gemini-cli gemini> /init.gemini/GEMINI.mdfile in the root ofAI_BOOTCAMP. - Apply Your AI Engineering Guidelines: Open the newly created
.gemini/GEMINI.mdand overwrite it with this clean, project-specific context block:markdown# AI_BOOTCAMP - AI Bootcamp Workspace Context ## Active Dev Environment - **Language**: Python >=3.10 - **Primary Env**: Conda environment `ai_dev` - **Package Installer**: `uv` (Rust-based) - **Database**: PostgreSQL (port 5432, vector search enabled) ## Coding Standards - Write clean, asynchronous code using Python's `asyncio` wherever possible. - Always enforce strict data validation utilizing `Pydantic v2`. - Provide complete drop-in replacement snippets instead of placeholders like `// TODO`. - Audit Loaded Memory: In the gemini-cli, verify that the context was loaded successfully:bash
gemini> /memory show - Add Dynamic Fact Memory: During your session, instruct Gemini to remember the PostgreSQL credentials from your
tools.yamlwithout editing the markdown file manually:bashVerify it appended to your memory list usinggemini> /memory add "PostgreSQL credentials: User 'agent_user', DB 'postgres', Password 'YOUR_DB_PASSWORD'"/memory show.
⌨️ Lab 2: Custom Slash Commands (TOML Scripting)
TIP
Package a complex, multi-line prompt you use often, a security audit, a schema generator, a test-writing pass, into an instant, reusable custom slash command instead of retyping it every time.
🎯 Goal
Create a custom slash command /agent:new that takes a name as an argument and generates a boilerplate asynchronous FastAPI agent script inside AI_BOOTCAMP.
🚶 Step-by-Step Instructions
- Create the Commands Directory: Create the folder structure inside your
.geminiworkspace folder:bashcd ~/AI_BOOTCAMP mkdir -p .gemini/commands/agent - Draft the Custom TOML Command: Create a new file named
new.tomlinside.gemini/commands/agent/: Path:~/AI_BOOTCAMP/.gemini/commands/agent/new.tomlWrite the following structure:toml# Invoked inside gemini-cli as: /agent:new "MyBillingAgent" description = "Generates a boilerplate asynchronous FastAPI agent structure." prompt = """ You are an expert AI software architect. Please write a fully implemented, production-grade asynchronous Python FastAPI agent boilerplate. Specifications: 1. The agent class name should be: {{args}} 2. Utilize Pydantic v2 for validating request payloads. 3. Include a robust mock cognitive loop using asyncio.sleep(). 4. Provide logging using Python's standard `logging` library. 5. Save this code into a file named '01_cli_tools/{{args}}_agent.py'. """ - Execute the Command: Restart or refresh your gemini-cli session, and run your new custom shortcut:bashWatch as gemini-cli parses the template, generates the code, and creates the file inside your
gemini> /agent:new "WorkflowOrchestrator"01_cli_tools/folder!
📂 Lab 3: Context Injection & Shell Passthrough
IMPORTANT
Never let the model guess at file contents or fly blind on shell output. Use @ to inject a real file or directory into the prompt, and ! to run a system command directly without leaving the REPL.
🎯 Goal
Perform a security and performance audit on your newly generated agent file using explicit file context and direct terminal feedback.
🚶 Step-by-Step Instructions
- Direct Context Injection: Start gemini-cli and inject the agent code directly into the prompt using the
@symbol:bashgemini> Audit this file for async race conditions or performance issues: @./01_cli_tools/WorkflowOrchestrator_agent.py - Review Proposed Edits: When Gemini proposes optimization edits, inspect the
/diffwindow to check what changes it suggests. - Execute Shell Commands (Bang
!): Instead of exiting the chat to run a linter or test, execute a shell command directly from thegemini>prompt using!:bashThis maintains your active chat context while giving you direct console access!gemini> !pytest -v 01_cli_tools/ # Or to check python version in the active environment: gemini> !~/miniconda3/envs/ai_dev/bin/python --version
⚡ Lab 4: On-the-Fly Tool Creation & YOLO Mode
CAUTION
Gemini CLI can write helper scripts and run them on the fly. YOLO mode skips the confirmation prompt for every action, which is what makes large batch tasks fast, and what makes it genuinely risky on a filesystem you care about. Use it deliberately, not as a default.
🎯 Goal
Write an autonomous helper tool that scrapes all .py files in your workspace, finds any hardcoded passwords, and flags them. We will run this in YOLO mode to fast-track file creation and execution.
🚶 Step-by-Step Instructions
- Enable YOLO Mode: Launch gemini-cli in YOLO mode, or toggle it inside your active session by pressing
Ctrl + Y:bashgemini --yolo # (Notice the auto-approve indicator active in your terminal) - Request On-the-Fly Automation: Prompt the assistant to build and run a security utility script:bash
gemini> Create a python script '01_cli_tools/secret_scanner.py' that recursively searches the current directory for hardcoded API keys or passwords using regex. Then, execute the script and output the results. - Observe Autonomous Execution: Because YOLO mode is enabled, gemini-cli will:
- Write the python scanner file immediately.
- Run
~/miniconda3/envs/ai_dev/bin/python 01_cli_tools/secret_scanner.pyimmediately. - Deliver the scanner logs directly in your chat without a single prompt pause!
🛡️ Lab 5: Safety Nets, Checkpointing & /restore
WARNING
YOLO mode and complex multi-file refactors can both leave you with broken imports or a buggy edit you didn't ask for. Checkpointing is what turns that from a disaster into a one-command revert.
🎯 Goal
Enable checkpointing, intentionally command the AI to execute a destructive or broken refactor, and roll back the workspace to its exact prior state.
🚶 Step-by-Step Instructions
- Boot with Checkpoints Active: Launch the CLI with checkpointing enabled:bash
gemini --checkpointing - Simulate a Destructive Refactor: Command the AI to apply an aggressive modification:bashApprove the tool execution. Look for the console message:
gemini> Delete all comments and docstrings in '01_cli_tools/secret_scanner.py' and change all variable names to single characters.[Checkpoint saved]. - Inspect the Damage: Look at the messy output file. You have a broken, unreadable script.
- Revert via
/restore: List available snapshots:bashRoll back to the snapshot captured before the refactor was executed:gemini> /restore listbashOpen the scanner file, it is fully restored with comments, docstrings, and original variables intact!gemini> /restore 0
What goes wrong
| Mistake | How you notice it | The fix |
|---|---|---|
| Repeating the same setup context in every prompt | You're retyping your stack/conventions constantly, and the model still sometimes forgets them mid-session | Put it in GEMINI.md once, it loads automatically every session |
| Running YOLO mode as a default habit | An unattended edit does something you didn't intend, with no confirmation step to catch it | Reserve YOLO mode for batch tasks you've thought through; leave confirmations on otherwise |
| Refactoring without checkpointing enabled | A broken multi-file edit has no clean way back | Launch with gemini --checkpointing before any refactor you're not 100% sure about |
| Asking the model to reason about a file it hasn't actually seen | Confidently wrong suggestions about code that doesn't match what's really there | Inject the real file with @path/to/file instead of describing it from memory |
Confirm it worked
Run /memory show after Lab 1 and confirm your project's real stack details come back, not a generic answer, but your actual conda environment name and database port. Then run /restore list after Lab 5's intentional bad refactor and confirm the pre-refactor snapshot is there, ready to roll back to. If both check out, Gemini CLI is actually configured for this course, not just installed.
Next: Prompting & Context Engineering , the craft underneath every prompt you just wrote in these labs.