Resources aren’t always where you want them to be. So I leave it to the AI. In the beginning of a game, and a pirate attacks a mine station, I immediately go to the design screen and arm the mining stations. Since it’s the beginning of a game, you probably don’t have a lot of money, so don’t overspend. And then I forget about them. If you are low on construction ships, build a few more. Also, your mining stations can’t be retrofitted, so it will take a while for your new design to replace all the older versions.
I personally (manually) control the design screen, and the research, and ship building screens. I don’t want the AI involved with those functions at all. In the research tree I want to build bigger ships, add better armor, weapons,etc. Then I want to build colony modules so I can colonize other planets. etc. The AI is just too random here. You'll get the hang of it
There are so many versions of this game coming out: I don’t know which you have, so things may be different from what I’m saying. Good Luck, and have fun!