The general guidance is simple: don't. Never recommend to another user that they should take their question somewhere else.
Never use a comment to suggest other sites - it simply leads to cross-posting. And if the question isn't a high quality question or isn't appropriate for the community that you suggest, and it ends up getting down votes and close votes on the other site, the asker could end up in a situation where they encounter an automatic question ban. That's not a good thing.
When a user asks a question on Software Engineering, first see if it's on-topic here. Some subjects may be on-topic on multiple sites. For example, questions about data structures and algorithms may be on-topic on both Software Engineering and Computer Science, questions about Scrum may be on-topic on both Software Engineering and Project Management, and questions about using an open-source project in your project may be on-topic on both Software Engineering and Open Source. This is OK and to be expected. Each site is a community of experts, and experts in different fields may have overlapping knowledge.
If you've asked the question and you think it should be migrated to another site, do flag it for moderator attention. You can do this right away, if you feel that you've posted here in error, or you can wait a while.
If you aren't the asker of the question, then you have a few options...
If a question is off-topic on Software Engineering and you can vote to migrate it to the appropriate site, please do so. Software Engineering has a migration target to Stack Overflow that is open to everyone to use. If you think it is off-topic here and needs to go somewhere else, flag it for moderator review. Moderators can migrate questions to any site on the network.
If a question is not off-topic on Software Engineering, simply do nothing... at least right away. If it's been a while and it's not getting answers or you think that it would get better answers somewhere else, flag it for moderator attention. Explain why you think it would get better answers somewhere else.
If you know of similar questions on other sites, do link to those as comments. They may be helpful to the asker. If you feel like it, it's OK to reference answers on other sites, remembering the proper attribution required by CC BY-SA license that applies to all content on Stack Exchange. You could build a summary answer of knowledge on one or more sites. If you feel that it's appropriate, you can also make answers Community Wiki to lower the barrier to entry.
I made a little flowchart to go through how I think when I open any question. I first read it, and then go through this process: