The sign convention for work has been a problem that adds to the confusion about thermodynamics.
Work, like heat, is energy in transit from one system to another, and we use a sign convention to indicate this direction, with the emphasis on convention. Most current engineering textbooks use the convention that work that goes in the system is positive. This is the opposite of the older convention, still used in some chemistry and physics books, where the work is taken to be positive if it goes from the system to the surroundings. The older convention is motivated by the situation in heat engines: we put heat into the system (which we count as positive) and receive work out of it (which we also count as positive. In this convention heat and work have opposite signs when they are transferred in the same direction and the same sign when they are transferred in opposite directions.
In the modern convention, which I personally consider to be less prone to confusion, all energy that goes in the system is positive and all energy that comes out is negative, regardless of what is the form of that energy.
That both conventions are still in use means that you must be careful to understand which convention your source is working with. Once work and heat have been replaced by thermodynamic functions ($dW =- P dV$ in the new convention, $dW=+PdV$ in the old one, $dQ=T dS$ in both conventions), the resulting equation
$$dE = T dS - P dV$$
is independent of sign conventions.