For songs that have lyrics, lyrics are first almost always. For instrumentals, I have less structure.

The only songwriting training I have ever had was Pat Pattison’s class from Berklee. That class is 90% about writing lyrics and song form. Maybe even more than that. I credit Noel96 from here for turning me on to that class. The other resource that I continually mine which is more song form and chord/melody structure is Matt Blick’s Tickets To Write website which catalogs all of the tricks and tactics the Beatles used in very digestible ways. I’m not ashamed to admit that I have gone to that well many times for inspiration.