All dreams are a message from God expressing Himself in you.
The Devil is a symbol of denial of this truth...the goat as others replied, is a symbol of stubbornness. The bolt from the yellow cloud is a symbol of you banishing this stubborn denial with all your might.
The answer is simple. You know you are dreaming when you meet this goat...you've dreamt it since birth. You also know exactly how to smash the little bugger. Next time you meet make a cloud and blast him again.
(Here's a secret: Practice imagining a yellow lighting cloud created at the snap of your fingers or clap of your hands throughout your day. Then, when your dreaming it will come "more naturally".)
ps...as other's have said you should look at your life for parallels that you associate this devil with.