Wiktionary
by the skin of one's teeth
prep.phr. (context idiomatic English) barely; closely; by a narrow margin; with nothing to spare.