Lesson 23
Building Software with AI Assistance
AI-generated
- Use AI throughout the development lifecycle
- Know when AI helps most vs. when it slows you down
- Balance AI speed with code quality
- Build good review habits for AI-generated code
- Maintain your skills while using AI assistance
This lesson is for developers building software with AI assistance. We cover the full development lifecycle: planning, implementation, testing, documentation, and maintenance. Non-developers should skip to Unit 6.
The goal is not to maximize AI usage. It is to maximize your effectiveness. Sometimes that means using AI heavily. Sometimes it means coding yourself.
AI can assist at every stage. Knowing where it helps most guides effective use.
Planning Phase
AI assists with:
- Breaking down requirements into tasks
- Identifying technical approaches
- Estimating complexity
- Surfacing edge cases and considerations
Prompt: "I need to build a feature that lets users export their data as CSV. Ask me clarifying questions, then outline the implementation approach."
Implementation Phase
AI assists with:
- Writing initial implementations
- Generating boilerplate
- Implementing patterns you describe
- Solving specific technical problems
Prompt: "Write the export service. Handle large datasets with streaming to avoid memory issues. Use our existing file handling patterns."
Testing Phase
AI assists with:
- Generating test cases
- Writing test boilerplate
- Identifying edge cases
- Creating test data
Prompt: "Write unit tests for the export service. Cover: empty data, large datasets (1M+ rows), special characters in fields, date formatting, and permission checks."
Documentation Phase
AI assists with:
- Generating API documentation
- Writing code comments
- Creating README sections
- Producing user guides
Prompt: "Generate JSDoc comments for all public methods in this module. Base them on the actual implementation."
Maintenance Phase
AI assists with:
- Understanding unfamiliar code
- Debugging issues
- Refactoring for clarity
- Updating dependencies
Prompt: "This function is confusing. Explain what it does step by step, then suggest a clearer implementation that preserves behavior."
Not all tasks benefit equally from AI. Focus AI on high-leverage areas.
High AI Leverage
| Task | Why AI Helps |
|---|---|
| Boilerplate code | Repetitive, low creativity |
| Test generation | Covers many cases quickly |
| Documentation | Mechanical extraction from code |
| Code explanation | Reads and summarizes well |
| Pattern application | Applies known patterns consistently |
| Refactoring | Mechanical transformations |
| Bug investigation | Reads error traces, suggests causes |
Medium AI Leverage
| Task | Considerations |
|---|---|
| New features | Good first draft, needs review |
| API design | Suggest options, human decides |
| Performance optimization | May miss context-specific issues |
| Code review | Catches common issues, misses nuance |
Lower AI Leverage (Do It Yourself)
| Task | Why You Should Do It |
|---|---|
| Architecture decisions | Requires deep context and judgment |
| Security-critical code | Errors are costly; needs expert review |
| Novel algorithms | AI relies on existing patterns |
| Business logic | You understand requirements better |
| Integration points | System context matters |
AI assistance has costs. Recognize when it is not worth it.
The Explanation Overhead
If explaining the task to AI takes longer than doing it, skip AI. This often applies to:
- Small changes (one-line fixes)
- Highly context-dependent code
- Quick experiments
- Things you know by heart
The Review Overhead
AI-generated code needs review. For complex logic, reviewing AI code can take as long as writing it yourself. Consider:
- Will I trust this without thorough review?
- Is the review overhead worth the time saved?
The Skill Erosion Risk
Over-relying on AI can erode your skills. Balance:
- Use AI for productivity on familiar patterns
- Code yourself when learning new concepts
- Periodically write code without AI to stay sharp
The Debug Trap
Debugging AI code you do not understand is frustrating. If you cannot explain why the code works, you will struggle when it breaks.
Every piece of AI-generated code needs review. Here is a practical checklist:
Quick Scan (All AI Code)
- [ ] Does it do what I asked?
- [ ] Any obvious errors or typos?
- [ ] Files changed match expected scope?
- [ ] No unexpected dependencies added?
Standard Review (Most AI Code)
- [ ] Logic is correct and complete
- [ ] Error handling present and appropriate
- [ ] Edge cases handled
- [ ] No hardcoded values that should be configurable
- [ ] Follows project conventions
- [ ] Tests pass (run them!)
Deep Review (Security/Critical Code)
- [ ] Input validation present
- [ ] No SQL injection, XSS, or other vulnerabilities
- [ ] Authentication/authorization correct
- [ ] Secrets not exposed
- [ ] Data validation at boundaries
- [ ] Consider: Would I sign off on this in production?
The "Explain It" Test
If you cannot explain why a piece of AI code works, do not ship it. Either:
- Ask AI to explain it until you understand
- Rewrite it yourself
- Get a colleague to review
- AI helps throughout the lifecycle: Planning, implementing, testing, documenting, maintaining
- Focus on high leverage: Boilerplate, tests, docs, explanations
- Know when to skip AI: Small changes, novel logic, when explanation overhead exceeds benefit
- Always review: Use the checklist; never blindly trust AI output
- Maintain your skills: Code without AI periodically; understand what you ship
Build something small but complete with AI assistance:
- Choose a mini-project:
- A CLI tool that does something useful - A simple API endpoint with validation - A React component with tests
- Use AI at each phase:
- Planning: "Help me break this down" - Implementation: "Write the core logic" - Testing: "Generate test cases" - Documentation: "Write the README"
- Track your experience:
- How long did each phase take? - Where did AI help most? - What did you still have to do yourself? - What would have taken longest without AI?
This exercise gives you real data on where AI fits in your workflow.
- Studies on AI coding productivity: https://www.nber.org/papers/w31161
- Security research on AI code: https://arxiv.org/abs/2211.03622
- Developer experience with AI tools: https://dl.acm.org/doi/10.1145/3544548.3580969