To compose a plan in critical positions you must do the following:
1.Assess the position, who stands better, by how much, and why. If you have a clear advantage it doesn't make sense to sacrifice material to force a threefold repetition (unless you're playing an IM or FM depending on your skill level and above)
2.Look at the pawn structure and weak pawns as well as the center type.
3.What open lines and diagonals are there. How well coordinated are the pieces? Keep in mind that an open line by itself is meaningless, they become meaningful whenever you can get something concrete out of it, such as entry points.
4.Compose your plan! This is very general but what exactly will depend on various positional elements and how best to either exploit weaknesses, avoid their counterplay, and/or create new weaknesses in their posiiton. This is where attack comes into play. In a defense the opponent will make some positional concessions to avoid losing material or getting mated.
5.Select your candidate moves! This is key, because a seemingly reasonable move that will drive your plan forward could have a hidden refutation that would lose you the game. Here's a position I studied from an amateur game:
White generated a threat against the f-pawn, his rooks remain unconnected and his queen, while coordinating against the f5 pawn, nevertheless seems awkwardly placed. Still, wasn’t doing much on d8 anyway but is less flexible here. My two candidates here are …e4 and …g6. …g6 weakens the space around my king and enables Bh6 where knight and rook threaten the e5 pawn while my rook is also under attack while …e4 grabs some space, wrests e5 away from the knight as it's forced to move, a line is opened for my bishop, and his dark square weaknesses becoming exploitable looks like an even more realistic prospect now. I like 1…e4 2.Nh2,Bg5 since there’s nowhere for his bishop to run. I have a marked space advantage, usually not good for exchanges, but his darksquared bishop is his potentially most dangerous attacking piece given that his other bishop is restricted. 3.Bxg5,Qxg5 my dark squares are weak too and my own best attacking minor is off, looks like I helped white more than myself. Yeah I’ll avoid exchanging darksquared bishops. 1…e4 2.Nh2,Bf6 looks better, though my c5 pawn needs some extra defenders. In fact, white’s queenside is a bit weak and I don’t see any concrete way to play for an advantage with 2…Bf6 so 2…Bd6 looks better now with prospects of a kingside attack, 3.f3,Qh4 with the idea of building up some mate threats forcing some weaknesses. 4.fxe4 can I work with that? 4…f4 knocking the bishop away 5.Bf2 needs better prep, 4…Bxh2+ burns a bridge but here goes nothing: 5.Kxh2,f4 6.Bg1,Qg3+ 7.Kh1,f3 8.gxf3,Qxh3+ 9.Bh2,Qxf3+ 10.Kg1,Qg4+ 11.Kh1,Rf2 looks like mate soon after Qf3+ though a lot of this isn’t even forced. What if he ignores the pawn?
7…f3 yeah the mate threat on g2.
1…e4 2.Nh2,Bd6 3.g3 putting the kibosh on …Qh4, what can I do anyway? 3…f4 4.Bxf4,Bxf4 5.gxf4,Qh4 6.Re4,Nf6 white has strengths of his own and I don’t have enough coordination and force against his king.
3.g3,g5 with the idea of …f4 and a kingside attack, a point of no return as pawn advances are bad for defense, especially in front of the king and I must make sure I create sufficient weaknesses in white’s camp and have my pieces in place to prevent white from exploiting my own open king, though his queen is far off and bishops uncoordinated and restricted so I feel I can get away with this idea. Eventually I should force him to exchange off my dangerous attacking pieces when piling up pressure, maybe even entering an endgame up a pawn or two or at least have significant positional weaknesses he’s forced to defend against, at best he’d carelessly allow me a mating combination with a nail pawn on f3. 1…e4 2.Nh2,Bd6 3.g3,g5 is my primary variation push clock.
robert bellin's test your position is a very good book for middle game,its not a heavy book, you can read its first section (which is theory) in 2- 3 days and second section which provide testes which are very innovative
after reading this book i got good knowledge about plan making in middle game