New here, first post, please be gentle

I have a recently-adopted 1 year old female. She was a stray who was found with her kittens outdoors, and was at a shelter weaning them for a few months before coming to live with me. When I met her at the shelter she was aloof and wary, but now she's away from other cats she's become very playful and bold. She's trusting me more and more and so far and she seems happy, but I have a question about something she does and whether I'm handling it right.
Quite often she mews, head-bumps and scent-marks me, I respond by stroking her as she walks around me which she seems to enjoy a lot, she purrs, and then sooner or later she rolls on her back, raises her paws and looks up at me expectantly. If I then reach towards her she starts batting and lightly clawing my hand.
At this point I usually withdraw my hand quickly (usually saying 'ow!') and back away from her quietly. She lies there looking puzzled and I feel like I'm snubbing her.

I'd like to understand why she progresses from stroking to clawing like this. We do play a lot and there's usually a clear boundary between things she will claw/pounce on and things she shouldn't (i.e. my hands, feet etc.) She does sometimes lightly bite my trouser legs when excited about getting food, but it's very gentle and not a big deal. But this link between stroking and clawing is puzzling me.
I wonder if this is something from kitten sibling play, or something that was established with a human friend in her past. Or maybe she just sees stroking as a way of getting me to play with her. It seems to be something that excites rather than relaxes her anyway, which is different from other cats I've known.
Am I doing the right thing by not reacting to the hand-clawing behaviour?
Also, am I right in interpreting the batting as play? I've read that some cats will bite or claw during stroking because they've had enough and the owner has missed subtle cues like ears and tail movements. I don't want to annoy my cat accidentally. But it seems more like she's taking the lead and waiting for me to do something.
Thanks in advance for any advice or ideas