About 8 months ago, my wife and I adopted a cat from a shelter. She was about two years old at the time (meaning she's approaching three now). We love her a lot and do what we can to teach her how to be more sociable, but she unfortunately has some bad habits from her life before we adopted her. For context we are in a relatively small apartment, and so I suspect that she gets annoyed with us being close all the time (she usually feels much better after her time outs and goes back to being nice). She is usually nice, and has learned to be ok with us picking her up for a little while, but sometimes her mood seems to swing quickly to being very aggressive.
For example, if she gets bored and we aren't paying attention to her at the moment, she will come over and bite us on the leg. Usually not very hard, but sometimes hard enough to break skin. From advise I found online, we normally handle this by firmly telling her no, then going back to what we were doing (so that we don't reinforce that as a way to get attention). If she is then good and doesn't bite anymore, we will go and play with her to relieve the boredom. However, sometimes she decides to keep biting us harder until we have to react (breaking skin and sometimes drawing blood). In those cases we take her into another room (a room with her food, water, and litter box) and close the door for a little while to let her calm down and learn that that isn't acceptable (a time-out of sorts).
However, recently, she has sometimes become even more aggressive. When we move her into the other room and put her down, she either runs out quickly (understandable since she doesn't want a time out), or she will attack and really try to hurt us (biting and latching on and scratching).
I can live with a few scratches and scars, but I feel that all of us would be better off if she would learn how to communicate without biting. Do you have any suggestions on techniques that could help?