When writing code that interacts with multiple shaders, is it best practice to hard code the use of each effect? I wrote a couple of hard-coded loops and then noticed that I accidentally ended the pass of the wrong shader, and this has me concerned that instead, I should be writing some sort of Shader class that generically executes a shader. Is this the right way to go?
Yes, it would be more scalable in the long run to write a system could wrap and handle what your shaders need for you.
There are several ways to do this, such as having a "Shader" class like you mentioned that inspects the underlying D3D Effect object for semantic annotations that let your wrapper class determine things like which kinds of vertex or texture input are required, begins and ends all the appropriate classes, et cetera.