The best way to avoid hydrogen embrittlement is to use a material that is not susceptible. However, this usually means a lower-strength material, which may not always be acceptable, depending on the application. Another good way to avoid hydrogen embrittlement is to avoid exposure to hydrogen.
For example, if the hydrogen is being introduced by an electroplating operation, this might mean switching to mechanical plating, vacuum plating, or a dip-spin coating. It's also possible to reduce the risk of hydrogen embrittlement by "baking" the part as soon as possible after the operation that introduced the hydrogen (i.e. plating or welding). Baking means heating the part to a temperature that will allow the hydrogen to diffuse out. Typical baking temperatures range from 350°F to 400°F. For heat-treated parts, it's important to avoid temperatures that will reduce the part's strength. The longer the parts are in the furnace, the greater the likelihood that the hydrogen will be effectively removed. Some specifications require parts to be in the furnace for as long as 48 hours, while other specifications only require a minimum of three hours.
Hydrogen embrittlement is a delayed failure mode. It does not occur immediately, but strikes at random, usually within 24 hours to 48 hours after installation. The time to failure depends on the stress; the greater the stress a part is under, the more quickly failure will occur.
When I was a student, a professor told me about a problem with hydrogen embrittled fasteners that occurred during the construction of a major urban light rail system. Some of the fasteners were found to have failed within a day of installation. This led to an investigation that lasted several months. Eventually, the failures were attributed to hydrogen embrittlement. All of the remaining fasteners (several million dollars' worth) were therefore removed, scrapped out, and replaced with new fasteners. This was probably unnecessary; if the fasteners hadn't failed during the months of the investigation, they would most likely never fail. However, the city probably judged that, in the extremely unlikely event of a failure, the potential lawsuits could cost far more than the fasteners.