Onmyōji was one of the official positions belonging to the Bureau of Onmyō of the Ministry of the Center under the ritsuryō system in ancient Japan, and was assigned as a technical officer in charge of divination and geomorphology based on the theory of the yin-and-yang five phases. In the Middle Ages and early modern period, the term was used to refer to those who performed prayers and divination in the private sector, and some of them were regarded as a kind of clergy.
From the Nara picture book "Tamamo-no-Mae," published in the early Edo period, depicting an onmyōji performing divination with counting rods. From the collection of the Kyoto University Library.
Onmyōdō is a system of natural science, astronomy, mantras, almanac, divination and magic that developed independently in Japan based on the Chinese philosophies of yin and yang and wuxing
Abe no Seimei, a famous onmyōji