For very small creatures that always appear in swarms, you can ignore the HD of individual creatures and treat them more like a communal creature with HD based on the size of the group and successful attacks splitting the creature into smaller groups until completely dispersed.I thought I'd expand a bit on handling swarms of tiny insects or other small creatures, since they could be varied randomly in much the same way as oozes, slimes, and molds. Tiny critters are all basically 1 hp each, if that. The number of HD a swarm has, as I suggest, should indicate the relative size of the swarm: 1 to 2 HD for a swarm that covers an area of about one yard or meter across. Actual hit points indicate the density of the swarm; it might be easier to just roll one die and multiply by the # of HD to get total hit points.
The HD also indicates effect attack roll, because more creatures attacking means it's harder to avoid getting badly bitten or stung. However, the "default" insect swarm does no hp damage, it just annoys and causes lingering pain.
Standard melee weapons are pretty ineffective against tiny insects. Don't roll to hit with handheld weapons, just let the adventurers do 1 point of damage per round. Let the fighters get their multiple opponent attacks, though: they do HD+1 points of damage per round to a swarm. However, a successful attack on a swarm splits it in half temporarily, giving it two attacks at reduced combat effectiveness.
Wider weapons, like using the flat part of an ax instead of the edge, adds 1 to damage (it's a big fly swatter.) Missile attacks use standard rules, but are usually useless for small missiles. The exception would be things like boulders, which do at least a point of damage, increased for size, or flaming arrows, which do full damage, as does Burning Hands, Fireball, Cone of Cold, and the like.
Basic swarms can either crawl, fly, swim, or burrow. Crawlers can be avoided at least temporarily by getting away from the surface they are crawling on. They use the same movement rate as oozes: movement rate equals HD, up to maximum 6" rate, with movement up vertical surfaces equal to 1/3rd normal move, round down. Flying move is equal to full HD in all directions; it mostly means ignoring pits and the like. Swimming is the same, but swimmers can't leave the water. Burrowers move at 1/3rd HD, round down, but a minimum of 1"; this only applies to dirt and other loose material.
Colors determine camouflage bonuses, as per oozes, but if you roll for vulnerabilities to ordinary substances like salt or vinegar, each color/movement type combo defines a different "species", with a different vulnerability.
For 2+ HD swarms, roll 2d6: if doubles are rolled and the total is <= HD, the swarm has an extra-special ability, like poison, multiple movement types, frightening sound, or parasitic attack. Poison and parasitic attacks alone can provide a lot of vulnerability if using the poison system I've described elsewhere. If the total is > HD, the swarm has an additional weakness (flees from light; double damage from cold, fire, etc.)
Edit: I just noticed that I wrote "a lot of vulnerability" instead of "a lot of variability" or "variety".
You can also specify HD+1, HD+2, and HD+3 species of crawlers, fliers, swimmers and burrowers. The hit point adds equals the damage per attack, in addition to the pain effect and any other special abilities.