Rap proteins in Bacillus subtilis regulate the phosphorylation level or the DNA-binding activity of response regulators such as Spo0F, involved in sporulation initiation, or ComA, regulating competence development. Rap proteins can be inhibited by specific peptides generated by the export-import processing pathway of the Phr proteins. Rap proteins have a modular organization comprising an amino-terminal alpha-helical domain connected to a domain formed by six tetratricopeptide repeats (TPR). In this study, the molecular basis for the specificity of the RapA phosphatase for its substrate, phosphorylated Spo0F (Spo0F∼P), and its inhibitor pentapeptide, PhrA, was analyzed in part by generating chimeric proteins with RapC, which targets the DNA-binding domain of ComA, rather than Spo0F∼P, and is inhibited by the PhrC pentapeptide. In vivo analysis of sporulation efficiency or competence-induced gene expression, as well as in vitro biochemical assays, allowed the identification of the amino-terminal 60 amino acids as sufficient to determine Rap specificity for its substrate and the central TPR3 to TPR5 (TPR3-5) repeats as providing binding specificity toward the Phr peptide inhibitor. The results allowed the prediction and testing of key residues in RapA that are essential for PhrA binding and specificity, thus demonstrating how the widespread structural fold of the TPR is highly versatile, using a common interaction mechanism for a variety of functions in eukaryotic and prokaryotic organisms.