The Gemara derives from 'And you shall make known to them the path they shall walk and the deeds they shall do' (Exodus 18:20) the obligation to go lifnim mishurat hadin — beyond the strict line of the law. This is contrasted with strict din, which is the minimum legal requirement.
דְּתָנֵי רַב יוֹסֵף: ״וְהוֹדַעְתָּ לָהֶם״ – זֶה בֵּית חַיֵּיהֶם, ״אֶת הַדֶּרֶךְ״ – זוֹ גְּמִילוּת חֲסָדִים, ״אֲשֶׁר יֵלְכוּ״ – זֶה בִּיקּוּר חוֹלִים, ״בָּהּ״ – זוֹ קְבוּרָה, ״וְאֶת הַמַּעֲשֶׂה״ – זֶה הַדִּין, ״אֲשֶׁר יַעֲשׂוּן״ – זוֹ לִפְנִים מִשּׁוּרַת הַדִּין. אֲשֶׁר יַעֲשׂוּן זוֹ לִפְנִים מִשּׁוּרַת הַדִּין. דְּאָמַר רַבִּי יוֹחָנָן: לֹא חָרְבָה יְרוּשָׁלַיִם אֶלָּא עַל שֶׁדָּנוּ בָּהּ דִּין תּוֹרָה. אֶלָּא דִּינֵי דְּמָגִיזְתָּא לְדַיְּינוּ?! אֶלָּא אֵימָא: שֶׁהֶעֱמִידוּ דִּינֵיהֶם עַל דִּין תּוֹרָה וְלָא עֲבַדוּ לִפְנִים מִשּׁוּרַת הַדִּין.
The Gemara cites a source for going beyond the letter of the law in the performance of mitzvot. As Rav Yosef taught in a baraita with regard to the verse: “And you shall teach them the statutes and the laws, and shall show them the path wherein they shall walk and the action that they must perform” (Exodus 18:20). The baraita parses the various directives in the verse. “And you shall teach them,” that is referring to the structure of their livelihood, i.e., teach the Jewish people trades so that they may earn a living; “the path,” that is referring to acts of kindness; “they shall walk,” that is referring to visiting the ill; “wherein,” that is referring to burial; “and the action,” that is referring to acting in accordance with the letter of the law; “that they must perform,” that is referring to acting beyond the letter of the law. It was taught in the baraita: “That they must perform”; that is referring to acting beyond the letter of the law, as Rabbi Yoḥanan says: Jerusalem was destroyed only for the fact that they adjudicated cases on the basis of Torah law in the city. The Gemara asks: Rather, what else should they have done? Should they rather have adjudicated cases on the basis of arbitrary decisions [demagizeta]? Rather, say: That they established their rulings on the basis of Torah law and did not go beyond the letter of the law.