We keep as the reality the fact that all the intellectual property and project assets (code, design and other sensitive details) belong to a client only. And before any engagement we send to review and sign the following documents:
Non-Disclosure Agreement (NDA). The document states that information should be kept confidential, that a person or a 3d party can use the disclosed information for the project purposes only.
Master Services Agreement (MSA). This document lays out general conditions for the cooperation where you want to describe the terms of payment, and intellectual property rights, rights and obligations of both parties.
Statement of Work (SOW). It goes as supplementary agreement for MSA, where we can specify the scope of work, the deliverables, the schedule, the acceptance criteria, the duration, the standards, and any other terms, conditions, or special requirements for the future project. Usually we have one MSA and several SOW if we have a few different projects with one client.