Q Others used to advise periodically defragmenting files on your startup drive, and you used to recommend defragmenting its free disk space. Do these still apply to El Capitan, and if so, how should I do them?
A These are traditional housekeeping measures which were once considered to be very important to optimise performance in OS X and its applications.
The theory behind defragmenting files is that reading from hard drives is quickest when the drive does not have to keep chasing fragments of the file which have become scattered to different parts of the drive. The theory behind defragmenting free space is to ensure that OS X and applications can obtain contiguous areas of free disk space for their scratch and working files, again to improve their speed of access.
These have become progressively less important as OS X has become better at performing its own background housekeeping to minimise the fragmentation of files, and as SSDs have become more widely used. You should never attempt to defragment files or free space on an SSD: that would be pointless, and would shorten its working life.
If you use an SSD as your startup drive, or have a Fusion Drive, you definitely need not worry about file or free space fragmentation.
If you still start up from a normal hard drive, then there might be some benefits in periodic defragmentation. But it is more important to keep ample free space, so that OS X can do its housekeeping, and obtain the scratch file space it needs.
The other side to this is that El Capitan is not as easy to defragment either. There are still some file defragmentation tools, but I would be wary of using them at present. The old trick of cloning your startup drive to an external disk, and cloning it back to the startup drive, is now fraught, and could leave you with a system which cannot boot from either drive. This is because of the way that the Recovery partition is implemented, and gets to be more of a problem if you are using a Fusion Drive.
So for the moment, probably with Yosemite and certainly with El Capitan, you should keep ample drive space free, but not worry about defragmenting either files or free space. That should keep life simple, reliable, and stress-free.