What's the best way to connect transfer switch and sub panel?
Get a bigger subpanel
You appear to have an automatic transfer switch, and the switching happens there.  The 10? 12? space subpanel is just an ordinary run of the mill subpanel.  It isn't special, it isn't matched to the transfer switch, or anything like that.
However, it is the long experience of the experts on this forum that you will find the &quot;only 12 spaces&quot; very stifling later down the road, and you will regret not upsizing that subpanel now while you have the chance.  A 30-space is not excessive.  Really.
Note that if you buy the same type of subpanel as your main panel, you can simply move the breakers over.  This will save a ton of money if any of them are AFCI or GFCI breakers!   You could not move them into the pictured subpanel without replacing its plain breaker with a GFCI breaker for that panel type.
I realize there is a mentality among generator owners that only a precious few circuits can be on generator; that's not true at all.   It is sourced, however, from something barely related which is true, but we'll come back round to that.
Provisioning power to panels
What's got you knocked for a loop is how the breakers can add up to more than the main.  But that's OK because most circuits are rarely loaded.  So, with a house, you do a &quot;load calculation&quot; to estimate a likely loading for a house.  You only need the service to cover that.
For instance, &quot;3 watts per square foot&quot; is a general rule, plus 1500 W per kitchen and laundry-room circuit.  This seems very arbitrary, but it's backed up by an enormous amount of data collected over decades by the NFPA.
However, there's an exception when a load is specifically known:  E.G. Mary uses a spare bedroom to run Bitcoin miners, PC servers that do complex math all day, and draw 12A @ 120V doing it x 8 miners. Mary can't just fold that into the normal load calc for the house because it runs at the same time as those.  The rules say that for continuous loads, you must derate 125% - so 12A becomes 15A.  So those 8 servers, 4 per &quot;leg&quot; of 240V, mean 60A @ 240V must be provisioned just for those.  That adds onto the normal load calculation for the house - so if that was 39A, Mary skates by with 99A needed to be provisioned.
So you can use general rules, or if you have specific info you can use that instead.  For instance a modern refrigerator takes about 0.9 amps  (108W) when running, and 0.3 amps (36W) on average, so a dedicated fridge circuit needs only a small allocation.
...Because an ATS-controlled generator must be big enough
These calculations matter because they are the basis for complying with a rule:  Code requires that a generator controlled by an automatic transfer switch be large enough to pick up the entire provisioned load (i.e. the load that is on the generator-side subpanel).
It certainly doesn't say all the possible load.  You don't have to figure based on every appliance being on at once, because nobody is making toast while they run a hair dryer while they run a gaming PC at max while they run a chop saw.
And there's a neat exception for loads which are on an automatic &quot;load shed&quot; device - which will connect the load to the generator only when it has enough power to drive it. (or to be more precise, disconnect it if the generator is lugging). Those don't count toward the &quot;entire load&quot;.
So the upshot is, you can support a lot more circuits than you think you can - including ALL your house's lighting and general-use receps. This could be 2 dozen circuits! Stuff like this is why it's important to have a LOT of spaces.
Breakers MUST match panels
Do not use &quot;his&quot; circuit breaker unless it's a dead-nuts match for your type of panel. For instance if the breaker is Eaton BR type, and your panel is a Bryant BR type, that is fine since they are the same type (Bryant became Cutler Hammer which is owned by Eaton)... but you can't use it in a GE or Square D panel.
This isn't brand-name &quot;rah rah&quot;.  The shape of the power buses is actually different, and the clips from one breaker won't engage properly to another panel's bus stabs. You'll get corner (single point) contact instead of flat-surface contact, and that will overheat and burn up the bus stab.  At worst it'll start a panel fire. We see it all the time.

If I went with a large subpanel, I would position them like this.  Place the ATS first so the knockouts line up, only an inch or two below is fine, just so the lids will fit on.   Place the subpanel second so it lines up with an ATS knockout, then have it vertically align with the main panel.  I'd put several short EMT nipples between the panels, they're a real lifesaver when you need 'em.  Metal conduit nipples among the panels mean grounding is taken care of; one less wire to have to mess with.