Consecutive 5ths and octaves must be avoided between chords when you are writing traditional harmony. If the music contains melodic decoration like passing or auxiliary notes, then you also need to avoid consecutives including these decoration notes.

There is no melodic decoration here, and the consecutive 5ths are easy to spot. F-C moves to G-D.

obvious 5ths

The same pair of consecutives appear in this example, but this time the F is a passing note. This is still considered to be an illegal consecutive, because the C and F finish sounding at the same time, and then move to G and D at the same time.  

passing note 5ths

Decoration notes cannot be used to “fix” a consecutive.

The 5ths here for example, cannot be corrected by adding a passing note G in the bass.    

decoration cannot fix

This is because there are still consecutive 5ths between the chords.        

5ths still exist

To sum up, consecutives must be avoided both between adjacent chords and between adjacent notes.

Voice Leading

If an added decoration note turns the sound of a dominant chord into a dominant 7th chord, the 7th should fall by step, as it would with normal voice leading.

For example here, it is fine to add an F as a passing note, because it can fall by step to E when the harmony changes.

adding 7th ok

In a minor key, avoid creating augmented 2nds with decoration notes. Augmented 2nds occur between the 6th and 7th degrees of the harmonic minor scale.

There is no easy way to add a passing note between F and A here. The F cannot be changed to F# without changing the intended chord, and the G cannot be G natural if it is rising to the tonic A. In this situation it is best to avoid using a passing note.

augmented 2nd

In this situation, an F natural passing note would create an augmented 2nd, but an F# would create a major 2nd, which is fine. This is the top end of the ascending melodic minor scale.

use major 2nd

The descending melodic minor scale can be used for descending passing notes:

use melodic minor scale

When the leading note is used as an auxiliary note moving back to the tonic, it is the following chord which will decide whether to raise the leading note or not.

If the following chord is a tonic (root position or first inversion) chord, it is usually better to raise the leading note (e.g. iv-ib).

But if the next chord is anything else, either form of the leading note can be used.

auxiliary notes