A dying king's final instructions to his heir often reveal the difficult balance between personal honor, legal promises, and the demands of justice. David's final command to Solomon regarding the man who once cursed him highlights exactly this tension. David had previously sworn not to kill Shimei for his insults. As Solomon takes the throne, he is finally in a position to act and establish justice [מצודת דוד]. The primary approach among commentators is that David's oath was a personal commitment that only bound him, leaving Solomon entirely free from its restrictions [ביאור שטיינזלץ]. Even so, to avoid breaking the oath directly, Solomon is instructed not to execute Shimei for his past crimes. Instead, he must use his deep intellect to find a new, valid legal reason to justify the death penalty [רש״י, רלב״ג, צאינה וראינה].
Taking a different perspective, some argue that David never intended for Solomon to execute Shimei for his past actions. According to this view, David is simply warning his son. If Shimei acts out again in the future, Solomon must not forgive him as David was forced to do. Rather, Solomon should put him to the test to see if he obeys royal orders; if he fails, he should face severe consequences [מלבי״ם, אברבנאל].
The timing of this command also carries spiritual significance. It is suggested that David originally spared Shimei because he foresaw through divine inspiration from God that a great leader, Mordecai the Jew, would eventually descend from him. Once that worthy lineage was secured and born, Shimei's protection lifted, clearing the way for his punishment [חומת אנך].
Solomon's wisdom plays a crucial role in this process. While it primarily refers to his mental ability to find a legal pretext for the execution [רש״י, מצודת דוד], it has other implications. Because Solomon is so wise, he does not need to rely on Shimei's knowledge of the Torah, removing any practical reason to keep him alive [אברבנאל]. Furthermore, the very fact that Solomon is such a wise son proves that David's marriage to Solomon's mother was pure and proper. This reality completely shatters the basis of the curses Shimei had hurled at David years before [חומת אנך].
As David concludes his instructions, he insists that Shimei must not be spared punishment or allowed to walk away freely [מצודת דוד, ביאור שטיינזלץ]; rather, he must be completely cut off and destroyed [אברבנאל]. David emphasizes that Shimei's advanced age should grant him no pity or special respect [מצודת דוד, אברבנאל]. The punishment must be absolute. He is not to be allowed a peaceful, natural death in his bed. Instead, Solomon must ensure that Shimei meets a violent end by the sword [רלב״ג, מצודת דוד].