In the Western Classical Tradition melodies are usually made up of arpeggios (i.e. skips between notes of the chord) or any of the following dissonances. If you are writing in a broadly Classical or early Romantic style you should avoid using dissonances other than those listed below.
In particular, the following dissonances are very rare and should be avoided:
- dissonant notes followed by a leap (other than escape notes)
- unaccented dissonant notes approached by leap
When you are writing a melody you should (at least to start off with) label your chords and if necessary write out the component notes so that you are clear exactly what is dissonant and what is consonant. The example below shows some correct melodic dissonances: