The flow of gases in your base is a very crucial thing. A properly designed colony will minimize any problems, even if an undesirable substance enters the system. The basis is the proper construction of ordinary tiles and those that let gases through. When building new rooms, remember to create spacious entrances. When building vertically, especially with ladders, dig out one or two empty fields (one for each side of the ladder). Duplicates can jump one field from the ladder and onto a segment. In this case, the air produced in the lower parts will move faster than it would in the narrow passages.
Speaking of oxygen production. Let your oxygen-emitting machines be in a few different places, not in one single cluster, and always put them at the lowest levels of the base. They are not very nice to the eye and produce heat, so you do not want them inside your colony. In addition to the wide entrances to rooms and higher or lower levels, build gas-permeable tiles in the floors (especially the floor is very long). As a result, the oxygen will rise higher and the carbon dioxide and chlorine will drop to the lowest levels. Remember that oxygen is a light gas, build your bedrooms on higher levels so that they always have enough air for your duplicates to breathe. Thanks to such tiles on the bedroom floors, CO2 will fall down at night and will not interfere with the sleep of the duplicates. However, do not exaggerate with the quantity of these tiles, because it negatively affects the decor factor.
Hydrogen is a gas that floats over oxygen. Therefore, build a room at the top in a staircase pattern, just like a loft in a real detached house. This way, the gas will gather at the ceiling. Put a pump and a filter there, and transport the hydrogen out of the base or to the hydrogen generator. Chlorine, on the other hand, is a heavy gas, but it still hovers over carbon dioxide. Take note of what you are building on lower levels of the base. It is worth to place objects there that require minimum attention from the duplicates, such as a room with batteries.
Remember to build airlocks! This way, you will avoid massive outflows of precious oxygen and you will prevent other dangerous gases from entering the base. They do not cost much, and are very easy to control. It is best to build them only in a few necessary places. Duplicates will then minimize the losses in air. You can go one step further and create airlocks in the basement. Carbon dioxide will then begin to escape, although you will reduce the working time of your duplicants outside of the base.