Knabe's theorem lower bounds the spectral gap of a one dimensional frustration-free local hamiltonian in terms of the local spectral gaps of finite regions. It also provides a local spectral gap threshold for hamiltonians that are gapless in the thermodynamic limit, showing that the local spectral gap much scale inverse linearly with the length of the region for such systems. Recent works have further improved upon this threshold, tightening it in the one dimensional case and extending it to higher dimensions. Here, we show a local spectral gap threshold for frustration-free hamiltonians on a finite dimensional lattice, that is optimal up to a constant factor that depends on the dimension of the lattice. Our proof is based on the detectability lemma framework and uses the notion of coarse-grained hamiltonian (introduced in [Phys. Rev. B 93, 205142]) as a link connecting the (global) spectral gap and the local spectral gap.