The Septuagint (the Greek translation of the Old Testament) added the words over Goliath
after David
in the heading. Looking at Psalm 144:12–15, David did not write this psalm shortly after his victory over Goliath (1 Samuel 17:1–58). However, it could be that David in a later phase of his life, looks back on his battle with Goliath, because 1 Samuel 17:1, the first part of 1 Samuel 17:2, and 1 Samuel 17:10 are easily connected to that confrontation.
The psalm can be outlined as follows:
Psalm 144:1–11 is about the help of the Lord in David’s battle (and one could easily think of the confrontation with Goliath);
Psalm 144:12–15 is a prayer of thanks for the peace and quiet in the land.
1 Blessed be the LORD, my rock, who trains my hands for war, and my fingers for battle;