שולחן ערוך, אורח חיים ל״ט
Shulchan Arukh, Orach Chayim 39
1מי הם הכשרים לכתוב תפילין ולקנות מהם. ובו י סעיפים:תפילין שכתבן עבד או אשה או קטן אפילו הגיע לחינוך (או עכו"ם) או כותי או מומר לע"א או מוסר פסולים משום דכתיב וקשרתם וכתבתם כל שאינו בקשירה או אינו מאמין בה אינו בכתיבה:
תפילין that were written by a slave, or a woman, or a minor - even if he reached [the age of] training [in mitzvot], (or a non-Jew), or a Samaritan, or a transgressor/apostate who served idols, or an informer are invalid because [of what] is written "And you shall bind them as a sign on your hand… and you shall write them on the doorposts of your house" (Deuteronomy 6:8–9): [which is expounded to mean] - All that are not [commanded] in binding or do not believe in it, are not [suitable] for writing.
2כל שפסול לכתבן פסול בכל תיקון עשייתן:
All that are invalid to write them, are invalid in all [aspects of] making/fixing them.
3גר שחזר לדתו מחמת יראה כשר לכתוב תפילין:
A [Jewish] convert that returned to his [previous] religion because of fear is valid to write תפילין.
4תפילין שכתבם אפיקורס (פי' מיאני) ישרפו וי"א יגנזו:
תפילין that were written by a heretic should be burned, and some say they should be interred.
5נמצאו ביד אפיקורס ואין יודע מי כתבן יגנזו:
[תפילין] found in the possession of a heretic and it's not known who wrote them should be interred....
6נמצאו ביד עכו"ם ואין יודע מי כתבם כשרים:
[תפילין] found in the possession of a gentile and it's not known who wrote them are valid.
7אין לוקחין תפילין ומזוזות וספרים מן העכו"ם יותר מכדי דמיהן הרבה כדי שלא להרגיל לגנבן ולגוזלן:
We do not purchase מזוזות, תפילין, or [Torah] scrolls from a gentile for much more than their actual monetary value in order to not habituate them from stealing and robbing [sacred Jewish ritual objects in order to sell them for large sums of money].
8אין נקחין אלא מן המומחה שבקי בחסירות ויתרות:
One should only purchase [תפילין] from an expert who is skilled at [fixing] missing letters and extra letters.
9לקח ממי שאינו מומחה צריך לבדקן לקח ממנו מאה קציצות בודק מהם שלשה קציצות שתים של ראש וא' של יד או שתים של יד וא' של ראש אם מצאן כשרים הוחזק זה האיש והרי כולם כשרים ואין השאר צריך בדיקה ואם לקחן צבתים צבתים חזקתן מאנשים הרבה הם לקוחים לפיכך בודק מכל צבת ב' של ראש וא' של יד או ב' של יד וא' של ראש המוכר תפילין ואמר שהיו של אדם גדול נאמן ואינם צריכים בדיקה
If one purchased [תפילין] from someone that is not an expert, they need to check them. If he purchased from him a hundred parchment slips, he [should] check three slips: two from the head [תפילין] and one from the hand [תפילין], or two from the hand [תפילין] and one from the head [תפילין]. If he found them to be valid, then this man (ie. the one he purchased from) is presumed [to be trustworthy] and all [hundred] of them are valid... and the rest don't need to be checked. And if he purchased them in bundles, they are presumed to have been purchased [by the seller] from several different people. Therefore, he must check from each bundle: two from the head [תפילין] and one from the hand [תפילין], or two from the hand [תפילין] and one from the head [תפילין]. One who sells תפילין and says that they belonged to a great man is believed and they don't need to be checked.
10תפילין שהוחזקו בכשרות אינם צריכים בדיקה לעולם ואם אינו מניחן אלא לפרקים צריכים בדיקה פעמים בשבוע: הגה ואם אין לו מי שיוכל לבדוק ולחזור ולתופרן יניחם כך בלא בדיקה: (ב"י בשם אורחת חיים):
תפילין which have a presumption of being valid don't need to be checked ever. And if he only wears them occasionally, then they need to be checked twice in seven years. Rem"a: And if he doesn't have someone that's able to check them for him and then to stitch them up again after should just wear them as they are without checking (Beit Yosef in the name of Orchot Chaim).