Push heat and work across the wall of a gas cylinder. The arrows, the piston and the running total of ΔE = q + w all move together, so every sign has somewhere to show up.
Slide q to the right and heat flows into the gas. Slide it left and heat leaves. Slide w to the left and the gas expands, spending energy on the air outside.
Signs always describe the system. Energy coming in counts as positive. Energy going out counts as negative. Add the two and you have the change in internal energy.