Choose a style for your composition. Even if you're improvising experimental music, it's helpful to think of an emotion or character you want your music to have before beginning.
Write the melody. Many composers sings their melodies first and then play them on the piano. You can also use broken chords and scales to come up with simple but tasteful melodies directly on the keyboard.
Create harmonies that complement your melody. Most songs will need a structured chord progression, but free-form pieces can have any kind of accompaniment you want.
Arrange the other instruments' parts on the piano. Since you can play multiple melodies at once, you can hear what the backing instruments and vocals sound like before committing them to sheet music.
Give your music structure by breaking it up into coherent parts. Pops songs, for example, typically have a verse, chorus and a bridge. On the other hand, art pieces might be divided into sections or movements.
Use the piano's wide range of notes to create music that's expressive and vibrant. Avoid composing pieces that stay within a 1- or 2--octave range.