This is basically a follow up question from Tom Church's answer to this question: How much does a student's ranking in their cohort matter for PhD applications?.
What can a undergraduate do say in his 2nd or 3rd year to get the strongest recommendation letter possible? There are the usual answers like talk to your professors etc, but Tom's answer seem to imply there are skills to be learnt in this case.