Babashka scripting and task running — use when writing or debugging a bb script or bb.edn task, choosing Babashka over the JVM, using a built-in namespace or pod, or packaging with uberscript or uberjar.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Clojure Babashka?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/just-sultanov-clojure-babashka)
---
name: clojure-babashka
description: Babashka scripting and task running — use when writing or debugging a bb script or bb.edn task, choosing Babashka over the JVM, using a built-in namespace or pod, or packaging with uberscript or uberjar.
license: EPL-1.0 AND CC-BY-SA-4.0 AND MIT
---
# Clojure Babashka
Owns the Babashka runtime and its project workflow: choosing `bb` over the JVM,
running one-liners and scripts, `bb.edn` paths, deps, and pods, the task runner,
and the built-in namespaces that replace a dependency. JVM `deps.edn`, aliases,
and `tools.build` are `clojure-deps`; the JVM REPL is `clojure-repl`;
formatting, linting, and editor setup are `clojure-tooling`; language-level
style and version gates are `clojure-style` and `clojure-versions`. The text is
adapted from the Babashka repository, the Babashka book, and the
`babashka.cli` and `babashka.http-client` documentation under EPL 1.0,
CC BY-SA 4.0, and MIT; see [NOTICE.md](NOTICE.md).
## Ground rules
- **Check the binary before the feature.** Run `bb version` and `bb describe`
before planning. [builtins.md](references/builtins.md) owns the feature
inventory and [bb-edn.md](references/bb-edn.md) owns `:min-bb-version`.
- **Start with what the binary ships.** Prefer `babashka.fs`,
`babashka.process`, `babashka.http-client`, `babashka.cli`, `cheshire.core`,
`clojure.test`, and `clj-yaml.core` (when `bb describe` reports
`:feature/yaml true`) over a dependency; [builtins.md](references/builtins.md)
has the selection and the override rule.
- **Files require explicitly.** The `user` aliases belong to `-e` and the REPL;
a script declares every namespace it uses. See
[builtins.md](references/builtins.md).
- **`bb.edn` is the project.** Paths, deps, pods, tasks, and the minimum
version belong there; [bb-edn.md](references/bb-edn.md) owns discovery and
the one-off flags.
- **`bb` is not bash.** Shell syntax belongs in `bash -c`; argv and glob
handling are in [process.md](references/process.md) and
[fs.md](references/fs.md).
- **Startup is the product.** Keep top-level work small and package a repeated
script; [runtime.md](references/runtime.md) and
[packaging.md](references/packaging.md) own the mechanics.
- **Exit codes are the contract.** Let a failure exit non-zero and handle a
child's exit deliberately; [runtime.md](references/runtime.md) and
[process.md](references/process.md) own the rules.
## Workflow
### 1. Classify the job
Decide which artifact you are changing: a `-e` one-liner, a standalone script,
a `bb.edn` project, a task, or a pod. Read the existing `bb.edn`, the script's
shebang and `ns`, and the CI command before writing.
Done when you can name the entry point (`bb -e`, `bb file`, `bb -x`, `bb -m`,
`bb run task`) and the file that owns it.
### 2. Fix the runtime
Run `bb version`, `bb describe`, and `bb tasks` in the project. Read
[runtime.md](references/runtime.md) when the job needs a flag, stdin, or an
exit code, [packaging.md](references/packaging.md) when it needs a
self-contained artifact, and [builtins.md](references/builtins.md) when a
namespace looks like it needs a dependency.
Done when every require and flag you plan is present in the installed binary,
or the version gate is recorded.
### 3. Write the script
Use a shebang, an explicit `ns`, `:require` with aliases, and a main guard when
the file can also be loaded:
```clojure
#!/usr/bin/env bb
(ns my.tool
(:require [babashka.cli :as cli]
[babashka.process :as p]))
(defn -main [& args]
(let [opts (cli/parse-opts args {:spec {:dir {:coerce :string}}})]
(p/shell {:dir (:dir opts)} "ls")))
(when (= *file* (System/getProperty "babashka.file"))
(apply -main *command-line-args*))
```
Done when the real invocation runs from a clean shell and the script has no
undeclared namespace.
### 4. Put project state in `bb.edn`
Declare `:paths`, only the missing `:deps`, `:pods`, `:min-bb-version`, and the
tasks that make the workflow repeatable. Relative paths resolve against
`bb.edn`; a script-adjacent `bb.edn` follows the script. See
[bb-edn.md](references/bb-edn.md) and [tasks.md](references/tasks.md).
Done when `bb tasks` lists the intended entry points and `bb run <task>` works
from the project root without extra flags.
### 5. Use the built-in for the job
Reach for the namespace that already does it: [fs.md](references/fs.md) for
paths, [process.md](references/process.md) for children,
[http.md](references/http.md) for HTTP, [data.md](references/data.md) for
JSON, YAML, EDN, CSV, and XML, and [cli.md](references/cli.md) for arguments.
Use [pods.md](references/pods.md) only when the job needs native code or a
JVM-only library.
Done when no added dependency duplicates a built-in namespace and every
external process receives argv, not a spliced shell string.
### 6. Test and package
Add a `test` task that runs `clojure.test`, exits non-zero on failure, and uses
`clojure.test.check` when `bb describe` reports `:feature/test-check true` and
properties fit. Package only when the script must run without a project
checkout. See [testing.md](references/testing.md) and
[packaging.md](references/packaging.md).
Done when the test task fails on a deliberately broken assertion and the
packaged artifact runs the same entry point.
## Checklist
- [ ] `bb version` and `bb describe` confirm every namespace and feature used.
- [ ] `:min-bb-version` is set when the project uses a new flag or namespace.
- [ ] Scripts have an explicit `ns`; no `user` aliases leak into a file.
- [ ] `bb.edn` carries only pure Clojure deps; native needs are pods.
- [ ] Tasks use `:doc`, `:depends`, and `:exec-fn`/`:cmd` instead of ad-hoc
argv parsing.
- [ ] Shell calls pass argv, use `:dir`/`:extra-env`, and handle non-zero exit.
- [ ] The test task exits non-zero on failure; `clojure.test.check` runs when
`bb describe` reports `:feature/test-check true`.
- [ ] No top-level work that a one-liner or packaged artifact should avoid.
## Related skills
- `clojure-deps` — `deps.edn`, aliases, the Clojure CLI, and `tools.build`; use
it when the same code must run on the JVM.
- `clojure-repl` — the JVM REPL and reload workflow; `bb repl` is a different
runtime.
- `clojure-testing` — the general `clojure.test` rules, fixtures, property
testing, and the JVM runners; this skill wires them into `bb` tasks.
- `clojure-tooling` — cljfmt, clj-kondo, clojure-lsp, and CI around `bb.edn`.
- `clojure-style` — naming, layout, and idiom in the Clojure the script
contains.
- `clojure-versions` — which Clojure release a form needs; Babashka's SCI
version is not the project's JVM version.
## References
| File | Read when |
| --------------------------------------- | --------------------------------------------------------------------------- |
| [runtime.md](references/runtime.md) | exec modes, scripts, stdin, exit codes, environment |
| [repl.md](references/repl.md) | `bb repl`, socket REPL, nREPL, history |
| [packaging.md](references/packaging.md) | `uberscript`, `uberjar`, `bb prepare` |
| [sci.md](references/sci.md) | Java classes, performance, language limits, `clojure-version` |
| [builtins.md](references/builtins.md) | choosing a built-in namespace, checking features, overriding a version |
| [bb-edn.md](references/bb-edn.md) | paths, deps, pods, minimum version, config discovery |
| [tasks.md](references/tasks.md) | task maps, hooks, dependencies, `:exec-fn`, `:cmd`, shell and Clojure tasks |
| [fs.md](references/fs.md) | paths, globs, walking, copying, temp files |
| [process.md](references/process.md) | child processes, pipelines, exit codes, environment |
| [http.md](references/http.md) | requests, status handling, streaming, timeouts |
| [data.md](references/data.md) | JSON, YAML, EDN, CSV, XML, transit |
| [cli.md](references/cli.md) | `babashka.cli`, `-x`, `:exec-fn`, subcommands |
| [testing.md](references/testing.md) | the bb test task, exit codes, built-in `clojure.test.check` gates |
| [pods.md](references/pods.md) | native or JVM-only libraries loaded as pods |