How would you write technical design documents and define API contracts for security and scalability?