In my experience as a boat building and marine systems consultant, the majority of engine-related problems encountered by cruisers and marine industry professionals alike are the result of fuel "issues."
Contaminated fuel—be it by water, asphaltene, biological masses, or just plain dirt—is the nemesis of any internal combustion engine. Because of the mind-bogglingly close tolerances to which diesel fuel system components are machined (measured to ten-thousandths of an inch), diesel engines, in particular, are susceptible to fuel that is anything less than scrupulously clean, and this is even more so for those utilizing high-pressure, common-rail fuel injection systems.
Taking on clean fuel from the start, often easier said than done, is the best defense against fuel-related problems. Once the tank and fuel system are contaminated, significant labor will almost certainly be committed to reversing the process. Better to prevent it from the start. Sampling fuel before filling up is a worthwhile approach, especially when the fuel is suspected of being less than pristine. A glass quart jar is fine, however, better options exist.
A one-gallon white plastic pail with a removable lid (a mini version of the familiar spackle bucket) will often highlight gross contamination such as water and solids. Before filling up, pump a quart or so of fuel into the bucket and then wait a minute or two for settling to occur. Any water or sediment should be clearly visible against the pail's white bottom. Good quality diesel fuel (40 cetane or higher is preferable and often required by engine manufacturers) should look like honey (if it's destined for on-road use) or dilute cranberry juice (off-road diesel is dyed red). If it looks like coffee, pass on it. You should certainly be able to see through a quart's worth in the bottom of the gallon container.
If it passes the bucket test, you may want to go ahead and fuel without any further delay, especially if you purchase fuel from the vendor regularly. However, if the sample is borderline, or you just have to get fuel, you could use one of the purpose-made filtering funnels. These will filter out the coarsest sediment, but don't expect miracles. Large amounts of water or ultra-fine dirt will not be stopped by its rudimentary filter system, and you can forget using one if you are in a hurry, as they're slow to drain.
If nasty fuel should make it into your tank, the best secondary lines of defense are two-fold: a high-quality primary fuel filter and inspection ports that allow access into each baffled chamber of the fuel tank(s). The former will alert you to the problem before it goes super critical, and hopefully will prevent damage to your engine. The latter is really the only solution to a seriously contaminated tank—a hands-on clean out.
Additives are fine if used judiciously; however, they cannot dissolve years of accumulated asphaltene or shag carpet-like accumulations of biological growth (which are, contrary to popular belief, bacterial based and not algae). Using a biocide may treat the symptom but not the cause, which is water. The long-term solution to the problem is removal of the water via a drain, stripper tube or polishing system. Without water, biocides are unnecessary. It's worth remembering, bacteria lives in water, and only eats at the fuel—water interface, the diesel fuel diner of sorts. Take the water away, and the microbes die off.