Three gates

Are you aware of the concept of the three gates? Most simply, before you speak or – in my case, write – let your words pass through three gates. Is it true? Is it kind? Is it necessary?