On Ḥol Ha-mo’ed, one may take care of communal needs, since they are considered mitzva needs and thus festival needs as well. This is true even if there will be no actual benefit seen on the festival itself. However, this is only on condition that if the matter is not taken care of on Ḥol Ha-mo’ed, it will not be taken care of at all.
Since everyone knows that such a melakha is being undertaken for the good of the community, it may be done publicly even if it involves hard work. One may even pay for the work, as it would be impossible to take care of communal needs otherwise. As with other festival needs, the permissibility is limited to unskilled labor, as skilled labor is permitted only for bodily needs on Ḥol Ha-mo’ed (MK 2a, 5a; SA 544:1-2).
In earlier times, when earning a living was tremendously difficult and nobody had the free time to volunteer to take care of communal needs, the Sages permitted pressing the community into work on Ḥol Ha-mo’ed to take care of them. For example, they allowed rain-damaged roads to be repaired. If people did not go out and fix the roads, the Sages explained, they would bear responsibility for any resulting deaths or injuries. Similarly, the Sages permitted removing rocks and other detritus that had fallen into wells and streams. All of these involve unskilled labor, and therefore were permitted even if the benefits would be felt only after the festival. Digging a new well when necessary was also permitted on Ḥol Ha-mo’ed, since it too required only unskilled labor. Grouting the well, though, which was skilled labor, was permitted only after the festival. Nevertheless, if the well water would be available and useful for the festival, then even that work was considered a bodily need. To meet bodily needs even skilled labor may be performed on Ḥol Ha-mo’ed, so the grouting was permissible (MK 4b-5a).
The rabbinic court hired emissaries to take care of certain communal needs on Ḥol Ha-mo’ed. These included the maintenance of mikva’ot, cemeteries, and fields. This was done on Ḥol Ha-mo’ed to save public funds; since people did not normally work on Ḥol Ha-mo’ed anyway, they were willing to work for less (MK 6a). The job of these emissaries included checking that each mikveh contained the 40 se’ah of water necessary for a kosher immersion. If they found a mikveh lacking the necessary volume, they would dig a channel to allow more water to flow in from a stream or well. The workers also marked graves clearly so that Kohanim would not become impure. Since these grave markers were made of lime, which sometimes faded due to rain and due to people constantly walking through, they needed to be touched up each year (MK 5a-b; SA 544:1). The workers also checked fields to make sure that no kilayim were growing in them. If they found kilayim, they would declare the field ownerless. This encouraged people to be diligent in ensuring that no kilayim grew in their fields (MK 6b).