While the number of mitzvos is generally accepted, what’s on the list can vary depending on the authority consulted. How is that? Well, first of all, not everything is clear whether or not it’s a command. Let’s look at two examples:
Exodus 14:13 tells us, “Moses told the people, ‘Do not be afraid. Stand strong and you will see the salvation that G-d will work for you today. You have seen Egypt today, but you shall never see them again.’” This seems like it’s simply part of the narrative, a prophecy perhaps, but Nachmanides in his commentary cites the Mechilta that it is actually a prohibition to return to live in Egypt. (In his list of mitzvos, Rambam includes the version of this prohibition that appears in parshas Shoftim, Deut. 17:16.)
When given the instructions for making the bigdei kehuna (priestly uniforms), the Torah tells us that “the robe shall have a reinforced neck hole … so that it won’t be torn.” Or, perhaps it says, “the robe shall have a reinforced neck hole … do not tear it” (Exodus 28:32). It is generally accepted that tearing the neck of the robe violates a Torah prohibition.
So we see that mitzvos do not always come in the form of “Thou shalt” and “thou shat not.” Also, many mitzvos are repeated several times throughout the Torah; which version(s) are to be included?
As alluded to above, Maimonides used 14 principles to determine what should be included. For example, a commandment had to be intended for posterity. Therefore, when the generation of the Exodus was commanded to paint their door posts, that would not be one of the 613 commandments. Not to leave manna overnight likewise applied only to the Jews of the Exodus and would not be one of the Taryag mitzvos. However, sacrifices and matters of ritual impurity are intended for posterity, despite our inability to fulfill those mitzvos today.
Another of the Rambam’s rules is that “catch-all” categories are not among the 613. Therefore, commandments such as “keep all that I have commanded you” and “do not deviate from My commandments” are not mitzvos in and of themselves.