Porcupines are covered with thousands of quills.
Those quills are not separate weapons stored under the skin.
They are modified hairs.
Quills are made from keratin
Keratin is the same broad family of structural protein found in hair and nails.
Porcupine quills are specialized to become stiff, sharp protective spines.
Do porcupines shoot their quills?
No.
That is a myth.
A porcupine cannot launch quills across the room.
The quills detach when something makes contact with them.
A predator that bites or grabs the animal can come away with a very unpleasant collection of spines.
Why are quills effective?
Pain is persuasive.
A predator that receives a face or mouth full of quills may decide a different meal would be easier.
That protects the porcupine without requiring it to outrun the attacker.
Do all quills look the same?
No.
Quill length and structure vary across the body and among porcupine species.
Some New World porcupines have microscopic backward-facing barbs that make certain quills especially difficult to remove.
Can lost quills grow back?
Yes.
Because quills are specialized hairs, new ones can replace those that are lost.
How is this different from a turtle shell?
Both are defensive structures.
A turtle shell is part of the skeleton.
Porcupine quills are modified hairs.
Different materials.
Same general message to predators:
This meal has complications.
A porcupine is basically covered in specialized hairs that make biting it an immediately regrettable decision.
And that’s the short explanation.
Related explanations: Why do turtles have shells?, Why do lizards lose their tails?, and Why do animals have tails?