While kneading can be painful for you at times, it's comforting for the cat. It's possible that your cat was taken away from her mother too soon and is reverting to kitten behavior. Or perhaps your cat is showing affection and has a close bond with you. Whatever the case, to avoid pain or scratches, place a blanket or pillow where the cat kneads. She might get used to kneading on the material rather than you.