Al-Kāfi

Hadith 868
grave-visitation
2ـ عِدَّةٌ مِنْ أَصْحَابِنَا عَنْ أَحْمَدَ بْنِ مُحَمَّدٍ عَنْ عُثْمَانَ بْنِ عِيسَى عَنْ سَمَاعَةَ قَالَ سَأَلْتُهُ عَنْ زِيَارَةِ الْقُبُورِ وَبِنَاءِ الْمَسَاجِدِ فِيهَا فَقَالَ أَمَّا زِيَارَةُ الْقُبُورِ فَلاَ بَأْسَ بِهَا وَلاَ تُبْنَى عِنْدَهَا الْمَسَاجِدُ.
2. A number of our people have narrated from Ahmad ibn Muhammad from ‘Uthman ibn ‘Isa that Sama‘ah said: "I asked him (Imam al-Sadiq) about visiting graves and building Masjids therein. He said, 'As for the visitation of graves, there is no issue with it, but a masjid should not be built there.'"
Source: Shaykh Muḥammad b. Yaʿqūb al-Kulaynī