Mishnah Shabbat 7:1-2: The Thirty Nine-Forbidden Labors on the Sabbath
The Torah forbids creative labor on the Sabbath. The Rabbis attempted to carefully define the major categories of work since accidental violation of the Sabbath would require the bringing of a sin offering (when the Temple stood) for each category violated.
2 The categories of work are forty less one (i.e., thirty-nine): one who sows, plows, reaps, or gathers; who threshes or winnows; one who selects, grinds, sifts, kneads, or bakes; one who shears wool, washes it, cards it, colors it, spins, or weaves it; one who makes two loops, or weaves two threads, or removes two threads from the loom; one who ties, or unties, or sews two stitches; one who tears in order to sew two stitches; one who traps a deer, slaughters it, skins it, salts it, cures the hide, scrapes it, or cuts it up; one who writes two letters and one who erases in order to write two letters; one who builds or destroys; one who extinguishes ignites; one who strikes with a hammer; one who carries from one domain to another. Behold, these are the categories of work, forty less one.