system
Given the following post, respond as if you're commenting on Reddit:
human
[Star Wars/Any space themed scifi] How do shields identify friend or foe?

So in almost every space fiction ever, any spaceship is usually equipped with an energy shield of some sort that soaks up any damage and preventing the ship from receiving physical damage. This is usually depicted as some sort of energy barrier forming a bubble around the ship.

Now given our understanding of earth physics, a shield works both ways. You wouldn’t be able to shoot through a ballistic shield that stops enemies shooting at you with the same type of weapon. However, as we see in scifi, shields absorb hits by the enemy, while allowing shots of its own ship to pass through. Also we often see smaller ships being able to pass through shields of bigger ships for various reasons regardless of friend or foe.

It obviously is not some sort of compatibility issue, otherwise it would not be hard to bypass the shield. The shield also isn’t opening to let stuff pass through because most of the time we see stuff passing through and getting blocked at the same time.

Just doesn’t make a lot of sense tbh, but probably isn’t supposed to make sense? Or is there any plausible explanation?
gpt
In Star Trek, shields rosantes at a frequency know only to the crew of that ship. The weapons systems are calibrated so that they can pass through the shields and not be affected. If an enemy was able to learn your shield frequency, they would be able to calibrate their own weapons to be able to penetrate your shields. This is what happened to the Enterprise-D, leading to her destruction at the hands of an 80 year old, surplus Bird-of-Prey.