CL

clojure-eval

Allows you to evaluate Clojure expressions directly against a running nREPL. Essential for debugging and verifying code changes in real-time.

Install

mkdir -p .claude/skills/clojure-eval && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5790" && unzip -o skill.zip -d .claude/skills/clojure-eval && rm skill.zip

Installs to .claude/skills/clojure-eval

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Evaluate Clojure code via nREPL using clj-nrepl-eval. Use this when you need to test code, check if edited files compile, verify function behavior, or interact with a running REPL session.
188 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Discover running nREPL server ports
  • Execute code snippets in existing sessions
  • Verify namespace compilation
  • Maintain persistent REPL state

How it works

It connects to a specified socket port and passes code strings to the nREPL server for evaluation.

Inputs & outputs

You give it
Clojure expression and port selection
You get back
REPL evaluation output or compilation errors

When to use clojure-eval

  • Verify code compilation
  • Test function behavior
  • Inspect REPL state
  • Debug Clojure expressions

About this skill

Clojure 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: Use heredoc via stdin to avoid shell escaping issues. The single-quoted delimiter (<<'EOF') passes all characters through literally.

clj-nrepl-eval -p <PORT> <<'EOF'
(+ 1 2 3)
EOF

For multiple expressions:

clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(+ x 20)
EOF

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:

clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(* x 2)
(+ x 5)
EOF

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 heredoc via stdin: Use clj-nrepl-eval -p <PORT> <<'EOF' ... EOF to avoid shell escaping issues
  • Sessions persist: State (vars, namespaces, loaded libraries) persists across invocations until the nREPL server restarts. --reset-session only resets the nREPL session (clearing dynamic vars like *e, *1), not def'd vars or loaded namespaces
  • Automatic delimiter repair: The tool automatically repairs missing or mismatched parentheses
  • Always use :reload: When requiring namespaces, use :reload to 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

  1. Discover nREPL servers: clj-nrepl-eval --discover-ports
  2. Use AskUserQuestion tool to prompt user to select a port
  3. Require namespace:
    clj-nrepl-eval -p <PORT> "(require '[my.ns :as ns] :reload)"
    
  4. Test function:
    clj-nrepl-eval -p <PORT> "(ns/my-fn ...)"
    
  5. Iterate: Make changes, re-require with :reload, test again

When not to use it

  • Non-Clojure projects
  • Environments without an active nREPL server

Prerequisites

Clojure projectActive nREPL server

Limitations

  • Requires an active nREPL process
  • Cannot debug outside of Clojure runtime context

How it compares

It allows interaction with live, local runtime state rather than simple static linting.

Compared to similar skills

clojure-eval side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
clojure-eval (this skill)15moReviewIntermediate
sqlite-inspector59moReviewIntermediate
dotnet-architect124moNo flagsAdvanced
redis-inspect66moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

sqlite-inspector

mikopbx

Проверка консистентности данных в SQLite баз данных MikoPBX после операций REST API. Использовать при валидации результатов API, отладке проблем с данными, проверке связей внешних ключей или инспектировании CDR записей для тестирования.

568

dotnet-architect

sickn33

Expert .NET backend architect specializing in C#, ASP.NET Core, Entity Framework, Dapper, and enterprise application patterns. Masters async/await, dependency injection, caching strategies, and performance optimization. Use PROACTIVELY for .NET API development, code review, or architecture decisions.

1241

redis-inspect

civitai

Inspect Redis cache keys, values, and TTLs for debugging. Supports both main cache and system cache. Use for debugging cache issues, checking cached values, and monitoring cache state. Read-only by default.

646

defi-protocol-templates

wshobson

Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.

337

sexp

atopile

How the Zig S-expression engine and typed KiCad models work, how they are exposed to Python (pyzig_sexp), and the invariants around parsing, formatting, and freeing.

333

supabase-common-errors

jeremylongshore

Execute diagnose and fix Supabase common errors and exceptions. Use when encountering Supabase errors, debugging failed requests, or troubleshooting integration issues. Trigger with phrases like "supabase error", "fix supabase", "supabase not working", "debug supabase".

430

Search skills

Search the agent skills registry