It’s always a smart idea to offer to write a letter of recommendation for a colleague who you know is well qualified for the job in question. Consider it good career karma; after all, you never know when you’ll need a letter of recommendation for yourself, and your colleague may be happy to return the favor.
How can I go about getting good letters of recommendation? Since your best letters will come from those who know you well, make an effort to get to know your professors and/or supervisors. A few ways you can do this are to speak up in class, select courses with small class sizes, take more than one class from a professor, do research for a professor, take on optional projects, and regularly attend office hours. The best strategy you can use to get a good letter of recommendation, particularly if a professor hasn’t known you long, is to provide your letter writer with ample information about you. This way, you will get a letter that includes concrete details about you, instead of a letter that contains only your grade, which is of limited value.