HAYASHAR V'HATOV
(יח) וְעָשִׂ֛יתָ הַיָּשָׁ֥ר וְהַטּ֖וֹב בְּעֵינֵ֣י ה' לְמַ֙עַן֙ יִ֣יטַב לָ֔ךְ וּבָ֗אתָ וְיָֽרַשְׁתָּ֙ אֶת־הָאָ֣רֶץ הַטֹּבָ֔ה אֲשֶׁר־נִשְׁבַּ֥ע ה' לַאֲבֹתֶֽיךָ׃ (יט) לַהֲדֹ֥ף אֶת־כׇּל־אֹיְבֶ֖יךָ מִפָּנֶ֑יךָ כַּאֲשֶׁ֖ר דִּבֶּ֥ר ה'׃ {ס}
(18) Do what is right and good in the sight of the LORD, that it may go well with you and that you may be able to possess the good land that the LORD your God promised on oath to your fathers, (19) and that all your enemies may be driven out before you, as the LORD has spoken.

What is the difference between Yashar and Tov?

It would also seem that a requirement of living in the land of Israel is doing right and good. Why is that the specific requirement?

(א) ועשית הישר והטוב בעיני ה' על דרך הפשט יאמר תשמרו מצות השם ועדותיו וחקותיו ותכוין בעשייתן לעשות הטוב והישר בעיניו בלבד ו למען ייטב לך הבטחה יאמר כי בעשותך הטוב בעיניו ייטב לך כי השם מטיב לטובים ולישרים בלבותם.

