Lesson 5: Your Team Needs Shared Rules
What are Constitutions?
Constitutions are shared rules that apply to ALL specifications in your project.
Think of them as:
- Quality standards
- Organizational learning captured
- Automatic guardrails
Example Constitution Rules
Security
- All passwords must be hashed (bcrypt, cost 12)
- All user input must be validated
- No secrets in code or logs
Error Handling
- Return structured error objects (not strings)
- Include error codes for client handling
- Log errors with context
Performance
- API responses < 200ms (95th percentile)
- Database queries must use indexes
- Cache frequently accessed data
Bug → Rule Pattern
When a bug is found:
- Fix the bug
- Add a Constitution rule to prevent it
- All future specs automatically check against it
Key Takeaway
✅ Constitutions enforce quality at scale
✅ Organizational learning compounds over time
✅ Automatic checks prevent recurring mistakes