The Ramban's famous commentary explains that 'do what is right and good' fills in the gaps left by explicit commandments — the Torah cannot enumerate every situation, so this verse demands that a person act with goodness and compromise even beyond what the law technically requires.
וּלְרַבּוֹתֵינוּ בָּזֶה מִדְרָשׁ יָפֶה, אָמְרוּ זוֹ פְּשָׁרָה וְלִפְנִים מִשּׁוּרַת הַדִּין. וְהַכַּוָּנָה בָּזֶה כִּי מִתְּחִלָּה אָמַר שֶׁתִּשְׁמֹר חֻקּוֹתָיו וְעֵדֹתָיו אֲשֶׁר צִוְּךָ, וְעַתָּה יֹאמַר גַּם בַּאֲשֶׁר לֹא צִוְּךָ תֵּן דַּעְתְּךָ לַעֲשׂוֹת הַטּוֹב וְהַיָּשָׁר בְּעֵינָיו, כִּי הוּא אוֹהֵב הַטּוֹב וְהַיָּשָׁר. וְזֶה עִנְיָן גָּדוֹל, לְפִי שֶׁאִי אֶפְשָׁר לְהַזְכִּיר בַּתּוֹרָה כָּל הַנְהָגוֹת הָאָדָם עִם שְׁכֵנָיו וְרֵעָיו וְכָל מַשָּׂאוֹ וּמַתָּנוֹ וְתִקּוּנֵי הַיִּשּׁוּב וְהַמְּדִינוֹת כֻּלָּם. חָזַר לוֹמַר בְּדֶרֶךְ כְּלָל שֶׁיַּעֲשֶׂה הַטּוֹב וְהַיָּשָׁר בְּכָל דָּבָר עַד שֶׁיִּכָּנֵס בָּזֶה הַפְּשָׁרָה וְלִפְנִים מִשּׁוּרַת הַדִּין, וּכְגוֹן מַה שֶׁהִזְכִּירוּ בְּדִינָא דְּבַר מִצְרָא (ב"מ קח), וַאֲפִלּוּ מָה שֶׁאָמְרוּ (יומא פו) פִּרְקוֹ נָאֶה וְדִבּוּרוֹ בְּנַחַת עִם הַבְּרִיּוֹת, עַד שֶׁיִּקָּרֵא בְּכָל עִנְיָן תָּם וְיָשָׁר:
They have said: “[That which is right and good] refers to a compromise and going beyond the requirement of the letter of the law.” The intent of this is as follows: At first he [Moses] stated that you are to keep His statutes and His testimonies which He commanded you, and now he is stating that even where He has not commanded you, give thought, as well, to do what is good and right in His eyes for He loves the good and the right. Now this is a great principle, for it is impossible to mention in the Torah all aspects of man’s conduct with his neighbors and friends, and all his various transactions, and the ordinances of all societies and countries. But since He mentioned many of them — such as, Thou shalt not go up and down as a talebearer; Thou shalt not take vengeance, nor bear any grudge; neither shalt thou stand idly by the blood of thy neighbor; Thou shalt not curse the deaf; Thou shalt rise up before the hoary head and the like — he reverted to state in a general way that, in all matters, one should do what is good and right including even compromise and, going beyond the requirements of the law. Other examples are the Rabbis’ ordinances concerning the prerogative of a neighbor, and even what they said [concerning the desirability] that one’s youthful reputation be unblemished, and that one’s conversation with people be pleasant. Thus [a person must seek to refine his behavior] in every form of activity, until he is worthy of being called “good and upright.”