In thermodynamics, the sign convention for work done ((W)) is established as follows:
[
W is negative when the system (such as a gas) expands,
]
[
W is positive when the system is compressed,
]
This convention reflects that during expansion, work is done by the system on its surroundings, which results in a transfer of energy out of the system, hence the negative sign.