We discuss a model-independent estimator of the likelihood of the compositeness of a shallow S-wave bound or virtual state. The approach is based on an extension of Weinberg’s relations in Weinberg (Phys Rev 137:B672, 1965) and it relies only on the proximity of the energy of the state to the two-hadron threshold to which it significantly couples. The scheme only makes use of the experimental scattering length and the effective range low energy parameters, and it is shown to be fully consistent for predominantly molecular hadrons. As explicit applications, we analyse the case of the deuteron, the $$^1\mathrm{S}_0$$
1
S
0
nucleon-nucleon virtual state and the exotic $$D^{*}_{s0}(2317)^\pm $$
D
s
0
∗
(
2317
)
±
, and find strong support to the molecular interpretation in all cases. Results are less conclusive for the $$D^{*}_{s0}(2317)^\pm $$
D
s
0
∗
(
2317
)
±
, since the binding energy of this state would be significantly higher than that of the deuteron, and the approach employed here is at the limit of its applicability. We also qualitatively address the case of the recently discovered $$T_{cc}^+$$
T
cc
+
state, within the isospin limit to avoid the complexity of the very close thresholds $$D^0D^{*+}$$
D
0
D
∗
+
and $$D^+D^{*0}$$
D
+
D
∗
0
, which could mask the ingredients of the approach proposed in this work.