Intel SGX provides integrity and confidentiality guarantees on its "Secure Enclaves" to protect user's data. Though suffers from side-channel vulnerabilities, Intel SGX seems to be the most practical solution in the industry, with the clearest security boundary, numerous manuals, and remote attestation service. Nothing (including Trustzone, SEV, etc) else could compete with Intel SGX nowadays. It is easy to understand that memory safety is very much important to Intel SGX. Intel SGX is designed to protect user privacy and private keys, while simple buffer overflow in SGX enclaves would leak these precious data/keys and results in billions $ of loss. Memory corruptions are the first enemy to Intel SGX enclaves. We need a complete solution to build up memory-safe Intel SGX enclaves. In this talk, we introduce the MesaTEE SGX software stack. MesaTEE SGX software stack provides memory-safe libraries written in Rust/RPython and provides a bunch of useful memory-safe libraries such as serializer/deserializer, TLS termination, more crypto primitives, fast ML libraries, WASM interpreter and even a memory-safe pypy interpreter. Developers could easily develop Intel SGX applications using these libraries and port more Rust/Python libraries into enclaves in a few easy steps. We encountered tons of pitfalls in SGX software design and implementation and want to share them in this talk. These pitfalls are often related to trusted/untrusted inputs and partition methodology/philosophy. Their corresponding solutions are not presented before and we believe we should share our stories as "currently known best practice". In detail, we would talk about the philosophy of "hybrid memory safety rules-of-thumb", as well as security-oriented standard library design, attestation-based TLS, secure and fast interpreter/ML implementation etc. We strongly believe this talk would benefit the Bluehat audience a lot with Intel SGX and a novel security-oriented software design and implementation.