I have realized that the paragraph on the rules for creating adequate crew modifiers for NPC starships (page 326 CRB) is incomplete. It doesn't tell you how to create the Gunnery modifier (as if that was a small detail). :/
So I think I figured out how they make it in their example stat blocks, and therefore what you should do to make your NPC gunners.
It's quite simple:
1) decide the level of the gunner, as if it was a PC, generally it should be close to the average party level
2) apply the Ability Score Modifier as it appears in the Array tables starting at page 129 of the Alien Archive. Choose the one that fits, for instance the high score if the gunner is supposed to be a good shooter, or pick a lower one if that's not usually their main occupation.
And it's done!
For example a Tier 2 starship with crew members who have 2 ranks in their skills shoud have level 2 gunners that could have a: +6 (most commonly); +4 (if they are not good at it); or +3 (if they are not gunners at all, maybe they are a replacement) modifier.
Does this make sense? Correct me if I'm wrong, please. This should largely reflect what you see in the existing stat blocks, and allow you to safely create your space baddies!
I don't think you should have to reference the NPC creation chart, to come up with skill ranks and such to determine the stats of the ship.
But I've tried locating a table that has the stat pre-generated and can't find anything.
It would be pretty straight forward to generate a table for starship with all the relevant crew roles staffed assuming the most favorable candidate is filling them. Like a combatant (NPC) is staffing the guns and experts are staffing the other rolls. I don't think there is anything that the spell caster NPC template exceeds the expert in at skills, but I didn't check.