Yellow nails are usually caused by wearing dark coloured nail polish. Wearing a protective clear base will help to protect them in future. Also try wearing a light coloured polish some of the time as it contains lower levels of pigment, which are less likely to stain your nails
The best cure for yellow nails is to rub them with lemon juice to remove the stains and then use lots of hand cream or nail cream to replenish the lost moisture.
Try to go the odd day without polish and let your nails breath.