We consider the implications of adding a cap to the yield surface for elastic-plastic and elastic-visco-plastic solids with coupling between deformation, fluid flow and mineral reactions. For a suitable combination of (low) permeability and strain rate, opening-mode veins can form in compression. Such behaviour is enhanced by dissolution and by simultaneous mineral reactions with negative Delta V. These are the opening-mode equivalents of compaction bands in rocks with high permeability. Stylolite parallel veins are considered as forming in this way; such veins are commonly the laminated or ribbon-quartz veins associated with intense gold mineralization. Axial plane veins and melt segregations are in this class also. The addition of a yield surface cap limits the permissible stress states portrayed by a failure-mode diagram and has implications for breccia formation. Failure discontinuities that form at the cap require a decrease in fluid pressure to form as opposed to extension joints and veins that require an increase in fluid pressure; discontinuities that form at the cap are in orientations that are commonly interpreted as reactivated early discontinuities. The switching between high fluid pressure and low fluid pressure, which we call mode-switching, arises from competition between mineral dissolution and deposition. This is an alternative to the fault-valve mechanism and does not require fault reactivation or failure at a 'seal' linked to seismicity or fault reactivation. The capped yield surface concept provides a unifying self-consistent approach for vein/breccia formation and for the kinematics of brittle and visco-plastic rocks.