Skip to main content

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

  1. You: Provide initial requirements
  2. AI: Suggests edge cases and patterns
  3. You: Add constraints AI doesn't know
  4. AI: Refines specification
  5. 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

Continue to Lesson 5 →