/clojure:clojurefrom clojure
Provides Clojure development guidance across dialects and runtimes including Clojure, ClojureScript, and Babashka. Covers REPL-first workflows, structural editing, namespace management, and runtime patterns.
Ships in clojure. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Organized using the Viable System Model (VSM). The core skill contains identity (S5), adaptation rules (S4), coordination policies (S3), and routing (S2). Operational recipes live in references/ and should be loaded on demand.
Data-oriented, REPL-first development for Clojure, ClojureScript, and Babashka. Pure functions transform data; side effects live at system edges. The REPL is the development environment — verify assumptions, test feasibility, and explore APIs regardless of role.
Habit: pick the right namespace before you eval. Eval from the owning file, or (in-ns '…) / require+alias into that ns; Calva: watch the ns chip; load the file into this REPL when it is not there yet. Unable to resolve symbol: … is a sign that attention was skipped (wrong current ns, or never loaded) — usually not a missing def. Same shape on Scittle nREPL / SCI (:type :sci/error, callstack ns). Details: references/repl-workflows.md.
Before any file modification: read → test → develop in REPL → verify → apply. Use inline def for debugging over println — inline bindings keep intermediate state inspectable.
(defn group-by-status [items]
(def items items)
(let [grouped (group-by :status items)]
grouped))
Never edit Clojure forms with plain string/file-edit tools — non-structural edits corrupt bracket balance and indentation. Use structural editing (Backseat Driver's clojure_edit_files, parinfer-backed). When editing subagents are available, delegate: Clojure forms and new top-level line comments added together with a form → clojure-editor; non-Clojure files and edits/removals of existing top-level Clojure line-comment blocks → non-clojure-editor. Here, top-level means zero Clojure form depth, outside forms and strings.
Feed stdin-reading functions with with-in-str or arguments — the connected REPL has no usable process stdin. Details: references/runtime-patterns.md.
Give :reload and :reload-all a require of their own, naming only the namespaces you mean to reload. The flag applies to every library in the form, so (require '[some.lib :as lib] 'my.ns :reload) reloads some.lib too. A reloaded library defines its records and types as new classes, and data built before the reload still holds the old ones: instance?, protocol dispatch and the library's own predicates stop recognizing it, while the running code carries on. Integrant refs in a prepared config are a typical case — the running system is fine, and building anything new from that config gives unresolved refs. When it has happened, rebuild that data with the reloaded library (read the config again).
Prefer aliasing over referring, except for common test macros. Alias clojure.string as string.
Immediately after function name, before argument vector. State responsibility first.
(defn append-section
"Appends a section to the specified file."
[file-path section]
;; implementation
)
Define before use. Factor across namespaces to break circular dependencies rather than using declare.
Condition and body on separate lines. and/or arguments on separate lines:
(if (and condition-a
condition-b)
this
that)
Respect existing names — rename only when semantic purpose fundamentally changed. No V2/Enhanced/Improved suffixes. Comments for unclear business logic only, not code evolution.
Each function does one thing well and returns a useful value. Compose small, focused functions.
data_in → data_out — functions transform datacond/condp over nested if; when guards over else branchesif; multiple → condif-let/when-let instead of (let [x ...] (if x ...))when with guard first-> for subject-first, ->> for collection-last. some->/some->> for nil-safe threading. Threading is for readability — no single-step threading, no threading side effects.
Seq operations treat nil as an empty collection. map, mapv, mapcat, filter, concat, and reduce (with an init) accept nil without a guard.
(mapv transform items) ; nil → []
(mapcat :children node) ; nil → ()
(or coll []) before these calls does no extra work. A helper whose only job is that guard is a wrapped core function — call map/mapv/mapcat directly.
update writes the mapped result onto the key: (update m :items mapv f) turns a missing or nil :items into []. That materializes empty. Keep nil with some->/some->>, or by not calling update.
nil is falsey; () and [] are truthy.
Use parameters directly. Intermediate bindings only when transforming or improving readability. Do not wrap core functions unless a name genuinely clarifies composition.
Flat structures with namespaced keywords, optimized for destructuring. Domain-qualified keys: self-documenting, collision-free, extensible.
(defn handle-user-request
[{:user/keys [id name email]
:request/keys [method path headers]
:config/keys [timeout debug?]}]
(when debug?
(println "Processing" method path "for" name)))
Rename incoming keys to avoid hiding core functions. Keep free: count, filter, first, get, key, map, merge, name, reduce, set, str, type, update.
Prefer keyword destructuring varargs (& {:keys [...]}) over multi-arity for optional parameters. Accepts both keyword args and a single map (Clojure 1.11+):
(defn fetch [url & {:keys [timeout retries] :or {timeout 5000 retries 3}}]
...)
(fetch "https://example.com" :timeout 10000)
(fetch "https://example.com" {:timeout 10000})
Keywords as functions with defaults: (:some-key some-map default-value). Destructure only keys used directly; preserve full map with :as. Set defaults at entry points — boundaries validate, internals trust.
Explicit context maps with namespaced keys over dynamic vars, global atoms, or implicit state. Build at system edges, thread through the call stack. Flat and mergeable.
Centralized app-db atom with namespaced keywords over scattered defonce atoms (when not using a unidirectional-flow event system).
Side-effecting functions return rich summaries so callers can verify, test, and compose.
(defn copy-files!
[file-list target-dir]
(let [results (for [file file-list]
(try
{:file (:name file) :status :copied
:target (path/join target-dir (:name file))}
(catch Exception e
{:file (:name file) :status :failed
:error (ex-message e)})))]
{:total-files (count file-list)
:successful (count (filter #(= (:status %) :copied) results))
:failed (count (filter #(= (:status %) :failed) results))
:details results}))
Errors are data. ex-info/ex-data for rich context over string messages.
(or value fallback) hides broken configEarned through repeated need. Multimethods for data-shape dispatch; protocols for type-based polymorphism; spec for boundary contracts. Simplicity over abstraction.
Group by domain, not by type. Acyclic dependency direction — require is an explicit contract. Compose behavior externally when core needs optional enhancement from a dependent module.
(comment ...) documents validated REPL work. Not evaluated on load. Use after REPL validation for usage documentation and exploration preservation.
Reload and test from the REPL for immediate feedback:
(require '[my.project.some-test] :reload)
(clojure.test/run-tests 'my.project.some-test)
Break complex functions into named, testable helpers. Define and test individually, then compose.
Stay focused on the specific problem. No unnecessary checks or unrelated suggestions.
Clojure runs on multiple hosts with different semantics. Identify the dialect before writing code.
These are indicators, not rules — use common sense, and verify with the human if uncertain:
| Indicator | Dialect |
|---|---|
deps.edn or project.clj, JVM classpath | JVM Clojure |
bb.edn, #!/usr/bin/env bb | Babashka (SCI on JVM) |
shadow-cljs.edn or :cljs build config | ClojureScript |
squint.edn, .cljs compiled to .mjs | Squint |
.joyride/ directory, Joyride REPL session | Joyride (SCI in VS Code) |
Scittle <script> tags, browser SCI REPL | Scittle (SCI in browser) |
nbb.edn, #!/usr/bin/env nbb | nbb (SCI on Node.js) |
When a project uses multiple dialects (e.g., Babashka for tooling, Squint for application code), identify which dialect governs each file before planning or editing.
Dedicated skills exist for Squint and Babashka — load them for operational depth. This section provides cross-dialect awareness that is always available.
| Feature | JVM Clojure | SCI | Squint | ClojureScript |
|---|---|---|---|---|
| Keywords | true keywords | true keywords | strings | true keywords |
| Async unwrap | threads / core.async | await (not js-await) | js-await (both work, convention) | core.async / promesa |
| Data conversion | native Clojure | native Clojure | JS-native (not js->clj/clj->js) | clj->js / js->clj |
| Mutability | immutable | immutable | JS objects (shallow-copy semantics) | immutable |
| Macros | full defmacro | full defmacro | compile-time only | :require-macros from .clj |
await. js-await is Squint-specific and does not resolve in SCI.js-await by convention. Bare await also works (REPL-verified) but js-await distinguishes Squint code from SCI code.js->clj and clj->js do not exist in Squint. Data is already JS-native. Calling them produces a ReferenceError at runtime.(= :status "status") is true.:require-macros, no :include-macros true.Load dialect references from references/ for operational depth per dialect.
Load these from references/ when the task needs operational depth:
squint.edn projects.if for binary, cond for multiple, when-let/if-let for bind-and-testnil as empty — trust nil punning; (or coll []) before map/mapv/mapcat is redundantex-info/ex-data with rich context; propagate rather than catch-and-ignoreWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
clojure, clojurescript, babashka, repl-workflow, structural-editing
npx claudepluginhub betterthantomorrow/awesome-backseat-driver --plugin clojureOther plugins' skills for the same job