Yakkhas are local spirits or deities who, in the suttas, are only occasionally malevolent. They represent one aspect of local, indigenous spirits, and are closely associated with the feminine aspects of fertility and child-raising. Unlike the brahmins, their order does not appear to have been strongly patriarchal, and can be considered as an example of the ancient matriarchal earth goddesses. Their worship was widespread in ancient India (as still today).
It is surely no coincidence that they repeatedly are depicted as having a special faith in nuns (eg SN 10.9, SN 10.10, SN 10.11). One of the standard conversion narratives throughout early Buddhist history was how the cruel and pointless sacrifice was replaced with the rational and compassionate practice of dāna.
On one occasion the Blessed One was dwelling at Rājagaha in the Bamboo Grove, the Squirrel Sanctuary. Now on that occasion a certain lay follower gave a robe to the nun Cīrā. Then a spirit who had full confidence in the nun Cīrā, going from street to street and from square to square in Rājagaha, on that occasion recited this verse:
“He has made much merit—
Wise indeed is this lay follower,
Who just gave a robe to Cīrā,
One released from all the bonds.”