A melody that ignores the chords sounds like a mistake. A melody that only plays chord tones sounds like an exercise.
A professional melody is rarely a random sequence of notes. It is a deliberate construction based on several key pillars. The first is pitch variation. A melody that stays on a single note feels stagnant, while one that jumps too wildly feels chaotic. Balance is found in "stepwise motion"—moving to adjacent notes in a scale—interspersed with occasional "leaps" for emotional emphasis. melody in songwriting pdf