Right flange spacing is tight, so you want the cassette as close to the frame as possible while still allowing clearance for the chain. With the chain on there should be about 1/2 to 1mm clearance between the chain and dropout. If it seems very tight put a dollar bill between the frame and chain and use a tire lever to jam the chain outboard. If you can't trap the bill it's fine, if you can trap the bill you need to add a spacer to the axle.
Without a chain, the outer face of the outermost sprocket should be inboard of the face of the axle by about 3mm.
In any case, the position of the cassette has nothing to do with the quality of shifting (unless the chain hits the frame). The RD limits and trim are set to the cassette wherever it happens to be. The only time it becomes an issue is when you rotate two different brand wheels on the same bike.
Back in the days when I sponsored a race team, I carefully respaced all the wheels so the cassette to axle face distance was identical. That allowed any wheel to be used with any bike without changing the RD trim. Those days are gone, and on most modern hubs aren't easy to respace axles, nor is easy to micro space the cassette position on the cassette body. (though current stuff tends to be pretty consistent)
__________________
FB
Chain-L site
An ounce of diagnosis is worth a pound of cure.
Just because I'm tired of arguing, doesn't mean you're right.
“One accurate measurement is worth a thousand expert opinions” - Adm Grace Murray Hopper - USN
WARNING, I'm from New York. Thin skinned people should maintain safe distance.