One may not build a synagogue on Ḥol Ha-mo’ed even if the community has nowhere nice to pray, and even if by building on Ḥol Ha-mo’ed, they will be able to complete the building in time to use it during the festival. It is still prohibited since building the synagogue involves skilled labor (Rema 544:1; see above, 11:18, for circumstances under which a non-Jew may build it).
In contrast, if there is an active synagogue where a problem with the electricity or air conditioning is making people very uncomfortable, it may be repaired by a professional. Since the synagogue is active and people are suffering because of the malfunction, the repair is considered a bodily need (SSK 68:9 and notes 27, 30).
Just as one may not build a synagogue on Ḥol Ha-mo’ed, so too, one may not build or repair schools or other public buildings, since doing so involves skilled labor, which is permissible only to take care of bodily needs on the festival. However, if a school building needs painting or repair (whether the building itself or the furnishings), the work may be done on Ḥol Ha-mo’ed, on condition that delaying the work until after Ḥol Ha-mo’ed would mean the classrooms or beit midrash would be unusable for a while and would cause Torah study time to be lost. This loss qualifies as a davar ha-aved. If possible, the work should be done by a Jewish worker lacking food, or by a non-Jew. It should also be done as discreetly as possible (Sdei Ḥemed, Aseifat Dinim, Ma’arekhet Ḥol Ha-mo’ed §2; MB 543:1; SSK 67:3-4).
If a roof guard rail (ma’akeh) has come down on Ḥol Ha-mo’ed, the railing may be fixed using unskilled labor, because putting up a railing is a mitzva. As we have seen, it is permitted to do unskilled labor on Ḥol Ha-mo’ed for a mitzva need. If it cannot be fixed with unskilled labor, the roof should be sealed off. However, if it cannot be sealed off and people might go up to the roof, thus endangering themselves, then putting up the railing is considered a time-sensitive mitzva, and may be done even using skilled labor (SA 540:1; BHL s.v “ve-khen im”).