Weed guards for flies come in many different styles. There are single guards, double guards, ones made from wire, mono—the list goes on! A very popular weed guard that is often found on flies made for bass fishing is the "bass style" or "loop style" weed guard. Call it what you will, but it's an easy and effective means of keeping the hook from getting snagged while fishing around cover and structure.
Start by tying in a piece of line at the rear of the hook. Use a long enough piece to comfortably work with and make sure it's tied inline with the shank and not crooked off to one side. I like to tie it in from where the hook bend begins down to just before halfway around the bend. Opinions vary on what pound test to use, but a stiff piece of 20-pound is a good starting point for medium to larger hook sizes. After securing the line with plenty of tight thread wraps, bring it back to the starting point as shown. At this point, I recommend applying glue or epoxy to the wraps for extra reinforcement before continuing.
After completing the construction of the fly's body, the thread should now be near the eye of the hook (I simply wound the thread forward for this example). The weed guard can now be brought forward so it can be tied in at the front. I usually just poke the tag end of the line through my vise jaws and draw it forward which saves me from having to unclamp the hook.
Next, center the line under the hook at the eye and tie it in with a few wraps. Before totally locking it down tight, you can adjust the loop width (if necessary) by pulling on the line to slide the loop more open or closed. Leave a little space between the hook point and line when forming the loop. With the loop set, wrap the line down tight near the hook eye making sure the line is directly under the shank so it stays inline with the hook point. I prefer to tie it in just a hair back from the eye rather than pushing right up against it. Clip the excess line as close to your thread wraps as possible then form a neat thread head to cover the tiny remaining tag end. Whip finish and apply epoxy/glue to reinforce your wraps.