A few random thoughts on migration comments:
- Do not just tell the OP their question is off topic. If you don't have the time or energy to explain why it's on topic, please do not post a comment at all. Someone else will, soon enough.
- If you are going to suggest migration, please also:
- Let the OP know they can flag the question and ask the moderators to move it, or
- If the question was closed without answers, encourage them to delete it before posting it elsewhere
- If you are not 100% certain that the question is indeed on topic elsewhere and that it fits that site's quality expectations, do not comment. Instead, flag the question yourself and ask for it to be moved.
- Even if you are 100% certain, you should still let the OP know that they should familiarize themselves with the other site before posting there.
Migration comments, although almost always well meaning, quite often create a very disappointing experience for newer users:
- This is off topic on Foo.SE, it belongs on Bar.SE.
- OP re-posts on Bar.SE.
- Question is quickly closed on Bar.SE.
And we are left with a newer user who now thinks we are a bunch of circlejerks, playing migration ping pong with their question, and two closed questions1. That's not nice.
Recommending a more appropriate Stack Exchange site is definitely not wrong. It is, however, very hard to get right. If you have even the slightest doubts about the question's suitability on the target site, you should probably avoid commenting.
1 And if Foo.SE and Bar.SE happen to have automatic question bans enabled, the OP is now a step closer to getting question banned on two sites. This might seem like a narrow edge case, but it happens at least once per day (on average) between SO and Programmers.