AI Development Workflow

Specification-Driven Approach for Reliable AI Code Generation

💡 Pro Tips for AI Development

🎯
Game Changer of the Week
Ask Claude to ask YOU questions! This reveals blind spots in your specifications and ensures comprehensive planning.
📝
Specification First
Never start coding without a complete spec. Time spent planning saves 10x debugging time.
🔄
Fresh Context
After 2-3 failed debug attempts, start a new chat with fresh context rather than continuing.
🏗️
Architecture Matters
Use o3 for system design decisions - it often suggests patterns you haven't considered.
1

Specification & Context Gathering

🔧 Augment
📝 PM Role (Marty Cagan)
🔍 Code Indexing
1.1 Code Context Analysis
Use Augment to index existing codebase and understand patterns, dependencies, and architecture
1.2 PM Specification Writing
Acting as a Technical PM, create comprehensive specifications using the template below
1.3 Define Validation Criteria
Set up multi-dimensional validation metrics with weighted priorities
2

Multi-Agent Planning & Architecture

⚡ Critical Phase - Most Time-Consuming Human Investment

Getting the plan right upfront prevents architectural debt and painful refactoring later. Use multiple AI agents to validate decisions.

🤖 Claude Opus 4 (Plan Mode)
🧠 ChatGPT o3 (Architecture)
✨ Gemini MCP (Validation)
📁 Documentation
Multi-Agent Planning Process
1
Opus in Plan Mode: Create initial plan in Claude Code using Opus 4
2
Architecture Review: Use ChatGPT o3 for architectural decisions (superior for system design)
3
Iterate & Refine: Opus ↔ Independent Agent validation loop
4
Document Plan: Write finalized plan to docs folder for reference
2.1 Initial Planning with Opus
Use Claude Code with Opus 4 in Plan Mode to analyze specifications and create implementation strategy
2.2 Architectural Validation
ChatGPT o3 reviews architectural choices (e.g., database patterns, pubsub systems, API design)
2.3 Cross-Agent Verification
Gemini MCP validates the plan, identifies edge cases, and breaks down into atomic tasks
2.4 Plan Documentation
Finalized plan written to docs folder - becomes source of truth for implementation

Real-World Example: PostgreSQL PubSub

ChatGPT o3 suggested using PostgreSQL PubSub for notifications - a solution that Opus might not have proposed. This architectural insight proved valuable but required investigation. Always validate architectural decisions with multiple agents!

3

Implementation & Agent Execution

💻 Opus 4 (Coding Mode)
🚀 Claude Code
💎 Specialized Agents
🔄 Iterative Refinement
3.1 Switch to Coding Mode
Transition Opus from Plan Mode to Coding Mode with documented plan as context
3.2 Deploy Specialized Agents
Claude Code deploys agents for each task with specific context and constraints from the plan
3.3 Parallel Execution
Agents work on independent tasks simultaneously, following specifications exactly
3.4 Continuous Validation
Check compliance using multi-dimensional criteria (>90% score required)

⚠️ Debugging Decay Warning

AI effectiveness degrades rapidly when fixing bugs across multiple attempts:

After 1 attempt
50% worse
After 3 attempts
80% worse
After 7 attempts
99% worse

Solution: Get it right the first time through proper planning. If debugging fails after 2-3 attempts, return to planning phase with fresh context.

Security
25%
Functionality
20%
Structure
15%
Performance
15%
Documentation
15%
Testing
10%
4

Integration & Quality Assurance

🔗 Integration Testing
📈 Performance Monitoring
🔄 Limited Debugging
📋 Plan Revision
4.1 Component Integration
Merge agent outputs, resolve conflicts, and ensure cohesive implementation
4.2 Compliance Verification
Run final validation against all criteria, iterate if below 90% threshold
4.3 Limited Debug Attempts
If bugs found, limit to 2-3 fix attempts before returning to planning phase
4.4 Production Deployment
Deploy to production with monitoring and feedback loops for future iterations

Remember: Planning Investment Pays Off

The most time-consuming human investment is in the planning phase, but it's worth it. Architectural decisions based on first hunches lead to pain down the line. Use multiple agents, document thoroughly, and resist the urge to skip planning steps.

Pro Tip: Claude.md Integration

Store your PM specification template and project patterns in a claude.md file at your project root. This provides consistent context for all AI interactions and ensures specifications follow your team's standards. Include your architectural decisions and patterns learned from o3 or other agents.

📋 PM Specification Template

SPECIFICATION-FIRST APPROACH

Artifact Type: [API | UI Component | Database Schema | CLI Tool | Background Job | Web Page | Library] Summary: [One-line description of what needs to be built] Domain Context: [e.g., user management, e-commerce, data processing] Architectural Decisions: [Document key decisions validated by multiple agents]

DETAILED REQUIREMENTS

Core Functionality: - [Primary purpose and behavior] - [Key features with acceptance criteria] - [Business rules and constraints] Technical Specification: - [Input/output contracts] - [Data models and schemas] - [Integration points and dependencies] - [Performance requirements] Architectural Patterns: - [Patterns validated by o3 or other architecture-focused agents] - [Database design decisions] - [Communication patterns (e.g., PubSub, REST, GraphQL)]

MULTI-DIMENSIONAL VALIDATION CRITERIA

Security Requirements (Weight: 25%): - [Authentication/authorization needs] - [Input validation and sanitization] - [Data protection requirements] Functionality Requirements (Weight: 20%): - [Feature completeness criteria] - [Edge cases to handle] - [Error scenarios and responses] Structural Requirements (Weight: 15%): - [Architecture patterns to follow] - [Code organization standards] - [Design patterns to implement] Performance Requirements (Weight: 15%): - [Response time targets] - [Scalability considerations] - [Resource usage limits] Documentation Requirements (Weight: 15%): - [API documentation needs] - [Code comments and types] - [Usage examples required] Testing Requirements (Weight: 10%): - [Unit test scenarios] - [Integration test cases] - [End-to-end test flows]

AI DEVELOPMENT GUIDANCE

Context Patterns: [Existing project patterns AI should follow] Framework Constraints: [Specific technologies/libraries to use] Anti-Patterns: [What to avoid - common AI hallucinations for this domain] Validation Hooks: [How compliance will be checked] Debug Attempt Limit: Maximum 3 attempts before plan revision

DEFINITION OF DONE

- [ ] Multi-agent planning completed (Opus + o3 + Gemini) - [ ] Architectural decisions documented and validated - [ ] Plan written to docs folder - [ ] Implementation passes all compliance dimensions (>90% score) - [ ] Security validation complete - [ ] Performance benchmarks met - [ ] Documentation generated - [ ] Tests written and passing - [ ] Code review completed - [ ] Debug attempts < 3 (or plan revised)

ITERATIVE REFINEMENT PLAN

Phase 1: [Minimal viable implementation] Phase 2: [Enhanced features and optimization] Phase 3: [Advanced capabilities and edge cases] Debug Decay Prevention: - If debugging fails after 2-3 attempts, return to planning - Document failed approaches to prevent repetition - Consider architectural changes if patterns emerge

AI ASSISTANT INSTRUCTIONS

1. Start with Opus in Plan Mode for initial strategy 2. Validate architecture with ChatGPT o3 for system design 3. Use Gemini MCP for task breakdown and edge case identification 4. Document finalized plan before switching to Coding Mode 5. Generate specification using grow_spec tool 6. Implement following the specification exactly 7. Use check_spec_compliance tool to validate 8. Limit debug attempts to prevent decay (max 3) 9. Focus on weighted dimensions - security and functionality are critical 10. Return to planning if debugging becomes ineffective