What they mean by perfectly is, they never damage your base. I would go back and revisit the first den defense to make it easy on you (Sequence 2, Memory 6). I would not wait until later on because it gets increasingly difficult to fend them off as they get much more difficult units to handle, especially the dreaded Cannon Siege Engine.
My strategy is to fill the rooftops first with Assassin Leaders as the game would let you (adding forced units when required) starting from the roofs closest to the entrance. This will allow you to gain passive morale as fast as possible. And make sure you set your Barricade somewhere toward the middle (between the left and right buildings, closer toward the entrance) to give your guys time to shoot.
As for the units to add, I'd start with 6 Crossbowmen placed closest to the entrance on either side (it's possible to get away with 3 though, your choice) then start adding Riflemen working you way closer toward your base. Also add more upgraded Barricades with riflemen on the street to help slow them down. You'll want as much Riflemen as you can to be able to fend off the Siege Engine at the end.
While doing this, make sure you're regularly shooting with your hidden gun and looting the bodies to help with the killing and getting more morale.