What is the rule?
Three tabs or fewer go horizontal, across the top of the page. More than three go vertical, down the side. Even at four, keep it vertical.
Why does it work?
When you look at a screen, your eyes mostly move from top to bottom, and they rest on one part of it at a time. A short row of three across the top sits right where you look first, and you can take it in at once.
A long row across the top makes you read left to right and move the cursor across the whole screen to reach the last tab. That is tiring, and it looks cramped. A vertical list lets you see every option in one look. The opposite mistake is a side bar with only three links in it, which leaves a column of empty space down the page for no reason. That is why short lists belong at the top.
When should you decide it?
In the design, before anyone writes code. If a client wants seven tabs in a horizontal bar, the time to have that conversation is before the build, with the reason ready. Changing the navigation after the pages are built means touching every page.
This is one of the small things designers learn early and AI never brings up on its own. It will build a horizontal bar with nine items if you ask for one.
How do you get AI to follow it?
Put the rule in your prompt or your design notes, in plain words: "Use a top navigation bar for three items or fewer, and a left side bar for four or more." Then check the result on a phone, where both usually collapse into a menu, and make sure the most used item is still the easiest one to reach.
For the bigger picture of what to decide before you build, read the 13 things you do before you build your app.