Skip to content

Workflow-001: Explore-Plan-Code-Commit

Document Control

  • Workflow ID: 001
  • Version: 1.0
  • Status: Active
  • Complexity: Medium
  • Duration: 1-4 hours
  • Team Size: 1-2 developers

Overview

The Explore-Plan-Code-Commit workflow is the foundational development pattern for working with Claude Code. It emphasizes understanding before coding, planning before implementation, and verification before committing.

┌─────────────────────────────────────────────────────────────────────┐
│                    EXPLORE-PLAN-CODE-COMMIT FLOW                     │
├─────────────────────────────────────────────────────────────────────┤
│                                                                      │
│   [1] EXPLORE                [2] PLAN                              │
│   ┌──────────────┐           ┌──────────────┐                     │
│   │ Read Files   │           │ Think/Design │                     │
│   │ Understand   │ ────────► │ Architecture │                     │
│   │ Context      │           │ Approach     │                     │
│   └──────────────┘           └──────────────┘                     │
│          │                           │                              │
│          └─────────┬─────────────────┘                             │
│                    ▼                                                │
│   [3] CODE                   [4] COMMIT                            │
│   ┌──────────────┐           ┌──────────────┐                     │
│   │ Implement    │           │ Test & Fix   │                     │
│   │ Iterate      │ ────────► │ Git Commit   │                     │
│   │ Verify       │           │ PR if needed │                     │
│   └──────────────┘           └──────────────┘                     │
│                                      │                              │
│                                      ▼                              │
│                              [5] COMPLETE                           │
│                                                                      │
└─────────────────────────────────────────────────────────────────────┘

Prerequisites

Required SOPs

Environment Setup

  • Claude Code installed and configured
  • Git repository initialized
  • CLAUDE.md file present
  • Test framework available

Phase 1: EXPLORE

Objective

Understand the codebase, requirements, and constraints before making changes.

Steps

1.1 Context Gathering

bash
# Have Claude read key files without coding
claude-code "Read the main application files and explain the architecture"

# Specific exploration commands
claude-code "What does the authentication system do?"
claude-code "How is the database connected?"
claude-code "What testing framework is used?"

1.2 Requirement Analysis

bash
# Understand the task
claude-code "Explain the requirements for [feature/bug]"

# Identify dependencies
claude-code "What files will be affected by this change?"

# Check for existing patterns
claude-code "Show me similar implementations in this codebase"

1.3 Document Findings

bash
# Create exploration notes
claude-code "Summarize what you've learned about this codebase"

# Identify risks
claude-code "What are the potential risks of this implementation?"

Quality Gate 1: Understanding Verified

  • [ ] Claude has read all relevant files
  • [ ] Requirements are clearly understood
  • [ ] Dependencies identified
  • [ ] Risks documented

Phase 2: PLAN

Objective

Create a detailed implementation plan before writing code.

Steps

2.1 Engage Thinking Mode

bash
# Basic planning
claude-code "think: How should we implement [feature]?"

# Extended reasoning for complex tasks
claude-code "think hard: Design the architecture for [system]"

# Deep analysis for critical components
claude-code "think harder: Plan the migration strategy"

# Maximum reasoning (use sparingly)
claude-code "ultrathink: Solve this complex algorithmic problem"

2.2 Create Implementation Plan

bash
# Generate structured plan
claude-code "Create a step-by-step implementation plan for [feature]"

# Example output format:
"""
Implementation Plan: User Authentication System

1. Database Schema
   - Create users table
   - Add authentication fields
   - Set up indexes

2. API Endpoints
   - POST /auth/register
   - POST /auth/login
   - POST /auth/refresh
   - POST /auth/logout

3. Middleware
   - JWT validation
   - Role checking
   - Rate limiting

4. Testing
   - Unit tests for each endpoint
   - Integration tests
   - Security tests

5. Documentation
   - API documentation
   - Setup guide
   - Security notes
"""

2.3 Review and Refine

bash
# Get feedback on plan
claude-code "Review this plan and identify any gaps"

# Consider alternatives
claude-code "What are alternative approaches to this?"

# Estimate effort
claude-code "Estimate the time needed for each step"

Quality Gate 2: Plan Approved

  • [ ] Plan covers all requirements
  • [ ] Steps are clear and actionable
  • [ ] Risks have mitigation strategies
  • [ ] Time estimates are reasonable

Phase 3: CODE

Objective

Implement the planned solution with continuous verification.

Steps

3.1 Initial Implementation

bash
# Start coding based on plan
claude-code "Implement step 1 of our plan"

# Continue with next steps
claude-code "Now implement step 2"

