Introduction: Medical education continues to diversify its settings. For postgraduate trainees, moving across diverse settings, especially community-based rotations, can be challenging personally and professionally. Competent performance is embedded in context; as a result, trainees who move to new contexts are challenged to use their knowledge, skills and experience to adjust. What trainees need to adapt to and what that requires of them are poorly understood. This research takes a capability approach to understand how trainees entering a new setting develop awareness of specific contextual changes that they need to navigate and learn from. Methods: We used constructivist grounded theory with in-depth interviews. A total of 29 trainees and recent graduates from three internal medicine training programmes in Canada participated. All participants had completed at least one community-based rotation geographically far from their home training site. Interviews were recorded, transcribed and anonymised. The interview framework was adjusted several times following initial data analysis. Results: Contextual competence results from trainees’ ability to attend to five key stages. Participants had first to meet their physiological and practical needs, followed by developing a sense of belonging and legitimacy, which paved the way for a re-constitution of competence and appropriate autonomy. Trainee's attention to these stages of adaptation was facilitated by a process of continuously moving between using their knowledge and skill foundation and recognising where and when contextual differences required new learning and adaptations. Discussion: An ability to recognise contextual change and adapt accordingly is part of Nussbaum and Sen's concept of capability development. We argue this key skill has not received the attention it deserves in current training models and in the support postgraduate trainees receive in practice. Recommendations include supporting residents in their capability development by debriefing their experiences of moving between settings and supporting clinical teachers as they actively coach residents through this process.