clojure-skills: Docs
Back to clojure-skills.
Installation
claude plugin marketplace add aygp-dr/clojure-skills
claude plugin install clojure@clojure-skills
Requirements:
- Babashka (
bb) onPATH. Without it the hook exits quietly andclj-evaldoes not run. gitand network access the first timeclj-evalruns. It loads the nREPL client from bhauman/clojure-mcp-light at a pinned commit, which Babashka clones into~/.gitlibs. Later runs use that copy.- The Clojure CLI, for the
:lintand:fmtaliases thatproject-setupinstalls.
Evaluating in the REPL
clj-eval joins the nREPL named by .nrepl-port, found by walking up from
the working directory, in a session of its own. It shares the loaded code
with whoever else is connected, but not their *1 or *e. The script ships
inside the skill (skills/repl/scripts/clj-eval) and the agent calls it by
that path; it is not put on PATH.
clj-eval <<'CLJ'
(require '[my.ns :as m] :reload)
(m/parse "input")
CLJ
| exit | means |
|---|---|
| 0 | every form evaluated |
| 1 | a form threw; later forms in the same call still ran |
| 2 | unbalanced delimiters; nothing was sent |
| 3 | no REPL to join, or nothing listening on the port |
| 4 | timed out and was interrupted; the REPL is still usable |
-t MS sets the timeout. The default is 120000.
Setting a project up
clojure:project-setup copies in what is missing and merges into what is
already there. It never overwrites a deps.edn, bb.edn or Makefile. A
read-only script, clj-project-check.sh, prints what a repo lacks and
prints ok when it lacks nothing.
Traps
- A loaded namespace keeps its old definitions until
(require 'the.ns :reload). Evaluating after an edit without reloading tests the old code. - A test run that prints failures is still exit 0: every form evaluated.
Read the
:failand:errorcounts. - nREPL keeps evaluating after a form throws. Exit 1 means at least one form threw; the others still ran.
- A
.nrepl-portleft behind by a dead REPL gives exit 3 straight away. - The hook stays silent in a project whose
.claude/settings.jsonalready runs a paren-repair hook, so the two do not fight over one file. .bbis also BitBake's extension. The hook checks a.bbfile only when it looks like Babashka source.
On-disk state
$HOME/.local/state/clj-eval/journal.edn– one line per evaluation: time, project root, port, status, and the code.$XDG_STATE_HOMEand$CLJ_EVAL_STATEmove it.$HOME/.local/state/clj-eval/sessions/– the nREPL session id per project.$HOME/.gitlibs/– the pinned client library.
The journal and session files are readable by their owner only. All three sit outside your repository and are not removed when the plugin is uninstalled. Delete them by hand.