The Yankees improved their chances to make the playoffs this season with their trade deadline work, perhaps even to compete for a championship.

You know what else they did — positioned themselves for a less stressful offseason.

Todd Frazier and Jaime Garcia are free agents after this season, but David Robertson is not a free agent until after 2018, Sonny Gray until after 2019 and Tommy Kahnle until after 2020.

The Yankees were going to have to address pitching this winter, particularly starting pitching, and do so somewhat on the cheap as they pledge to get under the $197 million luxury-tax threshold for 2018. Gray, who should make about $7 million next year, is a double check mark in that he is a high-end starter at a relatively inexpensive rate.

With Kahnle, Robertson, Aroldis Chapman, Dellin Betances, Adam Warren and Chad Green all under control through at least next year, the Yankees will not have to bulk up their bullpen. Quite the opposite. They can see what Betances might fetch on the market or if some team would make a nice return for a closer such as Robertson, especially if moving the $13 million the righty is owed next year helps the Yankees slip under the threshold.

see also

The Yankees will certainly try for Shoehei Otani if the Japanese ace comes this offseason, and, if it matters, even added more international pool money in the Gray trade with Oakland and a separate deal of Yefry Ramirez to the Orioles. They will see how much they need to pay down to make Jacoby Ellsbury disappear, perhaps Chase Headley, as well. They could see if there is a veteran-leader type to succeed Matt Holliday as the primary DH. And they are blessed with a deep enough farm system to consider anything that pops up on the radar.

But with Michael Pineda gone due to Tommy John surgery and free agency, CC Sabathia about to be a free agent and Masahiro Tanaka possibly opting out, the Yankees needed to find rotation innings moving forward. Now, they have Gray to join Luis Severino, Jordan Montgomery and perhaps Tanaka, who is the oldest of that group at 28.

The Yankees also believe Chance Adams and Justus Sheffield, in particular, are close to being rotation factors and that Domingo Acevedo is a wild card — having the arm to be a top starter, but a delivery that still needs work.

Those young starters plus a few more the Yankees think are at lower levels — notably Freicer Perez — made it a little easier to part with James Kaprielian as part of the Gray trade. In fact, organizational depth made this deal possible for the Yankees. They are essentially executing a model the Cubs used to become champions last year and bulk up for another run this year.

In the past two years — with a young positional core established in the majors — the Cubs used redundancy to get what they craved in trades, moving Starlin Castro and Gleyber Torres to the Yankees, Jorge Soler last offseason, and Eloy Jimenez and Jeimer Candelario this trade season as the keys to get Jose Quintana and Justin Wilson.

James KaprielianN.Y. Post: Charles Wenzelberg

The Yankees’ positional depth is greater than the pitching that allowed Kaprielian, recovering from Tommy John surgery, to be included for Gray.

Jorge Mateo and Dustin Fowler were both valued prospects by the Yankees, but having Torres, Didi Gregrorius, Miguel Andujar and Tyler Wade in or closer to the majors, plus Nick Solak making inroads lower down, made Mateo movable. Having Aaron Judge, Clint Frazier and Aaron Hicks enjoy major league success this year with Estevan Florial one of the game’s highest-rising prospects at Low-A made not only Fowler available, but Blake Rutherford in the White Sox swap for Kahnle/Robertson/Frazier.

By the way, in avoiding signing a qualified-offer free agent after either the 2014 or 2015 seasons, the Yankees did not surrender the 16th draft pick in 2015 and 18th in 2016. It marked just the second and third time from 1994-2016 that the Yankees even had top-20 picks. Oh yeah, the picks were Kaprielian and Rutherford.

It hurt the Yankees to lose those prospects, but in Kahnle and Gray in particular they received prime-age building blocks as gifts that help now and — in theory — keep on giving.