Peeling for example an egg or onions, etc is muter on Shabbos so as long as it is samuch (just before) to the seudah. If it is done not “samuch” to the seudah is this an issur d’rabbanan or issur d’oraisa?
The Beis Yosef (321) cites from the yerushalmi that somebody who peels a garlic on Shabbos is chayav for borer. This clearly indicates that there is a concern for a Torah prohibition.
Because the normal way is to eat an egg or an onion without its peel, the peel is considered something separate, yet “mixed up” with the food by dint of its being attached to it.
See also Biur Halachah (321 s.v. liklof) and Chazon Ish (Orach Chaim 54:4) concerning the permissibility of peeling, which is considered (when close to eating) derech achilah, an act of eating and not an act of sorting.