Claude Code & CLI Tools

Agentic Features and Checkpoints

5 min read

Claude Code's agentic architecture lets it work autonomously on complex tasks. Checkpoints ensure you can always recover if something goes wrong.

Understanding Agentic Mode

In agentic mode, Claude Code can:

  • Break complex tasks into subtasks
  • Spawn subagents for parallel work
  • Execute commands and verify results
  • Self-correct based on errors
  • Continue until the task is complete

Extended Thinking

Claude Code automatically uses extended thinking for complex tasks. You can influence this by:

  • Using the --model flag to select a model that supports extended thinking
  • Providing detailed, complex prompts that benefit from deeper reasoning
  • Extended thinking is built-in — no manual configuration needed

Subagents

Claude Code can spawn specialized agents:

Main Task: "Refactor authentication system"
├── Subagent 1: Analyze current implementation
├── Subagent 2: Research best practices
├── Subagent 3: Create new schema
└── Subagent 4: Write migration tests

Example prompt:

Refactor the user authentication system:
- Analyze the current implementation in src/auth
- Research JWT best practices for 2026
- Create a new token-based system
- Write comprehensive tests
- Ensure backward compatibility

Use subagents for parallel research and implementation.

Checkpoints

Claude Code automatically creates checkpoints as you work, saving snapshots of your files and conversation so you can revert if something goes wrong.

How Checkpoints Work

Claude Code creates checkpoints automatically before making changes. Each checkpoint captures:

  • File state at that point
  • Conversation context

Reverting with /rewind

Use the /rewind command (or its alias /checkpoint) to go back to a previous state:

# In Claude Code session
/rewind

This shows you a list of checkpoints from your session. Select one to revert both your files and conversation to that point.

Git Integration

Checkpoints work alongside git. Claude Code uses git stash and commits under the hood, so your changes are always recoverable.

Practical Agentic Workflows

Workflow 1: Feature Implementation

Implement a notification system for our app:

1. Design the notification schema
2. Create database migrations
3. Build API endpoints (CRUD)
4. Add WebSocket support for real-time notifications
5. Create React components for the notification center
6. Write tests for all components
7. Update documentation

Execute step by step, creating checkpoints before major changes.

Claude will:

  • Create checkpoint "Before notification system"
  • Design schema and show for approval
  • Implement each step sequentially
  • Run tests to verify
  • Create intermediate checkpoints

Workflow 2: Bug Investigation

There's a memory leak in production. Investigate and fix:

1. Analyze error logs in logs/error.log
2. Profile memory usage in src/services
3. Identify the leak source
4. Propose fixes with minimal impact
5. Implement the fix
6. Add monitoring to prevent recurrence

Show your analysis at each step.

Claude will:

  • Read and analyze log files
  • Search codebase for memory patterns
  • Show findings before making changes
  • Implement fix with explanation
  • Add monitoring code

Workflow 3: Code Migration

Migrate from JavaScript to TypeScript:

Phase 1: Setup
- Add TypeScript configuration
- Install dependencies
- Create type definitions

Phase 2: Core Files (src/lib)
- Convert utility functions
- Add strict typing

Phase 3: Components (src/components)
- Convert React components
- Add prop types

Phase 4: API (src/api)
- Convert API routes
- Add request/response types

Create checkpoints between phases.

Background Tasks

You can background a running Claude Code task using Ctrl+B. This lets Claude continue working while you do other things.

Managing Background Tasks

# View running background tasks
/tasks

# Background current operation
# Press Ctrl+B while Claude is working

Background tasks continue running and you can check on their progress with /tasks.

Error Recovery

When Claude makes a mistake:

Option 1: Rewind to Checkpoint

/rewind

This shows previous checkpoints. Select one to restore both files and conversation.

Option 2: Git Reset (if committed)

git reset --soft HEAD~1

Option 3: Iterative Correction

That change broke the tests. Specifically:
- The user lookup fails because of the new schema
- Keep the new schema but fix the lookup query

Best Practices

1. Use Checkpoints for Safety

Claude Code creates checkpoints automatically. Use /rewind to go back if something goes wrong.

2. Use Extended Thinking for Complex Tasks

Extended thinking activates automatically for complex prompts. For architectural decisions, provide detailed context to trigger deeper reasoning.

3. Break Large Tasks Into Phases

Instead of:

"Rewrite the entire backend"

Use:

"Rewrite the authentication module. Stop after this phase for review."

4. Verify at Each Step

After each change, run the tests and show me any failures.

5. Keep Context Focused

# Clear conversation when starting new task
/clear

Cost Management

Agentic tasks can consume many tokens. Monitor usage:

# Check current session cost
/cost

This shows your token usage and estimated cost for the current session.

Agentic Insight: The power of Claude Code lies in trusting it with multi-step tasks while maintaining checkpoints for safety. Think of checkpoints as git commits for your AI session.

In the next lesson, we'll explore MCP integrations to connect Claude Code with external tools. :::

Quiz

Module 3: Claude Code & CLI Tools

Take Quiz
FREE WEEKLY NEWSLETTER

Stay on the Nerd Track

One email per week — courses, deep dives, tools, and AI experiments.

No spam. Unsubscribe anytime.