Principles of Thermodynamics
The standardized definition of the change in internal energy $U$ for a closed thermodynamic system is

$$\Delta U = Q + W$$

where $Q$ is amount of heat transferred to the system and $W$ is work done on the system (provided that no chemical reactions occur).

Therefore, heat transferred from the surroundings to the system is assigned a positive sign in the equation, whereas heat transferred from the system to the surroundings is assigned a negative sign.

Similarly, work done by the surroundings on the system is assigned a positive sign in the equation, whereas work done by the system on the surroundings is assigned a negative sign.

(Note that some books on physics or engineering still use a non-standard definition when discussing the work done by a thermodynamic heat engine.)