Split out from T280766: Phase out legacy error, warning and success classes for usage outside the parser.
The .error class, found in legacy.less is going away. It is however used extensively in the parser and extensions that extend it.
The skin feature content-parser-output is a suitable candidate to have these styles. Considering they are not used outside .mw-parser-output, they can be scoped to that class.
Testing
A parser outputted error can be easily provided by transcluding the current page in itself.
If ParserFunctions is installed, using {{#expr:garbage}} will work too.