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) on PATH. Without it the hook exits quietly and clj-eval does not run.
  • git and network access the first time clj-eval runs. 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 :lint and :fmt aliases that project-setup installs.

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 :fail and :error counts.
  • nREPL keeps evaluating after a form throws. Exit 1 means at least one form threw; the others still ran.
  • A .nrepl-port left behind by a dead REPL gives exit 3 straight away.
  • The hook stays silent in a project whose .claude/settings.json already runs a paren-repair hook, so the two do not fight over one file.
  • .bb is also BitBake's extension. The hook checks a .bb file 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_HOME and $CLJ_EVAL_STATE move 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.

Elsewhere