Answering or commenting on a question is critical by its nature, and it's harder to be nice while being critical at the same time. Or perhaps it's too easy to be meaner than we need to be. But there are simple things we can do when answering or commenting on a question that help.
Here's an example.
Something I try to do in my answers and comments (and don't always remember) is to use language which deliberately dissociates the person from the code or practice. I don't want to write "your code"; I want to write "the code".
It's a subtle difference, but when pointing out a mistake in "your code", I'm directly attributing that mistake to you, personally. In a very small way it's a personal attack, and people don't really like that. When I point out a mistake in "the code", it's less personal, less of an attack, even if you still wrote it (which, remember, isn't always the case).
But that's just one thing. It's a play in a playbook. Something we should be asking is how we can collect these plays, these little techniques, to grow the playbook, and then communicate this playbook to other people who predominately answer and comment on questions.