Core Concept: Divide and Conquer
The core idea of Agentic Coding Workflow is to split large code changes into a series of small, independent, reviewable units. This method draws on the long-standing "small steps" concept in software engineering but is specifically optimized for the characteristics of AI-generated code.
Three Key Principles
Plan Before Coding: Before writing any code, create a detailed task breakdown plan. Clarify the boundaries, input/output, and acceptance criteria for each small task.
Single Task per Branch: Each small task is completed on an independent branch to maintain focus. This not only facilitates rollback but also allows reviewers to examine each task one by one.
Branch Stack Organization: New task branches are created based on the previous task's branch, forming a clear dependency chain. Finally, integrate into the main branch via stacked commits or batch merging.
Workflow Details
Phase 1: Task Planning
Before starting coding, use tools to generate a FEATURE_PLAN.md document, breaking down the entire feature into atomic tasks. Each task should meet:
- Can be coded within 30 minutes
- Has clear input/output definitions
- Does not depend on unimplemented subsequent tasks
- Can be independently tested and verified
Phase 2: Branch Development
Create an independent branch for each task, following the feature/task-name naming convention. During development:
- Keep the commit history clear, with each commit corresponding to a logical step
- Complete unit tests within the branch to ensure task quality
- Initiate a code review request immediately after the task is completed
Phase 3: Stacked Integration
When multiple related tasks pass review, integrate them in a stacked way:
- Merge the first task branch directly into the main branch
- Rebase subsequent task branches based on the merged code
- Merge in sequence to maintain a linear history
This approach avoids "big bang" merges, making each merge a low-risk small-step operation.