AimQuantifying the relative contribution of environmental filtering versus limiting similarity in shaping communities is challenging because these processes often act simultaneously and their effect is scale‐dependent. Focusing on caves, island‐like natural laboratories with limited environmental variability and species diversity, we tested: (i) the relative contribution of environmental filtering and limiting similarity in determining community assembly in caves; (ii) how the relative contribution of these driving forces changes along environmental gradients.LocationEurope.Time periodPresent.Major taxa studiedSubterranean spiders.MethodsWe used data on distribution and traits for European cave spiders (n = 475 communities). We estimated the trait space of each community using probabilistic hypervolumes, and obtained estimations of functional richness independent of the species richness of each community via null modelling. We model functional diversity change along environmental gradients using generalized dissimilarity modelling.ResultsSixty‐three percent of subterranean spider communities exhibited a prevalence of trait underdispersion. However, most communities displayed trait dispersion that did not depart significantly from random, suggesting that environmental filtering and limiting similarity were both exerting equally weak or strong, yet opposing influences. Overdispersed communities were primarily concentrated in southern latitudes, particularly in the Dinaric karst, where there is greater subterranean habitat availability. Pairwise comparisons of functional richness across caves revealed these effects to be strongly scale‐dependent, largely varying across gradients of cave development, elevation, precipitation, entrance size and annual temperature range. Conversely, geographical distance weakly affected trait composition, suggesting convergence in traits among communities that are far apart.Main conclusionsEven systems with stringent environmental conditions maintain the potential for trait differentiation, especially in areas of greater habitat availability. Yet, the relative influence of environmental filtering and limiting similarity change with scale, along clear environmental gradients. The interplay of these processes may explain the assembly of species‐poor subterranean communities displaying high functional specialization.