This is the golden rule of migrations. And we do it far too often. I'll even admit to it. It's sometimes difficult to justify to one's self to spend more time drafting a custom off topic reason to say it when it is more work than the OP has spent putting into writing the question.
This question is off topic on Programmers. It would best be asked on Stack Overflow, however, the question doesn't meet their minimum requirements. Please read the Stack Overflow question checklist and [edit] your question to make it suitable for migration.
(sometimes looking that up takes more effort than just close > off topic > elsewhere > belongs on Stack Overflow)
Still, we need to not migrate crap.
One approach would be to put this as a custom off topic reason for various sites. Some sites have already filled up their custom reasons and getting another one involves begging SE to expand the count on a per-site basis.
The proposal: Add another migration 'path' to all sites - just like that the meta migration path always exists on all sites. This 'path' would be:
This question would be better asked on another Stack Exchange site, but it is not of sufficient quality to be migrated to that site.
(I welcome any wordsmiths to improve the wording of this)
This path would be found in the migration dialog that would give a person some pause to think about "is this crap?" Once they got to the "belongs on ${site}" dialog in the close vote wizard. The presence of this would then give them a way to close the question without selecting a site where it will get closed and rejected, or going back a few levels and drafting a custom message (or using 'unclear' as a proxy for a not high enough quality for migration).