We present an approach to derive effective shell-model interactions from microscopic nuclear forces. The similarity-transformed coupled-cluster Hamiltonian decouples the single-reference state of a closed-shell nucleus and provides us with a core for the shell model. We use a second similarity transformation to decouple a shell-model space from the excluded space. We show that the three-body terms induced by both similarity transformations are crucial for an accurate computation of ground and excited states. As a proof of principle we use a nucleon-nucleon interaction from chiral effective field theory, employ a $^4$He core, and compute low-lying states of $^{6-8}$He and $^{6-8}$Li in $p$-shell model spaces. Our results agree with benchmarks from full configuration interaction.