You should regularly inspect your cables for fraying. Fraying will usually occur below anchor bolts, at the end of a cable, or near the cable hanger. When working with cables the ideal tools you will need are Wire Cutters, Cable Cutters and a Fourth-hand Tool.
Cutting standard cable housing:
When replacing the outer cable housing, measure it against the old one so that you get the correct length. Then squeeze the cutter lightly so the jaws slide between the coils of the wire. Then carefully squeeze the cutters to cut the wire. Clean up the jagged end of the wire with the cutters before fitting it.
You should fit cable housings with a metal ferrule at each end. These ensure that the housings seat squarely in cable stops. Trying to fit a new inner cable into an outer housing with a damaged end will cause it to fray. If this happens, pull the inner cable out of the housing and try to re-cut the damaged end.
You can tension cables with a fourth-hand tool, this tool gives you greater control. When fitting a new cable once you've checked that your derailleur and/or brakes are working properly. Cut off any spare cable that may be left and put an end cap on the end of the cable.