The item ID for Star Shards in Stardew Valley is:
To spawn this item using an animal's name, visit Marnie's Ranch, speak to Marnie and purchase an animal (we recommend a chicken as it is cheapest). Name the animal  and press OK. You will then receive the star shards item.
You can only set your character's name once, at the start of the game (when you create your world), for this reason we recommend you use the animal name method. If you do wish to use this method, first set your character's name to  when creating your save. Whenever you speak to a villager that says your name in dialogue (for example Gus at the Stardrop Saloon) you will be given the star shards item.
If you need more help with spawning star shards, we have a detailed guide on our blog - click here to visit that page.
No one knows how these form. Some scientists claim that the microscopic structure displays unnatural regularity.