niczego is genitive form of nic, but nic is also accepted genitive of nic. But, if preposition requires genitive it has to be niczego. If the case is nominative or accusative it has to be nic.
In all other situations it's personal preference, but I think it works a bit like dziś/dzisiaj, tu/tutaj
nic się nie stało (nominative)
nic mi nie pomoże (nominative)
na nic ten trud (accusative)
za nic tego nie zrobię (accusative)
to jest do niczego (genitive)
zrobić coś z niczego (genitive)
For "don't do anything at all" it makes more sense to use imperfective. You cannot do this at 8:00, nor 8:05, nor 8:10, etc.
"zabierz" would focus on one moment, so "niczego nie zabierz" is kinda like... "only, by any chance, don't you dare take anything!" Such constructions are rather rare, although for example "niczego nie zepsuj" (don't break anything) makes more sense with perfective. So it's hard to grasp a rule.