Skip to content

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.

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
  • IDE extensions: GitHub Copilot, Cursor (best for “multi-file” edits).
  • Agent Frameworks: Copilot Workspace, LangChain (custom agents).
  • CLI Tools: Aider, Cody.
  1. Prompt the Workspace: Instead of opening a file, open the Chat panel (e.g., in Cursor).
  2. Provide Context: Tag specific files (@Service.ts, @Interface.ts) or paste the Spec.
  3. Agentic Command: Give a high-level command: “Implement the VIP discount logic in the Service layer and expose an endpoint in the Controller.”
  4. Review the Plan: The agent will propose: “I will modify file X, create file Y.” Approve it.
  5. 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.

Prompt (in Cursor):

“@PRD.md @IDiscountStrategy.ts Implement a new strategy ‘VipDiscount’ that applies 5% off. Create a unit test for it.”

AI Action:

  1. Creates VipDiscountStrategy.ts implementing the interface.
  2. Writes the math logic.
  3. Creates VipDiscountStrategy.test.ts.

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> { ... }

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?
  • 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.”
  1. Read, Don’t Write: You will spend more time reading code than writing it.
  2. Architectural Control: You define the structure, the AI fills in the implementation.
  3. Docs for Free: generating JSDoc/Swagger is the highest ROI task for AI coding agents.