Chapter 4 Exercises: Setting Up Your Vibe Coding Environment
Tier 1: Recall (Exercises 1-6)
These exercises test your basic comprehension of the concepts covered in Chapter 4.
Exercise 1: System Requirements Identification
List the minimum hardware requirements for a vibe coding environment as described in this chapter. For each requirement (processor, RAM, storage, display, internet), state both the minimum and recommended specifications.
Exercise 2: Tool Purpose Matching
Match each tool to its primary purpose in the vibe coding workflow:
| Tool | Purpose |
|---|---|
| 1. Python 3.10+ | A. Version control system |
| 2. VS Code | B. AI inline code completions |
| 3. Claude Code | C. Programming language |
| 4. GitHub Copilot | D. Code editor with extensions |
| 5. Cursor | E. CLI-based AI reasoning assistant |
| 6. Git | F. AI-native IDE |
Exercise 3: Shell Identification
For each operating system, identify the default shell: - Windows - macOS (Catalina and later) - Most Linux distributions
Also identify the shell profile file for each shell.
Exercise 4: Virtual Environment Vocabulary
Define the following terms in your own words:
1. Virtual environment
2. pip
3. requirements.txt
4. .env file
5. .gitignore
Exercise 5: PATH Explanation
Explain what the PATH environment variable is and why it matters when installing Python, Node.js, and other command-line tools. What symptom do you see when a program is installed but not on your PATH?
Exercise 6: API Key Security
List three things you should never do with an API key, and explain the correct way to store API keys for use in a Python project.
Tier 2: Apply (Exercises 7-14)
These exercises require you to use the concepts from the chapter in straightforward scenarios.
Exercise 7: Python Version Check Script
Write a Python script that checks whether the current Python version meets the minimum requirement (3.10). The script should:
- Print the current Python version
- Print "PASS" if the version is 3.10 or higher
- Print "FAIL" with a message if the version is lower
- Use sys.version_info to get the version components
Exercise 8: Virtual Environment Workflow
Perform the following sequence of operations and write down the commands you used at each step:
1. Create a new project directory called exercise-08
2. Initialize a Git repository in it
3. Create a virtual environment called .venv
4. Activate the virtual environment
5. Install the rich and requests packages
6. Freeze the requirements to a file
7. Create a .gitignore that excludes .venv/, .env, and __pycache__/
8. Make an initial Git commit
9. Deactivate the virtual environment
Exercise 9: Environment Variable Configuration
Create a .env file with the following variables:
- APP_NAME set to "My Vibe App"
- DEBUG set to "true"
- API_TIMEOUT set to "30"
Then write a Python script that loads these variables using python-dotenv and prints each one. The script should handle the case where a variable is missing by printing a default value.
Exercise 10: VS Code Settings Configuration
Write a settings.json file for VS Code that includes:
- Python as the default language
- Tab size of 4 spaces
- Format on save enabled
- Auto-save after 1 second delay
- Font size of 14
- Word wrap enabled
- Basic type checking for Python
Explain what each setting does.
Exercise 11: Git Configuration Verification
Write a Bash script (or PowerShell script) that verifies Git is properly configured by checking for:
- user.name is set
- user.email is set
- init.defaultBranch is set to "main"
- core.editor is set
For each check, print whether it passes or fails.
Exercise 12: Shell Alias Creation
Create a set of at least 8 useful shell aliases for vibe coding workflows. Include aliases for: - Python and pip shortcuts - Git commands you use frequently - Virtual environment activation - Navigating to your project directory
Write these for both Bash/Zsh and PowerShell.
Exercise 13: Node.js Verification
Write a Python script that uses subprocess to check whether Node.js and npm are installed, and if so, prints their version numbers. The script should handle the case where the commands are not found and print helpful installation instructions.
Exercise 14: Requirements File Analysis
Given the following requirements.txt file, explain what each package does and why it might be useful in a vibe coding project:
requests==2.31.0
python-dotenv==1.0.0
rich==13.7.0
click==8.1.7
pytest==7.4.3
black==23.12.1
mypy==1.8.0
httpx==0.26.0
Tier 3: Analyze (Exercises 15-22)
These exercises require you to break down complex scenarios, compare alternatives, and reason about trade-offs.
Exercise 15: Tool Comparison Analysis
Compare and contrast the following three approaches to AI-assisted coding: 1. VS Code + GitHub Copilot + Claude Code (CLI) 2. Cursor with its built-in AI features 3. VS Code + Claude Code only (no Copilot, no Cursor)
For each approach, analyze: - Strengths for a beginner - Strengths for an experienced developer - Cost considerations - Setup complexity - When you would choose this approach
Exercise 16: Virtual Environment Debugging
A developer reports the following problem: "I installed requests using pip, but when I run my script, it says ModuleNotFoundError: No module named 'requests'." List at least five possible causes for this problem, ordered from most to least likely, and explain how to diagnose and fix each one.
Exercise 17: PATH Troubleshooting
A user on Windows has Python 3.12 installed at C:\Python312\ and Python 3.9 installed at C:\Users\alex\AppData\Local\Programs\Python\Python39\. When they run python --version, they see Python 3.9.13. Explain:
1. Why this happens
2. How PATH resolution works (which directory is searched first?)
3. Three different ways to fix this so that python runs version 3.12
4. How to verify the fix worked
Exercise 18: Security Audit
Review the following project structure and identify all security issues:
my-project/
.env # Contains ANTHROPIC_API_KEY=sk-ant-abc123
.git/
config.py # Contains: API_KEY = "sk-ant-abc123"
main.py
requirements.txt
README.md # Contains: "Set your API key: export ANTHROPIC_API_KEY=sk-ant-abc123"
The .gitignore file contains:
__pycache__/
*.pyc
List every security problem, explain why each is dangerous, and provide the corrected version of each file.
Exercise 19: Cross-Platform Script Analysis
Analyze the following script and identify every line that would fail or behave differently on Windows versus macOS versus Linux. For each issue, explain the problem and provide a cross-platform solution.
import os
import subprocess
home = os.environ["HOME"]
config_path = home + "/.config/myapp/settings.json"
subprocess.run(["cat", config_path])
subprocess.run(["which", "python3"])
os.system("clear")
venv_activate = "./venv/bin/activate"
Exercise 20: Environment Isolation Analysis
Explain the difference between the following four levels of environment isolation, when you would use each, and what problems each solves: 1. No isolation (global pip install) 2. Virtual environments (venv) 3. Containerization (Docker) 4. Virtual machines
Exercise 21: Claude Code vs. Copilot Workflow Analysis
You are building a Python web scraping script. Describe how you would use Claude Code and GitHub Copilot differently for the following specific tasks within that project: 1. Planning the overall architecture 2. Writing the HTTP request function 3. Parsing HTML response data 4. Adding error handling for network failures 5. Writing unit tests 6. Debugging a 403 Forbidden error
For each task, specify which tool you would use and why.
Exercise 22: Installation Order Dependencies
Draw a dependency graph showing which tools in this chapter depend on other tools being installed first. For example, GitHub Copilot depends on VS Code, which should be installed first. Include all tools from the chapter and indicate which dependencies are strict (required) versus recommended (helpful but not necessary).
Tier 4: Create (Exercises 23-27)
These exercises require you to build something new using the concepts from this chapter.
Exercise 23: Enhanced Verification Script
Extend the verification script from Section 4.10 (example-01-verify-setup.py) to also check:
1. Whether a virtual environment is currently active
2. The available disk space (warn if less than 2 GB)
3. Internet connectivity (attempt to reach https://api.anthropic.com)
4. Whether common Python development packages (black, mypy, pytest) are installed
5. The version of Cursor (if installed)
Each check should print a colored status (green for pass, yellow for warning, red for fail) using the rich library.
Exercise 24: Project Scaffolding Script
Write a Python script called create-project.py that automates the creation of a new vibe coding project. The script should:
1. Accept a project name as a command-line argument
2. Create the project directory
3. Initialize a Git repository
4. Create a virtual environment
5. Create a .gitignore with standard entries
6. Create a .env.example template
7. Create a README.md with the project name
8. Create a requirements.txt with standard packages
9. Create a src/ directory with an __init__.py file
10. Make an initial Git commit
11. Print a summary of what was created
Use argparse for argument parsing and include proper error handling.
Exercise 25: Multi-Tool Configuration Dashboard
Write a Python script that displays a dashboard showing the configuration status of all vibe coding tools. The dashboard should be formatted as a table using the rich library and include:
- Tool name
- Installed version (or "Not Found")
- Configuration status (Configured / Needs Setup / Error)
- A brief action item if setup is needed
Include at least: Python, pip, Git, Node.js, npm, Claude Code, VS Code, and Cursor.
Exercise 26: Environment Backup and Restore
Write two Python scripts:
backup-env.py: Captures the current environment configuration, including: - Python version and installed packages - Git configuration - Shell profile contents - List of VS Code extensions - Environment variables (names only, not values, for security)
Saves everything to a JSON file.
restore-env.py: Reads the JSON backup and: - Checks which components need to be installed or updated - Prints step-by-step instructions to restore the environment - Optionally runs pip install for missing packages
Exercise 27: Interactive Setup Wizard
Write a Python script that acts as an interactive setup wizard for new vibe coders. The script should:
1. Welcome the user and explain what it will do
2. Check each prerequisite one at a time
3. For each missing tool, provide installation instructions specific to their operating system (auto-detected)
4. Ask if they want to proceed after each step
5. At the end, run a complete verification
6. Use colors and formatting (via rich) for a polished experience
Tier 5: Challenge (Exercises 28-30)
These exercises integrate concepts from multiple chapters and push beyond the material covered in this chapter.
Exercise 28: Cross-Platform Environment Manager
Build a command-line tool called vibe-env that manages vibe coding environments across projects. The tool should support the following commands:
vibe-env create <project-name> # Create a new project with full setup
vibe-env check # Verify the current environment
vibe-env doctor # Diagnose and suggest fixes for issues
vibe-env list # List all managed projects
vibe-env switch <project-name> # Print activation commands for a project
vibe-env export # Export environment config to a portable format
Requirements:
- Works on Windows, macOS, and Linux
- Uses argparse with subcommands
- Includes comprehensive error handling
- Has type hints and docstrings throughout
- Includes at least 5 unit tests
Exercise 29: AI Tool Integration Test Suite
Create a test suite that verifies all AI coding tools are not just installed but actually functional. This goes beyond version checks to test actual functionality:
- Claude Code test: Send a simple prompt and verify a response is received (requires API key)
- Git test: Create a temporary repository, make a commit, and verify the log
- Python package test: Import key packages and verify they work (not just that they are installed)
- VS Code test: Use the VS Code CLI to open a file and verify the extension list
- Environment variable test: Verify that secrets are properly isolated in
.envfiles and not exposed in process listings
Each test should have a timeout, proper error handling, and clear pass/fail reporting.
Exercise 30: Environment Documentation Generator
Write a Python script that automatically generates a comprehensive Markdown document describing your development environment. The document should include:
- System Information: OS, architecture, processor, RAM, disk space
- Language Runtimes: Python version, Node.js version, with paths
- Package Managers: pip version, npm version, with lists of globally installed packages
- Development Tools: Git version and config, VS Code version and extensions, Claude Code version
- Project Environments: List of all virtual environments found, with their package lists
- Shell Configuration: Current shell, relevant aliases, PATH entries
- Security Checklist: Whether
.envfiles are gitignored, whether API keys are found in any tracked files
The output should be a well-formatted Markdown file that could be shared with a colleague setting up a similar environment (with sensitive information redacted).
Submission Guidelines
For Tier 1-2 exercises, write your answers in a text file or Markdown document.
For Tier 3 exercises, write detailed analyses with specific examples and evidence.
For Tier 4-5 exercises, submit working Python scripts with: - Complete docstrings for all modules, classes, and functions - Type hints for all function parameters and return values - PEP 8 formatting - Error handling for common failure cases - Comments explaining non-obvious logic
Test all scripts on your own machine before considering them complete.