I have found myself doing this, and don't catch myself till afterwards, mostly due to alcohol. Obviously there's nothing wrong with getting a girl's number, but I'm realizing that asking for it a few minutes into the conversation without building enough attraction will get you the number more than likely because the girl is being nice. This can lead to either not getting a text back, or the girl obviously not being interested enough to put in effort to hang out if she thinks you're just some random guy with her number. Then again I have had this work well for me also.

I think my problem is if I am having a good conversation with a girl (or at least I think I am), even only for a few minutes, I feel the need to ask for her number sooner rather than later, almost as a fear of not getting it, or having to initiate a new conversation later.

I know this is something I just need to work on in my inner-game and be able to walk away without caring about the number, but what do you guys look for or what are your rules when it comes to asking for numbers and when to do it?