I tend to write at the piano, but usually the melody and lyrics come first. Like, I'll be in the shower, and I'll start singing, and the melody and the lyric will just come out. Then I'll quickly try to finish the shower, try to remember it, record it on my phone and save it for the studio.