My rack bolts are a big component of that, but in general most nuts and bolts seem to loosen over time, so I want to get into a better routine.
That usually means there is either insufficient torque on the fasteners, or insufficient / incorrect hardware to stay secured in that situation.
Sometimes all that is needed is loctite, sometimes special lockwashers or locknuts are required. Certain situations can call for less common solutions like castellated nuts that are used on bolts that have holes in them for a wire to be tied thru the castellations.
Sometimes things loosen because of the design of the materials being fastened together--for instance, if you have a tube that has a bolt running thru it that can compress across the tube diameter, with no internal spacer-tube from one side to the other to prevent it, then the fastener will squish the tube, and so will never be tightened properly. Worse, if the fastener secures something else to that tube in a way that the other thing can apply torque against the tube face via the fastener inboard face(s), it can pry the tube and fastener and sqush the tube more, and then the system is not tensioned at all and things can just move around however, making it worse (since now the fastener can actually wear the hole in the fastened things so it's larger than the fastener diameter, until eventually it tears thru one of them).
Sometimes they loosen because the entire method used to connect things together is wrong, and can never resist the applied forces. Rack mounting hardware is commonly poorly designed for it's purpose, since it is usualy more important to the designer that the rack fits more types of bike frames (that don't have dedicated hardpoints for it) than that it stay attached to any of them. (also a problem for hubmotors and torque arm solutions).
Sometimes they loosen because the materials themselves are just not capable of withstanding the forces applied to them at that point, so they deform at the interface and the fasteners are then free to rotate, etc.
A routine to maintain the problems so they don't actually fail does prevent the failure...but fixing the root cause can mean not needing to check them.
FWIW, aircraft have maintenance schedules with different inspection intervals for different parts because of wear or fatigue issues known on those parts and systems; if you follow this kind of setup and note down how long it takes for certain things to loosen or deform, etc., then make up a maintenance schedule based on those, you can be more sure of not having problems without spending as much time doing maintenance, if there are few things that need checking at any one time.
Or you can simply note the shortest interval between any issues, and recheck everything at that interval, to simplify the scheduling.
Or something in between.
When I am experimenting with a new build I usually have to replace parts that fall off
at first, until I redesign those parts (or use different fasteners) to not have that problem, until I eventually reach the point at which I can ignore the whole thing except for known maintenance rquirements such as greasing things, airing up tires, recharging batteries. But not fasteners...they just stay where they should.
BTW, loctite comes in multiple types for different situations and usages. Be sure you use the kind you need, or it may not do the job, or may make it difficult or impossible to remove a fastener when you do need to. It also is designed to work on clean surfaces, so if you have something in a place that gets lubrication (intentionally or not) then if it didn't get loctited before being lubricated, it's probalby not going to stay secured as well as it would if it had.