A Clojure CI job spends most of its wall clock starting a JVM to discover that somebody left an unused binding in a let and formatted a map with a stray space. None of that work needs the JVM, and none of it is caught by tests.

Three tools fix that gap, and they are routinely mistaken for competitors. Babashka (4,651 stars, v1.13.230, pushed 2026-11-30) is a native Clojure interpreter for scripts and task running. clj-kondo (1,870 stars, v2026.12.01, pushed 2026-12-01) is a linter that statically analyzes Clojure without evaluating it. cljfmt (1,231 stars, v0.16.6, pushed 2026-10-22) is a deterministic formatter. They share the Clojure dialect and almost nothing else.

TL;DR

  • Adopt clj-kondo first. It finds real bugs — unused bindings, wrong arity, unresolved symbols, private var access — in under a second and runs on a native binary.
  • Adopt babashka second. It replaces shell scripts, Makefiles and slow JVM task runners with a 20 ms interpreter and a bb.edn task map.
  • Adopt cljfmt last, and in its own commit. It will rewrite every file once; after that it ends formatting arguments forever.
  • They are not alternatives. A mature Clojure repo uses all three: bb to orchestrate, clj-kondo to gate, cljfmt to normalize.

Comparison table

DimensionBabashkaclj-kondocljfmt
PurposeScripting runtime + task runnerStatic linterCode formatter
Stars / last push4,651 / 2026-11-301,870 / 2026-12-011,231 / 2026-10-22
Current releasev1.13.230v2026.12.010.16.6 (dev.weavejester/cljfmt)
Clojars downloads302K (artifact), native installs dominate8.5M1.5M
LicenseEPL-1.0EPL-1.0EPL-1.0
RuntimeNative binary (GraalVM image built from sci)Native binary or JVMNative binary or JVM
Startup~10–20 ms~50–150 ms for a large tree~100 ms plus file IO
Config filebb.edn.clj-kondo/config.edn.cljfmt.edn
Typical CI roleRun tasks, glue scripts, release stepsFail the build on findingsFail the build on unformatted code
Editor integrationScript REPL, clojure-lsp tasksclojure-lsp diagnosticsclojure-lsp formatting

Decision matrix

Your situationToolWhy
A shell script with jq pipelines is now 300 linesbabashkaReal data structures, real error handling, one binary
Build fails randomly on a Friday with ArityExceptionclj-kondoArity and unresolved-symbol checks run before tests
Every PR contains whitespace-only diff noisecljfmtFormatting stops being a review topic
You want a Makefile that works on macOS and Linuxbabashka bb.edn tasksNo shell portability tax
You maintain custom macros and the linter is confusedclj-kondo hooks:analyze-call teaches the linter your macro
You only have time for one toolclj-kondoHighest bug-per-minute return

Babashka: the scripting runtime

Babashka compiles a Clojure interpreter (sci) into a native binary. It loads in the same order of magnitude as a shell builtin, which changes what you are willing to script in Clojure: pre-commit hooks, release chores, log parsing, HTTP calls against your own API.

Install and check it:

1
2
3
4
curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
chmod +x install && ./install
bb --version
bb -e '(+ 1 2)'

The reason teams keep it is bb.edn, a task map that replaces the Makefile:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{:paths ["bb"]
 :tasks {lint  {:doc "Lint the whole tree"
                :task (shell "clj-kondo --lint src test")}
         fmt   {:doc "Check formatting"
                :task (shell "cljfmt check src test")}
         test  {:doc "Run the test suite"
                :task (shell "clojure -M:test")}
         ci    {:doc "What CI runs"
                :depends [lint fmt]
                :task (shell "clojure -M:test")}}}

bb run ci executes lint and fmt first, stops on the first failure, and only then pays for a JVM. In practice that turns a six-minute feedback loop into a forty-second one for the most common class of mistake — a typo, an unused binding, a broken namespace declaration.

Babashka also ships a large set of built-in libraries (babashka.http-client, babashka.fs, babashka.process, cheshire, clojure.tools.cli) so a script that calls an API, walks a directory and writes JSON needs no dependency resolution at all.

Where it stops: babashka is not the JVM. There is no arbitrary class loading, no deftype-heavy libraries, and any dependency that generates bytecode at runtime (some ORM and mocking libraries) will not work. Rule of thumb: if the library documentation says “requires AOT”, it belongs in a JVM task, not in bb.

clj-kondo: the linter that pays for itself

clj-kondo parses your code, resolves symbols, and reports findings without running anything. It understands ns forms, :require aliases, macro definitions in your own codebase, and — through exported configs — the macros of your dependencies.

1
2
3
4
5
6
7
8
# lint a tree
clj-kondo --lint src test

# machine-readable output for CI annotations
clj-kondo --lint src --config '{:output {:format :json}}'

# import configs shipped by your dependencies, then lint again
clj-kondo --copy-configs --deps-root .

The config file is where the value compounds:

1
2
3
4
5
6
;; .clj-kondo/config.edn
{:linters {:unused-binding      {:level :warning}
           :redundant-do         {:level :warning}
           :missing-else-branch  {:level :off}
           :unresolved-symbol    {:level :error}}
 :hooks   {:analyze-call {my.ns/with-tenant my.hooks/with-tenant}}}

The :hooks entry is the escape hatch for custom macros. If your codebase has a with-tenant macro that introduces a binding, the linter will otherwise report that binding as unresolved in every call site. A hook tells clj-kondo how to interpret the macro’s arguments, which converts a wall of false positives into silence.

