I actually feel that it's sometimes a bad idea to leave such comments. Consider a situation when a relatively new user posts a question that is arguably off-topic (and might be more on topic on SuperUser, CodeReview or elsewhere).
If the question is off-topic, it will be closed/migrated anyway. But the close-voter can't know it in advance. Receiving a comment like
"This should have been asked on X.SE" or
"This is off-topic" or just a link to another SE site doesn't really help the OP, and, I imagine, doesn't give the best impression. While such a comment can be incorrect, it can cause the poster to delete the question, with or without reposting it on another site.
This prevents the natural course of events, i.e. migration of the question, or, in the worst case, an eligible question is deleted and the user is not helped.
So, at least in the described situation, I think posting such a comment does more harm than it does good. The comment could be verbose enough to explain the situation in a proper way, but people don't care enough to do it. I usually refrain from posting such short comments, because it's not clear what the OP should do with it, anyway. And if someone has already posted such a comment, I usually post another one explaining how the situation should be handled.