Chapter 2 - Basics
Master the essential workflows and key bindings that accelerate everyday AI-assisted development.
- Reading time: 15 minutes
- Practical time: 20-30 minutes
Reading
Briefs
- Understanding Session and Context
- Token Saving Strategies
- Claude Code: Key Bindings
- Copilot CLI: Key Bindings
Best Practices
Models per use case
Consider the model per use case
| Model | Strength | Switch with |
|---|---|---|
| Sonnet | Most coding tasks, good balance | /model or --model sonnet |
| Opus | Complex architectural decisions | /model or --model opus |
| Haiku | Fast, low-latency tasks | /model or --model haiku |
Memory
AI agents maintain conversation context across your session. This context accumulates as you work, eventually affecting performance and accuracy. Clearing context regularly ensures faster responses and prevents the agent from using stale information from earlier in your session.
Permissions
Agents request permission before executing certain actions like file edits, bash commands, or network requests. While this provides safety, it can interrupt workflow. In Claude Code, use a settings.json file to preconfigure trusted permissions. In Copilot CLI, permissions are passed as CLI attributes (e.g. --allow-tool='shell(git:*)') - there is no persistent permissions file. Both approaches reduce approval overhead while maintaining control over sensitive operations.
- Copilot CLI: Permissions - Controlling tool access and command execution
- Claude Code: Permissions - Permission modes and safety guardrails
Git Commit Management
⚠️ Important: Managing your own commits is important. For any changes you consider valuable, commit them before asking the agent tool to proceed with other changes.
Assets
Configuration files for permission management exercises:
- Download: 02-basics.tar.gz
⚠️ Important: Extract and overwrite the configuration files for your chosen tool (Claude Code or Copilot CLI). These assets contain tool-specific settings that should replace any existing configuration in your project.
Practical
Exercise 1: Context Management and Model Selection
Test how memory and model switching affect agent responses.
Prompt:
@cart.service.ts Explain what this service doesAfter getting the response:
- Switch models with
/model(or--model opusfor Copilot CLI) - Ask: "What did you just explain to me?"
- Close the session with
/clear - Ask again: "What did you just explain to me?"
What to observe:
- The agent remembers context within the same session
- After clearing, the agent has no memory of previous responses
- Different models provide varying levels of detail (Sonnet balances speed/quality, Opus provides deeper analysis)
Exercise 2: Permission-Based File Editing
Experience how agents request permission before modifying files.
Prompt:
Add a comment to the first line of cart.service.ts explaining its purposeAfter the agent makes the edit:
Show me the git diff for this changeWhat to observe:
- The agent requests permission before writing to files (unless permissions are pre-configured)
- Git integration allows you to review changes immediately
- You can approve/deny specific actions to maintain control over your codebase
Try again with different settings:
- Close your session
- Copy the configuration files from the Assets section to your working directory (based on whether you're using Claude Code or Copilot CLI)
- Repeat the exercise and observe how permission behavior changes with the new settings
Exercise 3: Mode Switching
Practice navigating between plan and agent modes.
- Press
Shift+Tabto enter Plan mode - Type a multi-step task (e.g., "Add logging to cart service")
- Press
Shift+Tabto return to Agent mode (or Default or Autopilot Mode) - Execute the plan
What to observe:
- Plan mode lets you outline work before execution
- Agent mode executes tasks directly
- You can switch modes mid-session based on task complexity
⚠️ Important: After completing all exercises, discard all changes.