Two numbers justify the adoption: clj-kondo’s own artifact has 8.5M downloads, and lint runs are cheap enough to execute on every save. A linter that takes 30 seconds gets disabled; one that takes 80 milliseconds becomes part of the editing loop.

Where it stops: clj-kondo is not a type checker. It will not tell you that a map is missing a key or that a function returns nil on one branch. It catches syntactic and structural mistakes, which is why it complements tests rather than replacing them.

cljfmt: end the formatting argument

cljfmt rewrites Clojure source into a canonical layout, including the indentation rules for macros that Clojure editors disagree about.

1
2
cljfmt check src test   # exit non-zero if anything would change
cljfmt fix src test     # rewrite in place

Custom macros need an indent rule, otherwise the formatter will reflow them into something unreadable:

1
2
3
4
5
;; .cljfmt.edn
{:indents {my.ns/with-timing [[:inner 0]]
           my.ns/deftask    [[:inner 0]]}
 :remove-trailing-whitespace? true
 :insert-missing-whitespace?  true}

Adopt it in two steps, in this order: run cljfmt fix across the repository as a standalone commit that touches nothing else, then add cljfmt check to CI. Doing it the other way — enforcing the check first — produces a pull request with three thousand changed lines and the reformat buried inside a feature diff, which is how formatters get reverted.

Wiring all three into CI

The whole toolchain fits in one job, with the expensive JVM step last:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
- name: Install Clojure tools
  run: |
    curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
    chmod +x install && ./install --dir /usr/local/bin

- name: Lint and format
  run: |
    clj-kondo --lint src test
    cljfmt check src test

- name: Test
  run: clojure -M:test

Pin the versions in CI. clj-kondo uses calendar versioning (2026.12.01), which means a new release can add linters and turn a green build red without a single code change. Pinning is the difference between “the linter found a new bug” and “the build broke on Tuesday”.

Where these fit with the rest of your Clojure stack

Tooling decisions compound, and these three sit underneath everything else in a Clojure repository. The build layer is the first neighbour: whatever produces your classpath has to expose the same source paths to the linter and the formatter, otherwise clj-kondo --lint src silently skips a directory that deps.edn adds later. Our Leiningen vs tools.build vs Boot comparison covers how each build tool declares paths, which is exactly what you mirror in .clj-kondo/config.edn and .cljfmt.edn.

The second neighbour is the test suite. Lint catches structural mistakes before tests run, but the boundary between the two matters: an unused binding is a lint finding, a wrong assertion is a test finding, and confusing the two leads teams to disable linter warnings instead of fixing them. If your fixtures are still (use 'my.ns)-style, the Clojure testing frameworks guide explains the modern alternatives and how they interact with a task runner.

The third is observability. A bb.edn task that shells out to clojure -M:run inherits whatever logging configuration your app declares, so the log library you choose determines whether your CI output is readable. The Timbre vs tools.logging vs mulog comparison is the reference for that layer.

None of this requires a rewrite. The practical sequence is: install clj-kondo, silence the legitimate false positives with hooks, add bb.edn tasks so nobody types clojure -M: by hand again, then land one formatting commit and gate it. Three afternoons, and the JVM stops being your first line of defence against typos.

Pitfalls

  1. Treating babashka as Clojure. It is a subset. Bytecode-generating libraries, deftype-dependent frameworks and anything that manipulates the classloader will fail in ways that look like your bug.
  2. Skipping --copy-configs. Without imported configs, clj-kondo reports false positives inside popular libraries’ macros. Re-run it whenever deps.edn changes.
  3. Enforcing formatting before formatting. Land the cljfmt fix commit first, then gate. Otherwise reviewers cannot see the actual change.
  4. Ignoring exit codes. Both cljfmt check and clj-kondo exit non-zero on findings. A CI step that pipes to tee swallows that; never wrap them in a pipeline without set -o pipefail.
  5. Linting generated code. Add :lint-as or an :exclude for generated namespaces, or your build directory will produce hundreds of findings nobody can fix.
  6. Letting the linter own style. clj-kondo is for correctness, cljfmt for layout. Fighting over warning levels is a sign the team has not agreed on a baseline.

FAQ

Is babashka a replacement for Clojure? No. Babashka is an interpreter for scripting and tooling. Application code, tests that rely on JVM libraries, and anything that needs real bytecode still runs on Clojure with the JVM.

Does clj-kondo need the JVM? No. It ships as a native binary and also as a library. The native binary is what you want in CI and in clojure-lsp.

Can cljfmt and clj-kondo disagree? They solve different problems — layout versus correctness — so they do not conflict. Editors that run both on save (through clojure-lsp) apply formatting and diagnostics in one pass.

How long does adoption take? An afternoon: install the binaries, run clj-kondo --lint src test and fix or silence the findings, then land a formatting-only commit. The linter config keeps growing as you add hooks for your macros.

What about cljstyle instead of cljfmt? Both format Clojure. cljfmt is the more widely integrated option through clojure-lsp; cljstyle offers different rule coverage. Pick one and enforce it — running two formatters guarantees churn.

Do these tools work with ClojureScript? Yes. clj-kondo analyzes .cljs and .cljc files, cljfmt formats them, and babashka can run .cljc scripts that avoid JVM-only interop.



💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com