Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Taoensso open source
Documentation | Latest releases | Get support


Assertions micro-library for Clojure/Script

Truss is a tiny Clojure/Script library that provides fast and flexible runtime assertions with terrific error messages. Use it as a complement or alternative to clojure.spec, core.typed, etc.

Egyptian ship with rope truss, the oldest known use of trusses (about 1250 BC).

A doubtful friend is worse than a certain enemy. Let a man be one thing or the other, and we then know how to meet him. - Aesop

Latest release/s

Main tests Graal tests

See here for earlier releases.

Why Truss?

  • Tiny cross-platform Clj/s codebase with zero dependencies
  • Trivially easy to learn, use, and understand
  • Terrific error messages for quick+easy debugging
  • Terrific performance: miniscule (!) runtime cost
  • Easy elision for zero runtime cost
  • No commitment or costly buy-in: use it just when+where needed
  • Perfect for library authors: no bulky dependencies


1. Add the relevant dependency to your project:

Leiningen: [com.taoensso/truss               "x-y-z"] ; or
deps.edn:   com.taoensso/truss {:mvn/version "x-y-z"}

2. Setup your namespace imports:

(ns my-ns (:require [taoensso.truss :as truss :refer [have have?]]))

3. Truss uses the simple (predicate arg) pattern familiar to Clojure users:

(defn square [n]
  (let [n (have integer? n)] ; <- A Truss assertion
    (* n n)))

;; This assertion basically expands to:
;; (if (integer? n) n (throw-detailed-assertion-error!))

(square 5)   ; => 25
(square nil) ; =>
;; Invariant failed at truss-examples[9,11]: (integer? n)
;; {:dt #inst "2023-07-31T09:56:10.295-00:00",
;;  :pred clojure.core/integer?,
;;  :arg {:form n, :value nil, :type nil},
;;  :env {:elidable? true, :*assert* true},
;;  :loc
;;  {:ns truss-examples,
;;   :line 9,
;;   :column 11,
;;   :file "examples/truss_examples.cljc"}}

That's everything most users will need to know, but see the documentation for more.



See here for more.


You can help support continued work on this project, thank you!! 🙏


Copyright © 2014-2023 Peter Taoussanis.
Licensed under EPL 1.0 (same as Clojure).