Checking ones pockets close to Shabbos: 
It is a Mitzvah upon every person to check his clothing on Erev Shabbos, in close proximity to the beginning of Shabbos. This is done in order to verify that he is not carrying anything which is forbidden to carry on Shabbos. [This applies even in an area with an Eiruv, in order so one verifies whether or not he is holding a Muktzah object.]
If one forgot to remove the item before Shabbos:  If one forgot and did not remove the item from his pockets before Shabbos, then he is to remove it on Shabbos [immediately] upon remembering. [Regarding how to remove the object if it is Muktzah- See Vol. 1 “The Laws of Muktzah”. Regarding if one noticed that he is carrying the object on Shabbos while in an area without an Eiruv-See Vol. 3 “The Laws of Carrying”.]
May one place items in his pocket on Shabbos itself? It is forbidden to place any object into ones pockets on Shabbos, even at home, if one lives in a community that does not have an Eiruv [see footnote] which allows them to carry. However in a case of need one may be lenient to place things in his pocket while in his house.
If on Shabbos one desires to walk past the area of the Eiruv must he check his pockets prior to leaving?
Even in an area that has an Eiruv, if one plans to walk past the Eiruv area then he is to check and remove all the items from his pockets prior to doing so.
 Tzaruch Iyun on this Lashon, which is the Lashon of the Michaber, as opposed to the wording of the Gemara and Rambam which is “obligated”. See glosses of Tzemach Tzedek printed in Shulchan Aruch 2 p. 836 which asks this question. See also Biur Halacha 252 “Mitzvah” which explains this wording.
To note that in the Kuntrus Achron [252/14] Admur explains that in truth this is not a Rabbinical decree, but rather is an obligation which comes as a result of the prohibition of carrying into a Karmalis, as it is very possible that one already has an item in his pocket, as is commonly done during the week.
 This refers to his pockets and all other areas of which one commonly uses to place items into. [Mishneh Berurah 252/55]
 Whether it being an item which is forbidden to carry in a Karmalis, or whether it being a Muktzah item which is always forbidden to carry [as explains M”A]. Now although as said before the Sages did not make a decree as a precaution against carrying into a Karmalis, being that this is a decree upon a decree, nevertheless since one always accustomed during the week to place things in his pocket, and this is something which can be easily verified, it therefore is not even considered a Rabbinical decree but rather a true doubt. [Kuntrus Achron 252/14]
 This applies even according to the custom today to consider all public areas as a Karmalis. [ibid]
 Kuntrus Achron 252/14 in name of Magen Avraham.
This matter is disputed there, and the following is Admur’s final ruling which states to be stringent unless it is a case of need.
 In parentheses Admur adds that this prohibition applies even in an area which has an Eiruv, and thus accordingly it would be always forbidden to place items in ones pockets, in any community in the world, even while in one’s home. Practically though since even by a community which does not have an Eiruv it is disputed whether it is allowed or not, and Admur himself placed this ruling in parentheses, which represents his own personal doubt in whether it is even correct according to the stringent opinion, one may therefore be lenient. So rules Ketzos Hashulchan 115 footnote 44, and so is the worldly custom. Nevertheless one who desires to be stringent even in a city with an Eiruv, basing himself on the strict wording of Admur that one is to follow the stringent opinion, seemingly may do so.
 This is due to worry that one may come to forget about the item if he places it in his pocket, and will then come to carry it. [ibid]
 As there are opinions which hold that there was never a prohibition made against placing items in ones pockets while in one’s home.
 Mishneh Berurah 252/56