Posted this video before, but in light of the recent events of the carrier crew being taken off their ship in the yards, this seems appropriate. On every ship, large or small, there are a number of people who should regularly looking at the berthing, sanitary facilities, and working compartments which make up the "home" for any sailor on board. Corpsmen, leading Petty Officers, Division Chief Petty Officers, Division Officers, Department Heads, the XO, and the CO should all be making visits to the these spaces, with the most junior being there daily and the most senior inspecting as schedules permit. It is by this system of routine inspections that every sailor should be provided a clean, well-maintained living and working space. When this system breaks down, living conditions can quickly become appallingly bad.
Upon finding that condition are unsatisfactory, the reasons for those conditions need to be taken up the chain of command promptly. "Take care of your people" is a mantra driven into leaderhip from the first days of service. Sometimes it is too easy to forget this concept when things get hectic, but the systematic inspection and discussion with your sailors ought to drive the effort to keep up the high standards required for a clean and healthy ship.
There is no doubt that extended yard periods eat in every aspect of morale and readiness and every effort must be made to use these periods for getting sailors off the ship - to ahsore training, to temporary duty on other ships for OJT, to moving the crew off the ship. This is not a new problem, reading the history of the mannning of ships 200 years ago (or longer) reveals the very same problems. Perhaps it's time to change how we do things.
Always see Ref A.