# Request specific implementations
claude-code "Write the user registration endpoint with validation"

3.2 Iterative Development

bash
# Run and test as you go
claude-code "Run the tests and fix any issues"

# Refactor when needed
claude-code "Refactor this function for better readability"

# Add error handling
claude-code "Add comprehensive error handling to this module"

3.3 Code Review

bash
# Self-review with Claude
claude-code "Review the code we just wrote for bugs"

# Check best practices
claude-code "Does this follow the project's coding standards?"

# Security audit
claude-code "Check this code for security vulnerabilities"

Quality Gate 3: Code Complete

  • [ ] All planned features implemented
  • [ ] Tests are passing
  • [ ] Code follows project standards
  • [ ] No security vulnerabilities
  • [ ] Documentation updated

Phase 4: COMMIT

Objective

Finalize changes and commit to version control.

Steps

4.1 Final Testing

bash
# Run full test suite
claude-code "Run all tests and show results"

# Lint and format
claude-code "Run linting and fix any issues"

# Build verification
claude-code "Build the project and verify it works"

4.2 Prepare Commit

bash
# Review changes
claude-code "Show me all the changes we made"

# Create commit message
claude-code "Create a commit message for these changes"

# Stage and commit
claude-code "Stage all changes and commit with the message"

4.3 Create Pull Request (if needed)

bash
# Create feature branch
claude-code "Create a new branch for this feature"

# Push to remote
claude-code "Push this branch to origin"

# Create PR
claude-code "Create a pull request with a description of changes"

Quality Gate 4: Ready for Review

  • [ ] All tests pass
  • [ ] Code is committed
  • [ ] Commit message is descriptive
  • [ ] PR created (if applicable)
  • [ ] Documentation updated

Phase 5: COMPLETE

Final Checklist

  • [ ] Feature/fix works as expected
  • [ ] Tests provide adequate coverage
  • [ ] Documentation is updated
  • [ ] Code is reviewed
  • [ ] Changes are committed
  • [ ] Team is notified

Advanced Techniques

Parallel Exploration

bash
# Open multiple Claude instances
# Terminal 1: Explore frontend
claude-code "Analyze the React components"

# Terminal 2: Explore backend
claude-code "Analyze the API structure"

# Terminal 3: Explore database
claude-code "Analyze the database schema"

Checkpoint Strategy

bash
# Create checkpoints during development
git add -A && git commit -m "WIP: Checkpoint before refactoring"

# Use Claude to restore if needed
claude-code "We need to rollback to the last checkpoint"

Incremental Commits

bash
# Commit after each major step
claude-code "Commit just the database changes"
claude-code "Now commit the API changes"
claude-code "Finally commit the frontend changes"

Common Patterns

Pattern 1: Bug Fix Flow

1. Explore: "Find where this bug originates"
2. Plan: "think: How should we fix this bug?"
3. Code: "Fix the bug with minimal changes"
4. Commit: "Commit with 'fix: [description]'"

Pattern 2: Feature Addition

1. Explore: "Understand the current implementation"
2. Plan: "Create a plan for adding [feature]"
3. Code: "Implement the feature step by step"
4. Commit: "Commit with 'feat: [description]'"

Pattern 3: Refactoring

1. Explore: "Identify code that needs refactoring"
2. Plan: "Plan the refactoring without changing behavior"
3. Code: "Refactor while keeping tests passing"
4. Commit: "Commit with 'refactor: [description]'"

Troubleshooting

Issue: Claude loses context

bash
# Solution: Summarize and continue
claude-code "Here's what we've done so far: [summary]. Now continue with [next step]"

Issue: Plan too complex

bash
# Solution: Break into sub-plans
claude-code "Let's focus just on the authentication part first"

Issue: Tests failing after implementation

bash
# Solution: Incremental fixing
claude-code "Fix one test at a time, starting with the first failure"

Metrics

Success Metrics

  • First-time success rate: >70%
  • Time from explore to commit: <4 hours
  • Test coverage: >80%
  • Code review issues: ❤️ per PR

Performance Indicators

PhaseTarget DurationWarning Sign
Explore15-30 min>45 min
Plan15-30 min>45 min
Code30-120 min>3 hours
Commit10-20 min>30 min

Best Practices

  1. Always Explore First: Never skip the exploration phase
  2. Think Before Coding: Use think modes for complex problems
  3. Test Continuously: Run tests after each significant change
  4. Commit Atomically: One logical change per commit
  5. Document Decisions: Explain why, not just what

See Also


Next Workflow: Try Test-Driven Development for more structured development

Claude Code Documentation Hub