Coding: Autonomous Development
Goal: Accelerate the “Build” phase by treating AI not just as a typewriter, but as a junior developer that can handle multi-file refactoring, scaffolding, and documentation.
The Workflow
Section titled “The Workflow”graph TD
Spec[Technical Spec] -->|Task Breakdown| Planner[Planner Agent]
Planner -->|Task 1: API| Dev1[Back-End Agent]
Planner -->|Task 2: UI| Dev2[Front-End Agent]
Dev1 -->|Code PR| Reviewer[Reviewer Agent]
Dev2 -->|Code PR| Reviewer
Reviewer --x|Reject| Dev1
Reviewer -->|Approve| Merge[Merge to Main]
style Planner fill:#e1bee7
style Dev1 fill:#b2dfdb
style Dev2 fill:#b2dfdb
style Reviewer fill:#ffccbc
Tools Used
Section titled “Tools Used”- IDE extensions: GitHub Copilot, Cursor (best for “multi-file” edits).
- Agent Frameworks: Copilot Workspace, LangChain (custom agents).
- CLI Tools: Aider, Cody.
Step-by-Step Implementation
Section titled “Step-by-Step Implementation”- Prompt the Workspace: Instead of opening a file, open the Chat panel (e.g., in Cursor).
- Provide Context: Tag specific files (@Service.ts, @Interface.ts) or paste the Spec.
- Agentic Command: Give a high-level command: “Implement the VIP discount logic in the Service layer and expose an endpoint in the Controller.”
- Review the Plan: The agent will propose: “I will modify file X, create file Y.” Approve it.
- apply & Refine: The agent writes the code. You review the diff.
Example Scenario: Implementing the Discount Logic
Section titled “Example Scenario: Implementing the Discount Logic”Context: We have a key interface IDiscountStrategy.
1. Converting Spec to Tasks
Section titled “1. Converting Spec to Tasks”Prompt (in Cursor):
“@PRD.md @IDiscountStrategy.ts Implement a new strategy ‘VipDiscount’ that applies 5% off. Create a unit test for it.”
AI Action:
- Creates
VipDiscountStrategy.tsimplementing the interface. - Writes the math logic.
- Creates
VipDiscountStrategy.test.ts.
2. Generating API Documentation
Section titled “2. Generating API Documentation”Prompt:
“Generate Swagger/OpenAPI decorators for the new endpoint. Ensure error responses (400, 403) are documented.”
AI Output:
@Post('/apply')@ApiOperation({ summary: 'Apply VIP discount' })@ApiResponse({ status: 200, description: 'Discount applied' })@ApiResponse({ status: 400, description: 'Invalid cart' })async applyDiscount(@Body() cart: CartDto): Promise<CartDto> { ... }Human Review Checklist
Section titled “Human Review Checklist”When reviewing AI code, focus on:
- Security: Did it hardcode any secrets? (Common issue).
- Logic: Did it handle edge cases (e.g., negative cart values)?
- Style: Does it match the project’s linting rules?
Implementation Guidelines
Section titled “Implementation Guidelines”- Small Batches: Don’t ask for “The whole app.” Ask for “The Service Layer,” then “The Controller,” then “The Tests.”
- Context is Key: If you don’t use
@to reference other files, the AI will guess (hallucinate) imports. - Refactoring: Use AI to clean code: “Refactor this function to be more readable and split it into two sub-functions.”
Key Pitfalls
Section titled “Key Pitfalls”Key Takeaways
Section titled “Key Takeaways”- Read, Don’t Write: You will spend more time reading code than writing it.
- Architectural Control: You define the structure, the AI fills in the implementation.
- Docs for Free: generating JSDoc/Swagger is the highest ROI task for AI coding agents.