He'll go belly-up in front me, allow me to pet his belly while seemingly enjoying it, then, take a swipe with his paw, watch me retract, then go belly-up again.
All of our cats do this. My current 3 tolerate it to variable extents before becoming overstimulated and rolling away or smacking with claw retracted. If I kept doing it I know the next swipe would be unsheathed, and the cats know that I know this, so we never get to that point. Honestly none of my cats have ever liked having bellies rubbed at all whereas getting purrs and drools out of them is pretty easy massaging in the places they like (behind ears, base of tail, beneath chin, scent gland spots I think)
My cat does the same. My theory is that the cat gets overstimulated and then the claws come out. I’m not sure if cats are ticklish, but if they are, it would explain a lot.