My approach is to carry whatever I need to tighten any fasteners that are likely to work loose. I settled on a small set of selected hex keys, a pair of tiny adjustable wrenches (useful for things like cable adjustment nuts), and a little baggie of sockets with a simple, L-shaped driver. This is a very small kit and requires little space.

A bit of wire and tape, some JB weld and a few cable ties will fasten everything else until I can limp home.

Don't forget fuses.

A leatherman tool or something similar is nice for general purpose stuff - I carry that on the bike, too, so I don't have anything hard fastened to my hip if I go down. A tire pressure gauge maybe, a spare set of keys hidden away in some clever spot, and enough folding money to get me out of trouble...