How do you clear someone's inventory upon spawn?

You can use the command /clear [targets] [item] [maxCount], where:

  • targets is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.

  • item is optional. It is the item to clear (See list of Minecraft items). If no item is specified, then all items in the player's inventory will be cleared.

  • maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.

For your requirements, I suggest /clear @p, on a command block looping right bellow the player.