Leadership is same as coding.
Leadership: Given task to produce something someone wants (B), get an expert (A->B) who knows how get it from something you have (A). If such expert doesn't exist, build a team of experts A->C and C->B, for a suitable intermediate product C.
Coding: Given task to calculate something user wants (B), find a function (A->B) that calculates it from user input (A). If that function doesn't exist, build it from functions A->C and C->B, for a suitable intermediate result C.