Covalent organic frameworks (COFs) are a new class of porous crystalline polymers, which are considered to be excellent supports for metal nanoparticles (MNPs) due to their highly ordered structure, chemical tunability, and porosity. In this work, two novel ultra-microporous COFs, JUC−624 and JUC−625, with narrow pore size distribution have been synthesized and used for the confined growth of ultrafine Co nanoparticles (CoNPs) with high loading. In an alkaline environment, the produced materials were investigated as electrocatalysts for the hydrogen evolution reaction (HER). Electrochemical test results show that CoNPs@COFs have a Tafel slope of 84 mV·dec−1, an onset overpotential of 105 mV, and ideal stability. Remarkably, CoNPs@JUC−625 required only 146 mV of overpotential to afford a current density of 10 mA cm−2. This research will open up new avenues for making COF-supported ultrafine MNPs with good dispersity and stability for extensive applications.