One note on that, maybe it’ll be helpful to other - I usually start with one or two themes, and work out variations on them, and conciously think about connecting parts. The themes usually just come to me on some level, from playing around with a chord progression or just playing on guitar, but the problem solving part is experimenting with different transition sections.
A lot of times I’ll have a piece that kind of flows alright, but I go in and rearrange it because I realize one part ties in better somewhere else. In this one in particular, at 1m 18 seconds in the original piece I had a much more jarring transition and no solo section (fair warning - not a great recording and my playing was a lot sloppier than it is now):
I thought about that one for a while before deciding on how I could fix that section, because I really dislike the transitions in that portion. What happens a lot also is I’ll write a few pieces as separate items and cannibalize them all into one because they tend to be close enough in theme (just kinda reflects my mood I guess) so one will have a part that makes more sense in another or provides a good transition.
I always will stop writing a piece and start a new one if I think I’ve come up with a theme that’s good but distinct from what I’m working on, and start a new piece with it. What often happens is the subsequent piece is better and I’m able to take portions of the other one for transitions or sections etc.