Chapter 31
31 / 38

Task Implementation Methodology

⏱️ 10 min

Why Have a Methodology?

When you're collaborating with AI on complex tasks, a methodology:

  • Prevents you from missing critical steps
  • Improves code quality
  • Reduces rework
  • Makes outcomes predictable

Process

1. Think Through Strategy

Before writing any code, get clear on:

  • Understand the complete requirement
  • Identify key components needed
  • Consider dependencies and constraints
  • Plan the implementation approach

2. Evaluate Approaches

List possible approaches and compare:

  • List possible implementation strategies
  • Compare pros and cons of each
  • Consider:
    • Performance implications
    • Maintainability
    • Scalability
    • Code reusability
    • Testing complexity

3. Consider Tradeoffs

Every decision has tradeoffs:

  • Short-term vs long-term benefits
  • Complexity vs simplicity
  • Performance vs readability
  • Flexibility vs focused solution
  • Time to implement vs perfect solution

4. Implementation Steps

Follow this order during execution:

  1. Break down into subtasks
  2. Start with core functionality
  3. Implement incrementally
  4. Test each component
  5. Integrate components
  6. Add error handling
  7. Optimize if needed
  8. Document decisions

5. Best Practices

  • Write tests first (TDD approach)
  • Keep functions small and focused
  • Use meaningful names
  • Comment complex logic
  • Handle edge cases
  • Consider future maintenance

Checklist

Before calling a task done, verify:

  • Requirements fully understood
  • Approach documented
  • Tests written
  • Code implemented
  • Edge cases handled
  • Documentation updated
  • Code reviewed
  • Performance acceptable

Working with AI in Practice

Tell AI Your Methodology

I need to implement user authentication. Follow these steps:

1. Analyze requirements, list key components
2. Evaluate JWT vs Session approaches
3. After picking an approach, implement step by step
4. Test after each step
5. Integrate and add error handling last

Have AI Generate a Task List

Analyze this feature requirement and generate an implementation checklist,
including subtasks, dependencies, and test points.

Incremental Implementation

Implement core functionality first: user login.
Don't worry about password reset, OAuth, etc.
We'll add those later.

1. Understand Requirements

Need to implement:
- Keyword search
- Pagination support
- Result highlighting
- Search suggestions

2. Analyze Approaches

Approach A: Database LIKE queries
  + Simple
  - Poor performance
  - Can't highlight

Approach B: Elasticsearch
  + Great performance
  + Full feature set
  - Extra dependency

3. Implement Step by Step

Step 1: Build basic search API
Step 2: Add pagination
Step 3: Integrate Elasticsearch
Step 4: Implement highlighting
Step 5: Add search suggestions

Task Template

## Task: [Task Name]

### 1. Requirements

-   [ ] [Requirement 1]
-   [ ] [Requirement 2]

### 2. Approach

Chosen approach: [approach name]
Reason: [rationale]

### 3. Subtasks

-   [ ] [Subtask 1]
-   [ ] [Subtask 2]
-   [ ] [Subtask 3]

### 4. Testing

-   [ ] Unit tests
-   [ ] Integration tests
-   [ ] Edge cases

### 5. Documentation

-   [ ] Code comments
-   [ ] API docs
-   [ ] README update

Summary

A methodology isn't about limiting creativity -- it's about ensuring quality. When you work with AI, a clear methodology helps AI understand your expectations and produce higher-quality code.

📚 Related resources

Common questions

Open a question to review the practical answer.

Why preach methodology — why not just let AI write the code?

Because AI does not make the trade-offs for you. If you do not spell out "performance vs readability" or "short-term vs long-term", it defaults to the most common pattern and breaks under your constraints. The chapter's 5-step method (Strategy → Approach → Tradeoffs → Implementation → Best Practices) exists to externalise the judgment, so AI can align precisely.

Can I skip any of the 8 implementation steps in Step 4?

The order is not negotiable. The chapter's 8 steps: subtasks → core functionality → incremental build → per-component tests → integration → error handling → optimisation → docs. Common trap is optimising (step 7) before adding error handling (step 6) — you refactor and leak cases at the same time. Error handling after tests pass and before optimisation hits the best ROI.

In the search-feature example, how do I choose between approach A and B?

The chapter's comparison: Approach A (DB LIKE) — simple but slow and no highlighting; Approach B (Elasticsearch) — fast and full-featured but adds a dependency. Decide on data volume + team capability: under 10K rows go A, over 100K go B; no one on the team has run ES in prod, ship A first and migrate to B later — do not lead with the heavy stack.

Does TDD actually work well with AI?

Yes — and the leverage is higher than hand-coding. Flow: you write the tests, AI writes the implementation to pass them, you review. AI freelancing on code drifts; tests as acceptance criteria pin the output to "these cases must pass". The chapter's first Best Practice is Write tests first — paired with the Vibe Coding loop, this has the highest ROI.

Of the 8 checklist items, which one gets skipped the most?

Edge cases handled — item 5. The checklist order is Requirements → Approach → Tests → Code → Edge cases → Docs → Review → Performance. Beginners usually ship right after Code and skip Edge cases; typical misses: empty arrays, null input, oversized payloads, concurrent requests. Ask AI to list "5 most likely failure boundaries" — beats brainstorming them solo.