Photoelectrochemical hydrogen evolution reaction (HER) and electrochemical reduction of carbon dioxide (CO2RR) to chemical fuels have the potential to relieve the energy problem. The performance of these devices depends intimately on the properties of their materials. Herein we modify the inorganic sulfide by organic polymer molecules and thus improve the electronic and band structure, optimization the overall hydrogen evolution performance. Meanwhile, earth-abundant first-row (3d) transition-metal-based catalysts have been developed for the oxygen-evolution reaction (OER); however, they operate at overpotentials significantly above thermodynamic requirements. Density functional theory suggested that non-3d high-valency metals such as tungsten can modulate 3d metal oxides, providing near-optimal adsorption energies for OER intermediates. We developed a room-temperature synthesis to produce gelled oxy-hydroxide materials with an atomically homogeneous metal distribution. These gelled FeCoW oxy-hydroxide exhibits the lowest overpotential (191 mV) reported at 10 milliamperes per square centimeter in alkaline electrolyte. The catalyst shows no evidence of degradation following more than 500 hours of operation. X-ray absorption and computational studies reveal a synergistic interplay between W, Fe and Co in producing a favorable local coordination environment and electronic structure that enhance the energetics for OER. We also used in operando soft X-ray absorption to quantify the ratio of the Ni4+ and Ni2+ active site, achieved an OER overpotential of only 330 mV under neutral condition, better than novel metal oxide catalyst, IrO2, with ideal stability within 100 h. With the modulating of 3d coordination environment and electronic structure, maximum optimization the energetics of oxygen evolution reaction, we finally achieved the lowest over potential for OER and hence improved the HER efficiency. Furthermore, we engineered the metal sites by using non-metal element and which significantly improved the efficiency of CO2RR to formate.