Music Composers Unite!
It really depends on what key you are writing in. Diminished chords have their place in harmony, but they are best used with some discipline. As far as the diminished 7th goes, there are only 3 variations (and their inversions). They are:
1. C - Eb - F# - A
2. C# - E - G - Bb
3. D - F - Ab - B
If you were to raise the highest of these notes, they would become half diminished 7ths (the same shape as II7 in the minor key).
However, if you are using them freely as you stated, your melody, rather than adhering to a certain scale, would be better shaped around the chord itself. Therefore, for example, if your chord was a quarter note, and your melody was broken into sixteenth notes, it would be best to restrict the notes in your melody to that of the chord with notes adhering to the key you are writing in, in between them. But make sure your tune resolves smoothly to the notes of the next chord (supposing your next chord is also a diminished/half diminished 7th). What I mean is, avoid intervals such as the augmented 2nd or augmented 4th (unless that is exactly what you are after, of course).
I hope this helps.