ולרבותינו בזה מדרש יפה אמרו זו פשרה ולפנים משורת הדין והכוונה בזה כי מתחלה אמר שתשמור חקותיו ועדותיו אשר צוך ועתה יאמר גם באשר לא צוך תן דעתך לעשות הטוב והישר בעיניו כי הוא אוהב הטוב והישר וזה ענין גדול לפי שאי אפשר להזכיר בתורה כל הנהגות האדם עם שכניו ורעיו וכל משאו ומתנו ותקוני הישוב והמדינות כלם אבל אחרי שהזכיר מהם הרבה כגון לא תלך רכיל (ויקרא יט טז) לא תקום ולא תטור (שם פסוק יח) ולא תעמוד על דם רעך (שם פסוק טז) לא תקלל חרש (שם פסוק יד) מפני שיבה תקום (שם פסוק לב) וכיוצא בהן חזר לומר בדרך כלל שיעשה הטוב והישר בכל דבר עד שיכנס בזה הפשרה ולפנים משורת הדין וכגון מה שהזכירו בדינא דבר מצרא (ב"מ קח) ואפילו מה שאמרו (יומא פו) פרקו נאה ודבורו בנחת עם הבריות עד שיקרא בכל ענין תם וישר:

(1) AND THOU SHALT DO THAT WHICH IS RIGHT AND GOOD IN THE SIGHT OF THE ETERNAL. In line with the plain meaning of Scripture the verse says, “Keep the commandments of G-d, His testimonies, and His statutes, and, in observing them, intend to do what is right and good in His sight only.” And [the expression in the verse before us] that it may be well with thee is a promise, stating that, when you will do that which is good in His eyes, it will be well with you, for G-d does good unto the good, and to them that are upright in their hearts. Our Rabbis have a beautiful Midrash on this verse. 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.”
(יהושע י, יג) וידום השמש וירח עמד עד יקום גוי אויביו הלא היא כתובה על ספר הישר מאי ספר הישר א"ר חייא בר אבא א"ר יוחנן זה ספר אברהם יצחק ויעקב שנקראו ישרים שנא' (במדבר כג, י) תמות נפשי מות ישרים
§ The Gemara cites a series of expositions with regard to what is called the book of Yashar. The verse states: “And the sun stood still, and the moon stayed, until the nation had avenged themselves of their enemies. Is this not written in the book of Yashar”? (Joshua 10:13). The Gemara asks: What is the book of Yashar? Rabbi Ḥiyya bar Abba says that Rabbi Yoḥanan says: This is Genesis, which is the book of Abraham, Isaac, and Jacob, who were called righteous [yesharim], as it is stated: “Let me die the death of the righteous [yesharim]” (Numbers 23:10).

What makes Genesis more "righteous" than any of the other books?

I think this refers to the fact that they understood the will of G-d and did what He wanted them to do, even though it wasn't written clearly in the text.

This informs the original verse, saying that even if there isn't a specific commandment to do something, we should do it (c.f. the Ramban).

WHAT IS CORRECT IN YOUR EYES V DOING RIGHTEOUS THINGS
(ח) לֹ֣א תַעֲשׂ֔וּן כְּ֠כֹ֠ל אֲשֶׁ֨ר אֲנַ֧חְנוּ עֹשִׂ֛ים פֹּ֖ה הַיּ֑וֹם אִ֖ישׁ כׇּל־הַיָּשָׁ֥ר בְּעֵינָֽיו׃
(8) You shall not act at all as we now act here, every man as he pleases,

איש כל הישר בעיניו, נְדָרִים וּנְדָבוֹת, שֶׁאַתֶּם מִתְנַדְּבִים עַ"יְ שֶׁיָּשָׁר בְּעֵינֵיכֶם לַהֲבִיאָם וְלֹא עַ"יְ חוֹבָה, אוֹתָם תַּקְרִיבוּ בַּבָּמָה (שם; זבחים קי"ז):

איש כל הישר בעיניו, “every man whatsoever is right in his eyes” — vows and free-will offerings which you dedicate because it is pleasing in your eyes to bring them, and not because of an obligation imposed upon you, such may you offer on Bamahs, but not sacrifices that are to be offered in consequence of an obligation (sin and guilt offerings) (Sifrei Devarim 65:4; Zevachim 117b).

It is clear that doing what is right in your eyes is something that you feel is subjectively correct even though it may not be correct on an objective level, and possibly even if it is not correct on an a communal level, but correct on an individual level.

(ג) וַיֹּ֨אמֶר ל֜וֹ אָבִ֣יו וְאִמּ֗וֹ הַאֵין֩ בִּבְנ֨וֹת אַחֶ֤יךָ וּבְכׇל־עַמִּי֙ אִשָּׁ֔ה כִּֽי־אַתָּ֤ה הוֹלֵךְ֙ לָקַ֣חַת אִשָּׁ֔ה מִפְּלִשְׁתִּ֖ים הָעֲרֵלִ֑ים וַיֹּ֨אמֶר שִׁמְשׁ֤וֹן אֶל־אָבִיו֙ אוֹתָ֣הּ קַֽח־לִ֔י כִּי־הִ֖יא יָשְׁרָ֥ה בְעֵינָֽי׃

(3) His father and mother said to him, “Is there no one among the daughters of your own kinsmen and among all our people, that you must go and take a wife from the uncircumcised Philistines?” But Samson answered his father, “Get me that one, for she is the one that pleases me.”

(א) ויאמר לו אביו ואמו: השיבו לו א) האין בבנות אחיך ועכ"פ האין בעמך אשה, ב) כי אתה הולך לקחת אשה מפלשתים שהם צוררים לנו, ג) הערלים, ויאמר כו' אותה קח לי לא זולתה, ובודאי רצה שתתגייר אחר שרצה שיקחו אותה לו לאשה שהיא קיחה בדרך נשואין.

They asked Samson: Surely you should be able to find a wife from your people? Why take her from a Phillistine, who cause pain to our people?

Furthermore, the Philistines are uncircumsised.

Samson replied "I want her specifically", and he certainly wanted to convert her, as he wanted to marry her according to Jewish law.

(ב) השאלה הראשונה איך שמשון בהיותו שופט את ישראל ובהיותו נזיר אלקים מן הבטן ומתקדש מכל טומאה איך בעל בת איש נכר? והיה לוקח בכל מקום אשה מבנות פלשתים הערלים? ואין ראוי שנסתפק במה שאחז"ל (עיין רלב"ג) שהיה מגייר אותן ושהשיבן לדת ישראל, כי זה לא נזכר בכתוב, וגם ספורי הנשים ומעשיו עמהן ומעשיהן עמו לא יסבול שיאמר זה, ולכן יקשה מאד איך שופט ישראל ומושיעו היה מתחתן בבנות פלשתים? ועובר בלאו דלא תתחתן בם, המביא לידי כפירה והסרת לב מהאלהים:

(ו) וירד שמשון תמנתה וגו'. מצאנו פעמים רבות בספורי הנביאים שהיו עושים פעמים דברים אשר לא כדת, כדי שיצא מהם עבודת האל ית',

