system
Given the following post, respond as if you're commenting on Reddit:
human
Why are there laws when it comes to war?

It's people killing eachother, so I have no idea, how someone could make laws about it.
gpt
There are two separate questions here - why and how.

I think the 'why' is fairly obvious - there are some pretty horrific methods of warfare and ways of carrying out violence.  In the past it was simply accepted that as an army passed through an area it would rape, loot and steal everything not nailed down, prisoners taken would be tortured and forced to work or fight for the enemy.  This largely is no longer the case.  Chemical and biological weapons are more or less unused, certainly by major powers, as are mines and cluster weapons.  We consider these things too horrific or non-specific - that is, they mostly target innocent civilians.  There was no such thing as a war crime before the 20th century - now we have a somewhat functional justice system capable of holding people to account for their actions during war.

As to how these laws are enforced - it's entirely possible.  More or less by mutual agreement, gas weapons were never used in world war 2. Chemical weapons have never (with the arguable exception of Vietnam, but that was officially 'deforestation') been used in open conflict without the total condemnation of the international community, similarly with biological agents.  It works because the amount of damage using such a weapon would do to a country's diplomatic prospects (trade sanctions, general mistrust from other countries, maybe even war) is just not worth the risk.  Often these 'non-conventional' weapons, warfare targeting the civilian population, and similar strategies are used in response to the other side using them.  So by taking them off the table entirely, countries no longer need to stock up on chemical or biological weapons in the first place because they know with fair certainty that nobody else is either.