
Clojure REPL Evaluation
FreeEvaluate Clojure code interactively via nREPL.
Free · Opens the source repo
What Clojure REPL Evaluation does
The Clojure REPL Evaluation skill allows developers to evaluate Clojure code using nREPL through the clj-nrepl-eval command. This skill is particularly useful for testing code snippets, checking if edited files compile correctly, and verifying the behavior of functions interactively. By maintaining session state between evaluations, users can require namespaces in one evaluation and utilize them in subsequent calls, making it easier to develop and debug Clojure applications.
To get started, users can discover available nREPL servers running in their project directory with a simple command. Once a server is selected, they can evaluate Clojure expressions directly from the command line. The skill supports various input methods, including command-line arguments, heredoc for multiline expressions, and stdin piping. This flexibility allows for a smooth workflow when testing code or debugging issues.
The skill also provides options to reset the session state, discover connected ports, and specify timeouts for long-running evaluations. It is designed for Clojure developers who need a reliable tool for real-time code evaluation and debugging, enhancing productivity during development cycles.
When to use it
Use this skill when developing Clojure applications to verify code behavior, check for compilation errors, or interact with a running REPL session.
When not to use it
This skill may not be suitable for users who do not work with Clojure or those who need a GUI-based development environment.
What you can build with it
Testing Code Snippets
Quickly evaluate small pieces of Clojure code to test functionality or check for errors.
Debugging Functions
Interactively test and debug functions to ensure they behave as expected during development.
Validating Code Changes
Check that changes made to Clojure files compile correctly before committing them to the repository.
How to install Clojure REPL Evaluation
View source1. Install with the skills CLI
npx skills add metabase/metabase/clojure-eval --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by metabaseClojure REPL Evaluation
When to Use This Skill
Use this skill when you need to:
- Verify that edited Clojure files compile and load correctly
- Test function behavior interactively
- Check the current state of the REPL
- Debug code by evaluating expressions
- Require or load namespaces for testing
- Validate that code changes work before committing
How It Works
The clj-nrepl-eval command evaluates Clojure code against an nREPL server. Session state persists between evaluations, so you can require a namespace in one evaluation and use it in subsequent calls. Each host:port combination maintains its own session file.
Instructions
0. Discover and select nREPL server
First, discover what nREPL servers are running in the current directory:
clj-nrepl-eval --discover-ports
This will show all nREPL servers (Clojure, Babashka, shadow-cljs, etc.) running in the current project directory.
Then use the AskUserQuestion tool:
-
If ports are discovered: Prompt user to select which nREPL port to use:
- question: "Which nREPL port would you like to use?"
- header: "nREPL Port"
- options: Present each discovered port as an option with:
- label: The port number
- description: The server type and status (e.g., "Clojure nREPL server in current directory")
- Include up to 4 discovered ports as options
- The user can select "Other" to enter a custom port number
-
If no ports are discovered: Prompt user how to start an nREPL server:
- question: "No nREPL servers found. How would you like to start one?"
- header: "Start nREPL"
- options:
- label: "deps.edn alias", description: "Find and use an nREPL alias in deps.edn"
- label: "Leiningen", description: "Start nREPL using 'lein repl'"
- The user can select "Other" for alternative methods or if they already have a server running on a specific port
IMPORTANT: IF you start a REPL do not supply a port let the nREPL start and return the port that it was started on.
1. Evaluate Clojure Code
Evaluation automatically connects to the given port
Use the -p flag to specify the port and pass your Clojure code.
Recommended: Pass code as a command-line argument:
clj-nrepl-eval -p <PORT> "(+ 1 2 3)"
For multiple expressions (single line):
clj-nrepl-eval -p <PORT> "(def x 10) (+ x 20)"
Alternative: Using heredoc (may require permission approval for multiline commands):
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(+ x 20)
EOF
Alternative: Via stdin pipe:
echo "(+ 1 2 3)" | clj-nrepl-eval -p <PORT>
2. Display nREPL Sessions
Discover all nREPL servers in current directory:
clj-nrepl-eval --discover-ports
Shows all running nREPL servers in the current project directory, including their type (clj/bb/basilisp) and whether they match the current working directory.
Check previously connected sessions:
clj-nrepl-eval --connected-ports
Shows only connections you have made before (appears after first evaluation on a port).
3. Common Patterns
Require a namespace (always use :reload to pick up changes):
clj-nrepl-eval -p <PORT> "(require '[my.namespace :as ns] :reload)"
Test a function after requiring:
clj-nrepl-eval -p <PORT> "(ns/my-function arg1 arg2)"
Check if a file compiles:
clj-nrepl-eval -p <PORT> "(require 'my.namespace :reload)"
Multiple expressions:
clj-nrepl-eval -p <PORT> "(def x 10) (* x 2) (+ x 5)"
Complex multiline code (using heredoc):
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(* x 2)
(+ x 5)
EOF
Note: Heredoc syntax may require permission approval.
With custom timeout (in milliseconds):
clj-nrepl-eval -p <PORT> --timeout 5000 "(long-running-fn)"
Reset the session (clears all state):
clj-nrepl-eval -p <PORT> --reset-session
clj-nrepl-eval -p <PORT> --reset-session "(def x 1)"
Available Options
-p, --port PORT- nREPL port (required)-H, --host HOST- nREPL host (default: 127.0.0.1)-t, --timeout MILLISECONDS- Timeout (default: 120000 = 2 minutes)-r, --reset-session- Reset the persistent nREPL session-c, --connected-ports- List previously connected nREPL sessions-d, --discover-ports- Discover nREPL servers in current directory-h, --help- Show help message
Important Notes
- Prefer command-line arguments: Pass code as quoted strings:
clj-nrepl-eval -p <PORT> "(+ 1 2 3)"- works with existing permissions - Heredoc for complex code: Use heredoc (
<<'EOF' ... EOF) for truly multiline code, but note it may require permission approval - Sessions persist: State (vars, namespaces, loaded libraries) persists across invocations until the nREPL server restarts or
--reset-sessionis used - Automatic delimiter repair: The tool automatically repairs missing or mismatched parentheses
- Always use :reload: When requiring namespaces, use
:reloadto pick up recent changes - Default timeout: 2 minutes (120000ms) - increase for long-running operations
- Input precedence: Command-line arguments take precedence over stdin
Typical Workflow
- Discover nREPL servers:
clj-nrepl-eval --discover-ports - Use AskUserQuestion tool to prompt user to select a port
- Require namespace:
clj-nrepl-eval -p <PORT> "(require '[my.ns :as ns] :reload)" - Test function:
clj-nrepl-eval -p <PORT> "(ns/my-fn ...)" - Iterate: Make changes, re-require with
:reload, test again
Frequently asked questions about Clojure REPL Evaluation
Similar skills
Agent Host Debug Logs
Analyze Agent Host debug logs for deeper insights.
Code OSS Dev - Launch + Debug
Launch and debug Code OSS with isolated profiles.
Phoenix CLI
Debug LLM applications with structured analysis tools.
Power Automate Debugging
Diagnose and fix Power Automate flow errors effectively.
Arize Trace
Inspect and export traces for LLM applications.
Runtime Behavior Probe
Investigate real runtime behavior with precision.
