Are there particular rules or limitations to giving class levels to a dragon's alternate form? In context I'm working on ideas for a 3.5 campaign where the primary antagonist is a Red Dragon with the Xorvintaal template. One of his abilities is Alternate Form, and I meant for him to take the form of a high-level Hexblade during certain confrontations, but the thing is, I can't figure out how HD/levels work between forms. Do his dragon HD preclude the possibility of class levels, or can I pretty much give his human form up to his HD in class levels of my choosing? Would his dragon form need class levels for his alt form to have any, or can his alt form have class levels/feats different from his dragon form?
Despite Looking Like a Human, it's Actually still a Dragon
Alternate Form lists what the creature using the ability keeps and loses - notably, you keep HP and special qualities in the new form (although you gain the ability scores of the creature, so the dragon would lose it's racial bonuses to str and con). So you have all your dragon HD, your dragon skills, your dragon mental stats, etc.
If the Dragon already had levels in a class (in 3.5, nothing stops monsters getting levels in classes, even the 'advancement' section is a guideline not a hard and fast rule), it would still have those levels in a class, and could use any class ability it has. The things a dragon gets called out as losing are natural armour, movement modes, size, natural attacks and breath weapon. So spells, skills, hp, are all fine.
But Alternate form doesn't 'turn them into a regular human of the same CR', or something. They are still effectively the same dragon, but without the dragon body. If you want your dragon to lose his hp and dragon spellcasting in human form but gain equivalent class levels, then you'll need to homebrew something for that. I suggest homebrewing an ability called 'Alternate Self' and having it do that, if you want that to happen.