Nucleic acid sensor elements are proving increasingly useful in biotechnology and biomedical applications. A number of ligand-sensing, conformational-switching ribozymes (also known as allosteric ribozymes or aptazymes) have been generated by some combination of directed evolution or rational design. Such sensor elements typically fuse a molecular recognition domain (aptamer) with a catalytic signal generator (ribozyme). Although the rational design of aptazymes has begun to be explored, the relationships between the thermodynamics of aptazyme conformational changes and aptazyme performance in vitro and in vivo have not been examined in a quantitative framework. We have therefore developed a quantitative and predictive model for aptazymes as biosensors in vitro and as riboswitches in vivo. In the process, we have identified key relationships (or dimensionless parameters) that dictate aptazyme performance, and in consequence, established equations for precisely engineering aptazyme function. In particular, our analysis quantifies the intrinsic trade-off between ligand sensitivity and the dynamic range of activity. We were also able to determine how in vivo parameters, such as mRNA degradation rates, impact the design and function of aptazymes when used as riboswitches. Using this theoretical framework we were able to achieve quantitative agreement between our models and published data. In consequence, we are able to suggest experimental guidelines for quantitatively predicting the performance of aptazyme-based riboswitches. By identifying factors that limit the performance of previously published systems we were able to generate immediately testable hypotheses for their improvement. The robust theoretical framework and identified optimization parameters should now enable the precision design of aptazymes for biotechnological and clinical applications.