כענין אליהו בהר הכרמל שעבר על דת להקריב בבמה והיה להוראת שעה כדי לפרסם בתוך בני ישראל כי ה' הוא האלקים, וכן ראוי שנאמר בענין שמשון שעשה דברים אשר לא כדין לפי שימצא תואנה להנקם מפלשתים, כ"ש שלא היה הרוח האלקי אשר בו מיושב ומסודר לעשות תשועות כשאר השופטים ולא היה דעתו שלם אבל האל ית' למשפט שמו וצור להוכיח יסדו, ולזה השפיע בו רוח גבורה וחוזק מופלג והיה עם הפעמות, ונמשך מזה שבראותו אשה תיטב בעיניו לא היה מעצור לרוחו ובחרות אפו לא יעמוד דבר לפניו. וידמה שבתום לבבו היה חושב שלענין נזירותו לא היה מחויב כי אם בדברים שהזהיר המלאך עליהם, והם איסור כל אשר יצא מגפן היין ושלא יאכל כל טומאה ומורה לא יעלה על ראשו, ושאר הדברים היה נמשך בהם אחרי תאותו, והאל ית' הספיק בידו לעשותם כן, לפי שעם היותם פעולות משובשות מפאת עצמם, הנה ימשך מהם הנקמה מפלשתים.

Halachic Ramification 1
בֵּית דִּין שֶׁשָּׁמוּ לְבַעַל חוֹב בֵּין בְּנִכְסֵי לוֶֹה בֵּין בִּמְשֻׁעְבָּדִין שֶׁבְּיַד הַלּוֹקֵחַ וּלְאַחַר זְמַן הִשִּׂיגָה יָדוֹ שֶׁל לוֶֹה אוֹ שֶׁל נִטְרָף אוֹ שֶׁל יוֹרְשֵׁיהֶן וְהֵבִיאוּ לְבַעַל חוֹב אֶת מְעוֹתָיו מְסַלְּקִין אוֹתוֹ מֵאוֹתָהּ קַרְקַע. שֶׁהַשּׁוּמָא חוֹזֶרֶת לַבְּעָלִים לְעוֹלָם. מִשּׁוּם שֶׁנֶּאֱמַר (דברים ו יח) "וְעָשִׂיתָ הַיָּשָׁר וְהַטּוֹב":

A Court that evaluated that lands which were owed by the debtor be given to the creditor. After a time the debtor managed to gain credit and was able to pay back the creditor, the money should be payed to the creditor , and the creditor must remove himself from the field.

If, however, we recognize that Halakhah is multiplanar and many-dimensional; that, properly conceived, it includes much more than is explicitly required or permitted by specific rules, we shall realize that the ethical moment we are seeking is itself an aspect of Halakhah. The demand, or, if you will, the impetus for transcending the din is itself part of the halakhic corpus.

Rav Aharon Lichtenstein - ‘Does Jewish Tradition Recognize an Ethic Independent of Halakha?’

וּוַתְּרָן בְּמָמוֹנִי הָיִיתִי — דְּאָמַר מָר: אִיּוֹב וַותְּרָן בְּמָמוֹנֵיהּ הֲוָה, שֶׁהָיָה מַנִּיחַ פְּרוּטָה לַחֶנְוָנִי מִמָּמוֹנֵיהּ.
Lastly, Rabbi Neḥunya said: And I was always openhanded with my money. This is referring to conduct such as that which the Master said: Job was openhanded with his money, as he would always leave at least a peruta of his money with the shopkeeper. He never demanded the change from his transactions.
Halachic Ramification 2
Rav Yosef Shaul Nathanson (Teshuvot Sho'eil Umeishiv 1:1:44) explicitly asserts that Halachah recognizes the concept of intellectual property and copyright law. He does not offer a proof-text for this assertion, but he writes that it would be counterintuitive to claim that Halachah would fail to recognize the internationally accepted rules of copyright. It would appear that Rav Nathanson is arguing that we must accept these laws based on considerations of equity. Indeed, the Ramban, commenting on the Torah's exhortation (Devarim 6:18), "VeAsitah HaYashar VeHatov BeEinei Hashem" ("You shall follow what is proper and good in the eyes of God"), emphasizes the need to conduct oneself in an ethical manner. He explains that the Torah commands us to follow what is considered proper and ethical behavior even in situations that are not directly addressed in the Torah. Following copyright laws is a fulfillment of this exhortation. Indeed, Rav Darren Blackstein commented to me that copyright law is an example of the cardinal principle of “do not do unto others that which one does not want done to himself” (Shabbat 31a).