https://github.com/otwieracz/spec-debug

spec-debug is a small Clojure library that instruments clojure.spec.alpha/valid? to produce verbose, human-readable error output when a spec check fails. It solves a common frustration in Clojure development: when a :pre or :post condition backed by spec/valid? fails, the default error message tells you that validation failed but gives no indication of why. You end up manually swapping valid? calls for explain calls across your codebase just to track down the problem.

With spec-debug enabled, every failing spec/valid? call automatically triggers the expound library to print a detailed breakdown of exactly which part of the data violated which spec. The output pinpoints the offending value and shows the full spec chain, making it immediately clear what went wrong. This is especially valuable with deeply nested specs where the cause of failure is not obvious from the input data alone.

The library is designed to be toggled on and off at runtime with enable-spec-debug! and disable-spec-debug!. When enabled, passing specs incur negligible overhead (less than 1.2x in benchmarks), so it can safely stay on during development. The performance cost only becomes significant when specs actually fail and expound generates its output, which in practice means you are already heading for an assertion error anyway.