Community compacts (xianggui minyue 鄉規民約, also called xianggui 鄉規, xiangyue 鄉約 or sheyue 社約) were public contracts on social conduct and mutual control and support concluded by members of village communities in traditional China. Precursors of this system of mutal support and control are found in the Confucian Classic Zhouli 周禮, where neighbourhoods had similar contracts. Community compacts had the aim to care for the appropriate behavior of each community member. Misdoings could be punished by the regular conventions, and were recorded in detail. The compacts thus took over the task of legal institutions on the level below the district administration (see magistrate), and were a kind of constitution for local self-government. In case of famine other hardship, community members had the duty to support each other. The system was worked parallel to the lijia system 里甲, by which taxes were levied, and the baojia system 保甲, which served for local self-defense.
After the foundation of the People's Republic, the system was a welcome basis for the social control on the village level, most visible in the danwei system 單位.
There were several books describing the content of such community compacts. The most important are Lü Dajun's 呂大鈞 Lüshi xiangyue 呂氏鄉約 and Wang Yangming's 王守仁 Nangan xiangyue 南贛鄉約 (also called Yangming xiansheng xiangyue fa 陽明先生鄉約法).