When a new (global) constraint is introduced in local search, measures for the penalty and variable conflicts of that constraint must be defined, and incremental algorithms for maintaining these measures must be implemented. These are complicated and time-consuming tasks, which clearly reduces the productivity of the local-search practitioner. We introduce a generic scheme that, from a description of a constraint in monadic existential second-order logic extended with counting, automatically gives penalty and variable-conflict measures for such a constraint, as well as incremental algorithms for maintaining these measures. We prove that our variable-conflict measure for a variable x is lower-bounded by the maximum penalty decrease that may be achieved by only changing the value of x, as well as upper bounded by the penalty measure. Without these properties, the local search performance may degrade. We also demonstrate the usefulness of the approach by replacing a built-in global co...