Suppose I'm in a cadence in minor using the harmonic minor scale while playing a dominant V chord, thus using the raised 7th leading tone. At the same time, my melody is descending, so that would be a flatted 7th and flatted 6th against the raised 7th in the harmony. Wouldn't that cause an ugly sound? Can someone tell me how to handle this? I've read a book where all they use is the ascending form of melodic minor scale even when descending. That has made the most sense to me so far.
A bit more information would be needed in this case. If the melody is descending, the question of mutated sixth or seventh steps generally doesn't arise. If descending to step 1, a melody generally goes through step 2 (from 3) so the raised 7 will go well with step 2. (One reason that a ii065-i64-V7-i sounds so good.)
If the melody descends through lowered scale steps 6 and 7, it rarely leads to a perfect authentic cadence on step 1 (or equivalently 8). Such a melody may cadence on step 5 with harmony based on the tonic or dominant; in this case, the minor dominant chord is possible either leading to a X-v-i chord sequence or X-v sequence (X is something else).
Another possibility (common in classic styles) is to use the "harmonic" version of the minor scale (lowered 6 and raised 7) in the melody. Unless writing for voice, this works OK too. The melodic line may go through steps, 4,5,b6, and 7 thus outlining a V9 chord.
One other point is the major dominant (in the minor mode) is only "needed" when a strong sense of tonic is needed. Sometimes a piece in minor will end a phrase with a v-i progression then use a V-i progression in the analogous place at the end of the piece. (Greensleeves is sometimes played that way; first verse ends with v-i and last verse with V-i or even V-I.)
It all depends on the sound. These "rules" are just "widely observed practice."
You are correct that the flat 7 against the natural 7 would create a dissonance. For that reason, composers would generally avoid the situation.
The purpose of the leading tone is to draw the ear toward the tonic. That is why the seventh is generally raised in minor -- to create a strong pull back to the tonic. But when descending, that pull toward the tonic isn't as desirable, so a composer might retain the flat 7 in a descending line.
In the situation you're describing, you would simultaneously have a harmony pulling toward the tonic and a melody pulling away from it. Not a situation likely to arise unless by specific intention, in which case the dissonance created would also be by intention.
In general, the various minor scales are descriptive of how composers deal with writing in minor keys, but they aren't hard-and-fast structures that must be adhered to. Within a single piece a composer might use all four of the flat and natural sixth and seventh scale degrees.
The ascending melodic minor in C has A & B natural. Descending it has Bb & Ab. But these rules are needed when you're learning scales, not when you're writing something. How does it sound to you? It can sound very expressive.
It looks like you've come across what are called false relations. The Wikipedia article may help. Generally false relations work better if the clash is approached by step rather than by jumps.
You don't HAVE to use the Melodic Minor scale coming down You don't HAVE to write a descending melody using the 6th and 7th degrees of the scale over a dominant chord. If you dislike the sounds these choices make, there are other choices!
You could channel your inner Gershwin (or Hendrix) and do this of course:
First and foremost - any music theory is just that - theory. It is certainly not a set of rules to be followed faithfully. It's a selection of ideas that have been found to work fairly consistently over many centuries. Guidelines, if you like.
Brief potted history: the natural minor scale notes match the relative major notes - every single one. That left a slight problem as there was no leading note - the note one semitone below the root note in a key, which gave a feeling that it needed to move up by the smallest amount possible (a semitone), in order to reach 'home'.
So, note 7 from that natural minor was often sharpened - in the nat. min. it was a whole tone away from the root. That also meant the dominant chord on a minor key was now a chord with M3, not m3.This is the harmonic minor.
That was a good idea, sonically, but it then produced an interval of a tone-and-a-half, between notes 6 and 7. It was deemed to be a step too far, was probably difficult to sing, so note 6 from nat. min. was also raised, thus giving birth to the melodic minor, rising. Often, when the melody was descending, the old nat. min. was good to go, so was retained - still is - in the 'classical' melodic minor scales we find in so many music exams.Although jazzers tend to have created their own minor 'scale', which tends to use the ascending melodic minor notes rather than the descending ones.
An interesing chord does come out of your idea, though. Using notes 5, 7 and 9 from the natural minor, and 5, 7 and 9 from the harmonic minor, produces what's become known as the 'Hendrix chord'. A sort of major and minor mixed together. As in key Am, it's E, G, G♯ and B (optional D). Strictly speaking, it's considered that the G note is actually Fx,(E7♯9) but the sound should be familiar - and it does work well as a dominant chord.
Given all that, the first 5 notes of all minor scales are identical (not including modes), and every chromatic note continuing upwards can and is used in minor pieces. The best judge of what gets written is our ear. Rather than trying to rely on 'rules', use ears, and they will guide us to what sounds best. Please re-read the first paragraph as a reminder!
This was common in the 16th century, especially among English composers, although the "minor scale" had not yet been developed as a theoretical concept. The usual pattern was for the flat seventh to be the upper neighbor of the sharp sixth, however, not of the flat sixth. For example, in D minor, one voice would have B-C-B against another voice's D-C♯-D. Wikipedia has more information about this in its articles False relation and English cadence.