Chapter 1: What Is Vibe Coding?
- 1.1 The Shift from Syntax-First to Intent-First Programming
- 1.2 How AI Coding Agents Actually Work
- 1.3 Where Vibe Coding Fits — and Where It Doesn’t
- 1.4 Setting Realistic Expectations: Speed vs. Responsibility
- 1.5 A Tour of the AI Coding Tool Landscape (and Why OpenCode)
- 1.6 Chapter Summary
- 1.7 Exercises
- 1.8 What’s Next
Chapter 2: Setting Up OpenCode
- 2.1 Prerequisites
- 2.2 Installing OpenCode
- 2.3 Connecting Your First LLM Provider
- 2.4 Tour of the TUI: Panels, Modes, and Keybinds
- 2.5 Your First Session: Asking a Question
- 2.6 Troubleshooting the Basics
- 2.7 Chapter Summary
- 2.8 Exercises
- 2.9 What’s Next
Chapter 3: Your First Vibe Coding Session
- 3.1 The Vibe Coding Cycle
- 3.2 Setting Up a Practice Project
- 3.3 Your First Change: A Small, Well-Specified Prompt
- 3.4 Reading Diffs Like a Reviewer
- 3.5 Verification: Trust Nothing, Check Everything
- 3.6 Undo: Your Superpower
- 3.7 Context in Practice:
@, Images, and Conversation History - 3.8 Common Beginner Mistakes (That You Can Now Avoid)
- 3.9 Capstone for Part I: A Complete Cycle
- 3.10 Chapter Summary
- 3.11 Exercises
- 3.12 What’s Next — And a Milestone
Chapter 4: The Art of the Prompt
- 4.1 Talking to OpenCode Like a Junior Developer
- 4.2 Context Is King: Files, Examples, and Screenshots
- 4.3 Vague vs. Precise — Side-by-Side Examples
- 4.4 Iterating: Multi-Turn Refinement Instead of One Big Prompt
- 4.5 Common Beginner Mistakes and How to Fix Them
- 4.6 Prompting Patterns Worth Memorizing
- 4.7 Chapter Summary
- 4.8 Exercises
- 4.9 What’s Next
Chapter 5: Plan Mode vs. Build Mode
- 5.1 Why Two Modes Exist
- 5.2 When to Plan, When to Build
- 5.3 Writing Feature Requests That Produce Good Plans
- 5.4 Reviewing a Plan Like an Architect
- 5.5 From Plan to Implementation: The Handoff
- 5.6 Workflows: Four Patterns for Real Situations
- 5.7 Anti-Patterns (And the Fix for Each)
- 5.8 Chapter Summary
- 5.9 Exercises
- 5.10 What’s Next — Part II Begins
Chapter 6: Building Features End-to-End
- 6.1 The Feature Delivery Pipeline
- 6.2 Scaffolding: Models, Routes, UI, Tests
- 6.3 Filling In: Vertical Slices That Work End-to-End
- 6.4 Working with an Unfamiliar Codebase
- 6.5 Refactoring Safely
- 6.6 Debugging: Reproduce, Isolate, Fix
- 6.7 Capstone: The Full Pipeline
- 6.8 Chapter Summary
- 6.9 Exercises
- 6.10 What’s Next
Chapter 7: Testing and Verification
- 7.1 Why Testing Is Non-Negotiable in Vibe Coding
- 7.2 Test-First with an AI Agent
- 7.3 Getting Good Tests from the Agent (and Spotting Bad Ones)
- 7.4 Edge Cases: The Systematic Hunt
- 7.5 The Full Verification Stack
- 7.6 Test Maintenance: Keeping the Net Strong
- 7.7 Capstone: Verification in the Wild
- 7.8 Chapter Summary
- 7.9 Exercises
- 7.10 What’s Next
Chapter 8: Git Workflows with an AI Agent
- 8.1 The Safety Model, Revisited
- 8.2 Commit Hygiene When AI Writes the Code
- 8.3 Staging and Reviewing AI Diffs at the Git Level
- 8.4 Branching for Parallel and Experimental Sessions
- 8.5 Recovery Patterns
- 8.6 Automating Git Hygiene
- 8.7 A Reference Workflow
- 8.8 Chapter Summary
- 8.9 Exercises
- 8.10 What’s Next
Chapter 9: Project Memory — AGENTS.md and Rules
- 9.1 The Rule of Threes: What Belongs in Project Memory
- 9.2 Anatomy of a Great AGENTS.md
- 9.3 Writing Rules That Actually Change Behavior
- 9.4 Global vs. Project Rules
- 9.5 Documenting Conventions: The High-Value Sections
- 9.6 Keeping Memory Alive: Maintenance Discipline
- 9.7 Team Adoption: Sharing Memory Without Chaos
- 9.8 Capstone: Build a Real AGENTS.md
- 9.9 Chapter Summary
- 9.10 Exercises
- 9.11 What’s Next
Chapter 10: Custom Commands and Reusable Prompts
- 10.1 Why Commands Beat Retyping
- 10.2 How Custom Commands Work
- 10.3 What to Encode: The Command Design Criteria
- 10.4 A Starter Library
- 10.5 Writing Good Command Templates
- 10.6 Sharing Commands with a Team
- 10.7 Capstone: Build Your Command Library
- 10.8 Chapter Summary
- 10.9 Exercises
- 10.10 What’s Next — Part II Complete
Chapter 11: Choosing and Tuning Models
- 11.1 How Models Actually Differ
- 11.2 Routing Tasks to the Right Model
- 11.3 Configuring Multiple Providers
- 11.4 Cost Management and Monitoring
- 11.5 Matching Model to Task: Worked Examples
- 11.6 When Not to Use the Biggest Model
- 11.7 Capstone: Build Your Routing Setup
- 11.8 Chapter Summary
- 11.9 Exercises
- 11.10 What’s Next
Chapter 12: OpenCode Configuration Deep Dive
- 12.1 The Configuration Surface at a Glance
- 12.2 Themes, Keybinds, and Ergonomics
- 12.3 Formatters and LSP: Making the Agent Smarter and Cleaner
- 12.4 Permissions: Controlling What the Agent Can Do
- 12.5 Policies: Organizational Guardrails
- 12.6 Bringing It Together: A Reference Configuration
- 12.7 The Division of Labor: Config vs. Memory vs. Prompt
- 12.8 Capstone: Configure Your Environment
- 12.9 Chapter Summary
- 12.10 Exercises
- 12.11 What’s Next
Chapter 13: Extending OpenCode with MCP
- 13.1 What MCP Is and Why It Matters
- 13.2 Adding Your First MCP Server
- 13.3 Practical Recipes
- 13.4 Custom Tools and Servers for Your Stack
- 13.5 Debugging MCP Connections
- 13.6 Chapter Summary
- 13.7 Exercises
- 13.8 What’s Next
Chapter 14: Agent Skills and Subagents
- 14.1 Why Structure Beats a Single Agent
- 14.2 Skills: Packaged Domain Expertise
- 14.3 Subagents: Specialized Helpers and Delegation
- 14.4 Combining Skills and Subagents
- 14.5 When Not to Add Structure
- 14.6 Capstone: Build a Small Team
- 14.7 Chapter Summary
- 14.8 Exercises
- 14.9 What’s Next
Chapter 15: Headless and Automation
- 15.1 The Automation Ladder
- 15.2 Headless and CLI Modes
- 15.3 The SDK and Server Mode
- 15.4 Plugins: Extending the Agent Itself
- 15.5 Agents in CI/CD
- 15.6 Chapter Summary
- 15.7 Exercises
- 15.8 What’s Next
Chapter 16: Collaboration and Sharing
- 16.1 The Conversation as a Shareable Artifact
- 16.2 GitHub and GitLab Integrations
- 16.3 IDE, Web, and TUI: Working Where You’re Comfortable
- 16.4 Pairing With Teammates in an AI Workflow
- 16.5 Review Etiquette When AI Wrote the First Draft
- 16.6 Capstone: Team-Ready Setup
- 16.7 Chapter Summary
- 16.8 Exercises
- 16.9 What’s Next — Part III Complete
Chapter 17: Architecture and Prompt Strategy
- 17.1 Why Architecture Is a Prompt-Strategy Concern
- 17.2 Designing Systems an AI Can Extend Safely
- 17.3 Spec-Driven Development: Write the Spec, Then Vibe
- 17.4 Context Window Management on Large Codebases
- 17.5 Knowing What Never to Delegate
- 17.6 Prompting for Architecture
- 17.7 Capstone: Audit and Harden an Architecture
- 17.8 Chapter Summary
- 17.9 Exercises
- 17.10 What’s Next
Chapter 19: Security, Privacy, and Responsible Vibe Coding
- 19.1 The Core Security Shift
- 19.2 Secrets, Keys, and the Context Trap
- 19.3 Prompt Injection and Untrusted Input
- 19.4 Reviewing AI-Generated Code for Vulnerabilities
- 19.5 Intellectual Property, Licensing, and Disclosure
- 19.6 Enterprise and Compliance Reality
- 19.7 Capstone: Security-Harden a Project
- 19.8 Chapter Summary
- 19.9 Exercises
- 19.10 What’s Next
Chapter title
Chapter 20: Performance and Cost Optimization
- 20.1 What to Measure (And What Not To)
- 20.2 Measuring Vibe-Coding Velocity
- 20.3 Reducing Token Spend Without Losing Quality
- 20.4 When Slow-and-Thorough Beats Fast-and-Loose
- 20.5 Capstone: Build Your Dashboard and Tune
- 20.6 Chapter Summary
- 20.7 Exercises
- 20.8 What’s Next
Chapter 21: From Solo Projects to Production Teams
- 21.1 What Changes When You’re No Longer Alone
- 21.2 The Shared Handbook: AGENTS.md at Team Scale
- 21.3 Shared Standards: Commands, Conventions, Consistency
- 21.4 Onboarding as a First-Class Concern
- 21.5 Review, Governance, and Trust at Scale
- 21.6 Capstone: Make a Solo Project Team-Ready
- 21.7 Chapter Summary
- 21.8 Exercises
- 21.9 What’s Next
Chapter 22: Capstone — Building a Real Product End-to-End
- 22.1 The Project and the Ground Rules
- 22.2 Stage 1 — Spec: From Idea to Clear Intent
- 22.3 Stage 2 — Architecture: Decisions Before Code
- 22.4 Stage 3 — Scaffold & the First Vertical Slice
- 22.5 Stage 4 — Build in Verified Slices
- 22.6 Stage 5 — Secure, Harden, Optimize
- 22.7 Stage 6 — CI/CD and the Automated Gates
- 22.8 Stage 7 — Launch, Learn, and Retrospect
- 22.9 The Whole Practice, in One Table
- 22.10 Chapter Summary
- 22.11 Exercises
- 22.12 Closing — The Durable Practice
Appendix B: AGENTS.md Templates and Rules Library
- B.1 Locations and Precedence
- B.2 Full AGENTS.md Template
- B.3 Rule Blocks Library
- B.4 External File References
- B.5 A Worked Example (Condensed)
Appendix B: AGENTS.md Templates and Rules Library
- B.1 Locations and Precedence
- B.2 Full AGENTS.md Template
- B.3 Rule Blocks Library
- B.4 External File References
- B.5 A Worked Example (Condensed)
Appendix C: The Prompt Pattern Library
- C.1 Context and Clarity
- C.2 Planning
- C.3 Building
- C.4 Verification
- C.5 Debugging
- C.6 Explanation and Learning
- C.7 Safety and Hygiene
- C.8 Meta-Patterns
- C.9 Anti-Patterns to Avoid
- C.10 The One Rule Behind Them All
Appendix D: Configuration and Permissions Cookbook
- D.1 Config Files and Locations
- D.2 A Complete Starter Config
- D.3 Models and Providers
- D.4 Permissions (Chapter 12)
- D.5 Permissions in Markdown Agents
- D.6 Agents Config
- D.7 Commands Config
- D.8 TUI Config (
tui.json) - D.9 Other Useful Options
- D.10 Variable Substitution
- D.11 Security-First Config Preset (Ch. 12, 19)
Appendix E: MCP and Integration Cookbook
- E.1 Enabling a Server
- E.2 Local Server
- E.3 Remote Server
- E.4 OAuth
- E.5 Managing Which Servers Are Active (Chapter 11, 13)
- E.6 Worked Examples
- E.7 Managing Servers via CLI
- E.8 MCP Security Checklist (Chapter 19)
Appendix F: Troubleshooting, FAQ, and Where to Go Next
- F.1 Where OpenCode Stores Things
- F.2 Common Issues (from the docs)
- F.3 The Book’s Disciplines as a Debugging Checklist
- F.4 Frequently Asked Questions
- F.5 Getting Help
- F.6 Where to Go Next
- F.7 A Closing Note