Skin and soft tissue infection (SSTIs) due to Staphylococcus aureus, particularly community-associated methicillin-resistant Staphylococcus aureus (CA-MRSA), are common in human immunodeficiency virus (HIV)-infected populations in the United States. Studies have differed as to the importance of epidemiological and immunological factors in this relationship, and have employed conflicting strategies for variable selection in multivariate analyses. Developments in causal inference methods in epidemiology have emerged in the last decade to clarify relationships between variables and identify appropriate variables to include in and exclude from multivariate analysis. In this paper, we develop a causal diagram to clarify the pathways linking CA-MRSA and HIV. We focus on the role played by trimethoprim-sulfamethoxazole (TMP-SMX) prophylaxis, prescribed to many severely immunocompromised HIV patients and potentially protective against SSTIs, which both mediates and moderates the relationship between immunological parameters and SSTI risk. We demonstrate, using simulated data, that statistical models may yield biased results if they do not account for how HIV viral load may also be a marker of adherence to TMP-SMX prophylaxis. We conclude with a proposed causal model that includes both the epidemiological as well as immunological factors that may explain the increased risk of initial and recurrent SSTI risk in HIV-infected populations.