Background: Organising health-care services for residents living in care homes is an important area of development in the UK and elsewhere. Medical care is provided by general practitioners in the UK, and the unique arrangement of the NHS means that general practitioners are also gatekeepers to other health services. Despite recent focus on improving health care for residents, there is a lack of knowledge about the role of general practitioners. Objectives: First, to review reports of research and quality improvement (or similar change management) in care homes to explore how general practitioners have been involved. Second, to develop programme theories explaining the role of general practitioners in improvement initiatives and outcomes. Design: A realist review was selected to address the complexity of integration of general practice and care homes. Setting: Care homes for older people in the UK, including residential and nursing homes. Participants: The focus of the literature review was the general practitioner, along with care home staff and other members of multidisciplinary teams. Alongside the literature, we interviewed general practitioners and held consultations with a Context Expert Group, including a care home representative. Interventions: The primary search did not specify interventions, but captured the range of interventions reported. Secondary searches focused on medication review and end-of-life care because these interventions have described general practitioner involvement. Outcomes: We sought to capture processes or indicators of good-quality care. Data sources: Sources were academic databases [including MEDLINE, EMBASE™ (Elsevier, Amsterdam, the Netherlands), Cumulative Index to Nursing and Allied Health Literature, PsycInfo® (American Psychological Association, Washington, DC, USA), Web of Science™ (Clarivate Analytics, Philadelphia, PA, USA) and Cochrane Collaboration] and grey literature using Google Scholar (Google Inc., Mountain View, CA, USA). Methods: Realist And Meta-narrative Evidence Syntheses: Evolving Standards (RAMESES) guidelines were followed, comprising literature scoping, interviews with general practitioners, iterative searches of academic databases and grey literature, and synthesis and development of overarching programme theories. Results: Scoping indicated the distinctiveness of the health and care system in UK and, because quality improvement is context dependent, we decided to focus on UK studies because of potential problems in synthesising across diverse systems. Searches identified 73 articles, of which 43 were excluded. To summarise analysis, programme theory 1 was ‘negotiated working with general practitioners’ where other members of the multidisciplinary team led initiatives and general practitioners provided support with the parts of improvement where their skills as primary care doctors were specifically required. Negotiation enabled matching of the diverse ways of working of general practitioners with diverse care home organisations. We found evidence that this could result in improvements in prescribing and end-of-life care for residents. Programme theory 2 included national or regional programmes that included clearly specified roles for general practitioners. This provided clarity of expectation, but the role that general practitioners actually played in delivery was not clear. Limitations: One reviewer screened all search results, but two reviewers conducted selection and data extraction steps. Conclusions: If local quality improvement initiatives were flexible, then they could be used to negotiate to build a trusting relationship with general practitioners, with evidence from specific examples, and this could improve prescribing and end-of-life care for residents. Larger improvement programmes aimed to define working patterns and build suitable capacity in care homes, but there was little evidence about the extent of local general practitioner involvement. Future work: Future work should describe the specific role, capacity and expertise of general practitioners, as well as the diversity of relationships between general practitioners and care homes. Study registration: This study is registered as PROSPERO CRD42019137090. Funding: This project was funded by the National Institute for Health Research (NIHR) Health Services and Delivery Research programme and will be published in full in Health Services and Delivery Research; Vol. 9, No. 20. See the NIHR Journals Library website for further project information.