Nitpick: this statement is about absolute advantage, whereas Ricardo emphasised comparative advantage: https://en.wikipedia.org/wiki/Comparative_advantage#Ricardo....
Imagine that you're better than me at everything (both programming and needlework). You can program three times as fast, and sew twice as fast as I can. Does that mean you should do all your own programming and sewing? No.
However small my contribution, I can save you some time by doing some sewing for you. In that saved time, you can do more programming than I could have achieved in the time I spent sewing. So in sum we're better off. So, there are potential gains from trade.