Lesson 6.1: Communicating with Coding Agents: Inspect, Plan, and Scope
Lesson Quick-Jump (10 Sections)
1. What Are We Learning?
In this lesson, you will learn how to:
- Communicate clearly with AI coding agents using contextual prompting.
- Enforce the "Inspect Before Modifying" rule so agents read your existing code first.
- Ask the agent to write a feature implementation plan before editing files.
- Give agents well-scoped tasks with clear boundaries.
2. Why Does It Matter?
This is the moment where most beginners accidentally ruin their projects. They open an AI coding agent and type: "Add login and let users save habits and also make it look nice."
Without inspecting your existing files, without agreeing on a plan, and without boundaries, the agent guesses file names, overwrites working code, invents duplicate helpers, and changes architecture you already settled in Phase 4. When you require Inspect -> Plan -> Scope -> Implement, you stay in complete control.
3. Simple Explanation for a Complete Beginner
Imagine hiring an experienced contractor to remodel your bathroom:
- You do not hand them a sledgehammer and say "Surprise me!"
- Instead:
- Context: Show them the house blueprints (
docs/prd.md,docs/architecture.md). - Inspect first: Have them check where the existing pipes and walls actually are before cutting anything.
- Plan: Have them tell you which 3 files/walls they plan to touch and why.
- Scope & Boundaries: Agree they are only fixing the sink today—not tearing out the kitchen.
- Context: Show them the house blueprints (
In AI coding, this exact workflow prevents 90% of broken edits.
4. Practical Example
Compare a generic prompt vs. a contextual engineering prompt for Task 2.1 (Add habit creation API):
Generic Prompt (Weak):
"Make an API to add habits."
Contextual Engineering Prompt (Strong):
"Read
docs/prd.md,docs/architecture.md, and inspect the existing files undersrc/.Objective: Implement Task 2.1 from
docs/development-plan.md: create the database model and backend endpoint to list and create habits. Boundaries:
- Only modify files needed for the habit model and API endpoint. Do NOT build frontend UI or authentication yet.
- Follow our agreed folder layout in
docs/architecture.md. Process:
- First inspect existing files and present a short implementation plan (files to create/edit, data fields, validation rules, and how we will test it).
- Wait for my approval before editing any files."
Look how clean that is: you review the plan in 30 seconds before a single line of code is modified!
5. Step-by-Step Instructions
- Pick ONE small task from your
docs/development-plan.md(never three tasks at once). - Start a clean agent session (or clear stale context) whenever switching to a new task so old errors don't confuse the agent.
- Send an "Inspect & Plan Only" prompt pointing the agent to your
docs/files and asking it to read relevant code first. - Read the agent's proposed plan carefully:
- Are the files it wants to change in the right folders?
- Is it touching unrelated files?
- Are edge cases (like empty input) handled?
- Approve or adjust the plan ("Good, except keep validation in
src/services/and don't touch the CSS file. Now implement Step 1.").
6. Ready-to-Use AI Prompt
Use this two-step pattern (see more in prompts/03-implementation-prompts.md):
Context:
We are working on Task [number/name] from `docs/development-plan.md`.
Relevant docs: `docs/prd.md` and `docs/architecture.md`.
Objective:
Inspect the current codebase and propose a focused implementation plan for ONLY this task.
Boundaries:
- Do NOT edit or create any code files yet.
- Do NOT change unrelated files, styling, or overall architecture.
- Only plan what is required by the Acceptance Criteria for this single task.
Expected Output:
1. Summary of the relevant existing files you inspected.
2. Exact list of files you plan to create or modify and why.
3. Data/API/UI changes and edge cases handled.
4. Exact verification commands or manual steps we will run after editing.
7. What to Expect from the AI Agent
| Good Response | Warning Sign |
|---|---|
| The agent reads your actual files (you see tool calls or references to real file paths in your repo), summarizes how your project is currently structured, and gives a tight 4–6 bullet plan without touching code yet. | The agent ignores your "do not edit yet" boundary and starts rewriting files immediately, OR guesses file paths without reading the directory. Stop it, revert any unwanted edits with Git, and restate: "Inspect existing files first and propose a plan only." |
8. What You Must Personally Verify
- Did the agent actually read the relevant files? Check that the file paths and variable names in its plan match what is really in your folder.
- Is the scope tight? If the plan mentions refactoring unrelated files or adding unrequested packages, say "Drop those changes—stay strictly on this task."
- Are verification steps concrete? The plan should say exactly what command or browser check proves the task works.
9. Common Mistakes
- Never asking for a plan first: Skipping planning saves 20 seconds and costs 40 minutes undoing tangled code changes.
- Keeping one giant chat forever: After 30–50 back-and-forth messages, AI agents lose track of earlier rules. Start a fresh chat per feature/task, grounded in your
docs/. - Giving vague approval like "looks fine": If something in the plan sounds confusing (e.g., "Why are we adding a new library?"), ask before it writes the code.
10. Small Practical Exercise
- Open your starter project from Phase 5.
- Pick the very first feature task from your
docs/development-plan.md. - Run the Inspect & Plan Only prompt above (you can also use templates/feature-plan-template.md to save the plan).
- Review the agent's plan and ask one clarifying question about why it chose a specific file or approach before giving it permission to implement.
Completed the exercise? Track your progress
Check off this lesson in PROGRESS-CHECKLIST.md once you have verified every step in Section 8.