Lesson 4: Build Your First Specification
Hands-On: Calculator Module
Let's build a specification together for a calculator module.
Step 1: Define Intent
Intent: Create a calculator module that performs basic arithmetic operations with proper error handling
Step 2: List Success Criteria
Success Criteria:
- Supports addition, subtraction, multiplication, division
- Returns numeric results for valid operations
- Handles division by zero gracefully
- Validates input types (numbers only)
Step 3: Add Constraints
Constraints:
- Must work with integers and floating-point numbers
- Error messages must be user-friendly
- No external dependencies
- Performance: < 1ms per operation
Step 4: Define Non-Goals
Non-Goals:
- Scientific functions (sin, cos, etc.)
- Complex numbers
- Expression parsing ("2+2*3")
- History/memory functions
Collaborative Workflow
- You: Provide initial requirements
- AI: Suggests edge cases and patterns
- You: Add constraints AI doesn't know
- AI: Refines specification
- Both: Converge on production-ready spec
Key Takeaway
✅ Collaboration combines AI patterns with your constraints
✅ Iteration refines specs to production quality
✅ Edge cases emerge through dialogue