If you want to train a ninja-dwarf, he needs ambushing skill. Dwarves gain ambushing skill by hunting.
What ambushing skill does is allow the dwarf to run closer to enemies before they notice them. This is very useful for dispatching goblins with ranged weapons, especially if you don't have better equipment than they do. This is because you can sneak that little badass in and target the ranged units because the goblins won't know that he is there while they are killing your animals or drafted fishery workers. Usually the melee goblins will run ahead of the shooters and you can ambush the shooters if the hunter dwarf doesn't get ideas of his own first and charge too soon.
Note that the goblins need to be distracted or they will still spot and shoot the hunter (although maybe legendary ambusher cancels this, I dunno)
Another bonus is that if you have a forest that needs chopping, you can give the ambusher dwarf the woodcutter job after you are satisfied with the level of skill he is at. The goblins will ignore him and spring their ambush (hopefully on a pastured animal; I spread pastures all over for this reason). This means that if the woodcutter was out chopping, then the goblins may be between the woodcutter and the fort entrance. This sets the woodcutter/ambusher up for an ambush of his own on the goblin ranged troops as I mentioned above.
Note that once he attacks the dwarf becomes visible to the goblins again. That means if he has a crossbow and snipes one of two ranged goblins down, the second is likely to turn and shoot him if he is closer than the goblins previous target, while the dwarf likely will continue shooting at the first goblin.
That's why I use axes. They will either incapacitate or kill the first goblin and run to the next with an axe. Just make sure if you do this that you assign the exact axe he is already holding as a woodcutter. (and turn woodcutter job off without unpausing I suppose, just to be sure)