agentleFS
brettatomsbrettatoms/agent-skills/clojure-repl/SKILL.md

clojure-repl

Skill3 starsChanged 10 months agoMITView on GitHub

Interact with running Clojure REPLs via nREPL. Evaluate Clojure code, query namespaces, test functions, and debug live Clojure systems. Use when working with .clj/.cljc/.cljs files and a REPL is available.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. kennyjwilli/claude-clojure-tools★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository13 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 9 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run which clj-nrepl-eval. If not found, prompt user to run ./install.sh in this skills folder.

    line 12
  2. Distinctive:

    Test functions without restarting the REPL

    line 19
  3. Distinctive:

    Verify code changes work before committing

    line 23
  4. Distinctive:

    Test changes: - Call functions to verify behavior

    line 45
  5. Distinctive:

    Ensure a Clojure REPL is running with nREPL server

    line 186
  6. Very specific:

    Check .nrepl-port file exists in project root

    line 187
  7. Very specific:

    Start REPL with: clojure -A:dev:<base-alias>

    line 188
  8. Distinctive:

    Default is 2 minutes (120000ms)

    line 198
  9. Distinctive:

    Always discover ports first: - Don't assume port numbers

    line 207
  10. Distinctive:

    Require namespaces explicitly: - Don't assume they're loaded

    line 208
  11. Distinctive:

    Quote code properly: - Use single quotes in bash, escape inner quotes

    line 210
  12. Distinctive:

    Check system state: - Verify Integrant system is running before accessing components

    line 211

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Clojure REPL Integration

This skill enables interaction with running Clojure systems via nREPL using the clj-nrepl-eval CLI tool.

Pre-flight Check

Run which clj-nrepl-eval. If not found, prompt user to run ./install.sh in this skills folder.

When to Use This Skill

Use this skill when you need to:

  • Evaluate Clojure code in a running system
  • Test functions without restarting the REPL
  • Query database connections from the running system
  • Inspect loaded namespaces and their vars
  • Debug live application state
  • Verify code changes work before committing

⚠️ CRITICAL: Reload After File Changes

After editing any Clojure file, you MUST reload it in the REPL for changes to take effect.

The REPL keeps the old code in memory until you explicitly reload. This is the #1 source of confusion when testing changes.

Reload Commands

# Reload a single namespace (most common)
clj-nrepl-eval -p <port> "(require '[banzai.some.namespace] :reload)"

# Reload namespace AND all its dependencies
clj-nrepl-eval -p <port> "(require '[banzai.some.namespace] :reload-all)"

Standard Workflow

  1. Edit file - Make your code changes
  2. Reload namespace - (require '[edited.namespace] :reload)
  3. Test changes - Call functions to verify behavior

Example

# After editing components/content/src/banzai/content/interface.clj:
clj-nrepl-eval -p 64323 "(require '[banzai.content.interface] :reload)"

# Now test the updated function
clj-nrepl-eval -p 64323 "(banzai.content.interface/some-fn {:arg 1})"

When to Use :reload-all

Use :reload-all when:

  • You changed multiple related namespaces
  • You modified a namespace that others depend on
  • Changes don't seem to take effect with :reload

Note: :reload-all is slower but more thorough.

Quick Reference

TaskCommand
Discover REPLsclj-nrepl-eval --discover-ports
Eval codeclj-nrepl-eval -p <port> "<code>"
Reload nsclj-nrepl-eval -p <port> "(require '[ns.name] :reload)"
Reload allclj-nrepl-eval -p <port> "(require '[ns.name] :reload-all)"
With timeoutclj-nrepl-eval -p <port> --timeout 5000 "<code>"

Workflow

1. Discover Available nREPL Servers

clj-nrepl-eval --discover-ports

Output example:

Discovered nREPL servers:

In current directory (/Users/jared/code/banzai-polylith):
  localhost:64323 (clj)

Total: 1 server

2. Evaluate Code

Basic evaluation:

clj-nrepl-eval -p 64323 "(+ 1 2 3)"

Multi-form evaluation:

clj-nrepl-eval -p 64323 "(require '[some.namespace :as ns]) (ns/some-fn)"

3. Common Operations

Check loaded namespaces:

clj-nrepl-eval -p <port> "(filter #(re-find #\"banzai\" %) (map str (all-ns)))"

Require and explore a namespace:

clj-nrepl-eval -p <port> "(require '[banzai.some.interface :as api]) (keys (ns-publics 'banzai.some.interface))"

Access Integrant system components:

clj-nrepl-eval -p <port> "(require '[integrant.repl.state :refer [system]]) (keys system)"

Query database (with datasource from system):

clj-nrepl-eval -p <port> "(def ds (:some.system/datasource integrant.repl.state/system))"
clj-nrepl-eval -p <port> "(with-open [conn (.getConnection ds)] ...)"

Key Features

  • Persistent sessions: Namespace changes and defs persist between calls
  • Auto-repair delimiters: Fixes mismatched parens/brackets before evaluation
  • Auto-responsive guidance: Returns helpful error messages for LLMs
  • Timeout support: Prevent hanging on long-running evaluations

Banzai-Specific Patterns

Access Running System

Most Banzai bases use Integrant. Access system components via:

clj-nrepl-eval -p <port> "(require '[integrant.repl.state :refer [system]])"
clj-nrepl-eval -p <port> "(keys system)"

Common system keys:

  • :banzai.*.system/datasource - Database connection pool
  • :banzai.*.system/jetty - HTTP server
  • :banzai.*.system/router - Reitit router
  • :banzai.*.system/handler - Ring handler

Test a Function

# Require the namespace
clj-nrepl-eval -p <port> "(require '[banzai.some.interface :as api])"

# Call the function
clj-nrepl-eval -p <port> "(api/some-function {:arg1 \"value\"})"

Debug Data

# Pretty print with tap
clj-nrepl-eval -p <port> "(tap> some-data)"

# Or use clojure.pprint
clj-nrepl-eval -p <port> "(require '[clojure.pprint :as pp]) (with-out-str (pp/pprint some-data))"

Troubleshooting

No REPL found:

  • Ensure a Clojure REPL is running with nREPL server
  • Check .nrepl-port file exists in project root
  • Start REPL with: clojure -A:dev:<base-alias>

Namespace not found:

  • The namespace may not be loaded yet
  • Use (require '[namespace.name]) first

Timeout errors:

  • Increase timeout: --timeout 10000 (10 seconds)
  • Default is 2 minutes (120000ms)

Session state issues:

  • Sessions persist; use (in-ns 'user) to reset namespace
  • Or evaluate (ns user) to return to user namespace

Best Practices

  1. Always discover ports first - Don't assume port numbers
  2. Require namespaces explicitly - Don't assume they're loaded
  3. Use timeouts for risky operations - Prevent hanging
  4. Quote code properly - Use single quotes in bash, escape inner quotes
  5. Check system state - Verify Integrant system is running before accessing components

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.