We study decoherence effects in qubits coupled to environments that exhibit resonant frequencies in their spectral function. We model the coupling of the qubit to its environment via the Caldeira-Leggett formulation of quantum dissipation/coherence, and study the simplest example of decoherence effects in circuits with resonances such as a dc SQUID phase qubit in the presence of an isolation circuit, which is designed to enhance the coherence time. We emphasize that the spectral density of the environment is strongly dependent on the circuit design, and can be engineered to produce longer decoherence times. We begin with a general discussion of superconducting qubits such as the flux qubit, the Cooper pair box and the phase qubit and show that in these kinds of systems appropriate circuit design can greatly modify the spectral density of the environment and lead to enhancement of decoherence times. In the particular case of the phase qubit, for instance, we show that when the frequency of the qubit is at least two times larger than the resonance frequency of the environmental spectral density, the decoherence time of the qubit is a few orders of magnitude larger than that of the typical ohmic regime, where the frequency of the qubit is much smaller than the resonance frequency of the spectral density. In addition, we demonstrate that the environment does not only affect the decoherence time, but also the frequency of the transition itself, which is shifted from its environment-free value. Second, we show that when the qubit frequency is nearly the same as the resonant frequency of the environmental spectral density, an oscillatory non-Markovian decay emerges, as the qubit and its environment self-generate Rabi oscillations of characteristic time scales shorter than the decoherence time.