Is there is any "dress code" or limitation regarding what to wear (I mean at the minimum) when the time comes to put on the tefelin? I see many people putting them on wearing pajamas for example... I might be wrong but this seems (to me) a bit wrong... we don't go at the beit knesset in pajamas and yet in both cases we are present before G-d. Is this only a "mida tova" to be "well dressed" (and this could be very relative) or is there a commandment regarding the minimum to wear when putting on tefilin.
As far as avoiding things that would be a Bizayon (an insult) to the Tefillin, you are required to cover the parts of your body that are normally covered. This of course means one's private areas, but it also means a shirt, and some kind of shoes for the vast majority of people, and also pants and probably socks for most people as well. However, it is clear that everything is relative. The only thing that will invalidate prayer is being nude.
Full disclosure: I wear shorts and sandals a lot during the summer, so, although I would not go to an important meeting with my boss in shorts and sandals, if I'm tight on time and won't be able to change, or if I don't have any better options, I feel it is acceptable to wear shorts and sandals, as the "requirement" of dressing as before a king is mentioned, even according to the Mishnah Berurah (91:1:3), as a Midath Hasiduth. My first preference, if possible, though, is to try to meet that Midah. Also, when I was younger, I wore sandals to Shi'ur one day. A classmate asked the Rav if that was appropriate, to which the Rav answered, "If it was good enough for our ancestors at Har Sinai receiving the Torah, it should be good enough for Seth." The point is, as stated above, it's all relative: you should look dignified when praying. You should look dignified all the time. What is required, however, is not the same thing.
Of course, the entire section (Hilchoth Tefillah) cited above is referring to Tefillah, not wearing Tefillin, which msh210 objected to in a comment on b a's answer, but it is not unreasonable to treat the two similarly. Perhaps a slightly higher standard is warranted if you are doing both, but if you are going to be stricter for a twofer (Tefillin and Tefillah), you should probably be strict all the time (Tefillin or Tefillah).