My code approaches GLSL shader management in the way, that it creates each shader and the associated program and deletes each shader and program. I recently read http://www.
In short: after glLinkProgram() call glDeleteShader() for each shader, this marks them for deletion and when the program is no longer needed call glDeleteProgram() - this call not only deletes the program but also detaches all shaders attached to it and deletes them (if not used by any other program).
So normally you don't have to ever call glDetachShader().
Read the docs for glDeleteProgram().