Three skills improve the amount of ability points gained per level, on a non-donation pet, they are Taming, Lore, and Vetinary.
Also since it was coded by the infamous Kane, who keeps bringing us kick ass stuff to try and figure out since he does not like giving us formulas, luck also is a factor.
For a donation pet, those skills mean nothing when a donation pet gains ability points.
All pets, except the donation, have a certain range of ability points per level. Every level they will gain somewhere between X and Y ability points. Your skills then add a modifier to this value and that give you a total. Also they have a chance to gain a trait every so often, higher skills have a chance to increase the chance for the trait to be gained.
The donation pets have a range of ability points per level as well, so they still gain between X and Y. We do not know the actual ranges yet or if those ranges are the same between tameable and donation pets.
The Wiki and Kane's patch notes from when he did the pet exp and ability points changes have the rest of the info. The wiki is actualy up to date for this.