clojure-debug
Use when a Clojure, ClojureScript, or ClojureDart program, REPL evaluation, build, or test fails with an error: a stack trace, an exception, a compiler or macroexpansion error, or `ex-info` data in output. Triggers: "Syntax error compiling", "Syntax error macroexpanding", "Syntax error reading source", "Execution error", "Error printing return value", "Unable to resolve symbol", "Could not locate ... on classpath", "did not conform to spec", "Full report at", `ExceptionInfo`, `CompilerException`, `ex-data`, `ex-cause`, `*e`, a `NullPointerException` or `ClassCastException` in Clojure code, or a failing test that reports an error rather than a failed assertion. Covers keeping the original evidence, separating the error phase and wrapper exceptions from the root cause, reading `ex-data`, finding the first application frame, reproducing the failure, and verifying a focused fix.
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install clojure-brackendev-clojure-debugManual setup by platform
Claude Code
~/.claude/skills/clojure-brackendev-clojure-debug/SKILL.md
Instructions
Clojure Debugging
This skill covers finding the cause of a Clojure family error. The procedure applies on every host. The host notes at the end point to the host skills for error formats and tools.
Key Rules
- Keep the original evidence. Save the full error output before changing anything, for example with
2>&1 | tee /tmp/error.log. A rerun after an edit can produce a different error and erase the first one. - Find the phase before the cause. A Clojure error happens while reading source, while expanding a macro, while compiling, or while executing. Each phase has different causes, so a fix that suits one phase does not suit another.
- Read the whole cause chain. An exception can wrap another exception. The outermost message often describes where the error surfaced, and the innermost cause describes what went wrong. Read every message and every
ex-datamap in the chain before deciding. - Start from the first frame in the project's own code. Stack traces are dominated by
clojure.core, the compiler, and library frames. The first frame in a project namespace is where to start reading, though the defect can still be in the data that reached it. - Reproduce before fixing. Reproduce the failure with the smallest call that shows it: one REPL evaluation, one test, or one command. A fix that cannot be shown to change the reproduction is a guess.
- Change one thing, then rerun the reproduction. Confirm the original error is gone and no new error appeared, then run the surrounding tests.
- Report what the evidence shows. Separate what the error output proves from what you infer, and do not describe a hypothesis as the cause until the reproduction confirms it.
Error phases
A Clojure error happens in one of these phases:
- Read. The reader cannot parse the source, usually because of unbalanced delimiters or an invalid literal.
- Macroexpansion. A macro call has the wrong shape, for example an odd number of
letbindings, or the macro itself threw while expanding. - Compile. A symbol cannot be resolved, often because of a missing
:requireor:refer, a typo, or a use before definition. - Execution. The code ran and threw. The location in the message is where the error surfaced, not necessarily where the defect is.
- Printing. At a REPL, the expression returned, and the error came while printing the result. A common cause is a lazy sequence that is realized only when printed, and then the defect is in the code that produced the sequence. JVM Clojure reports this phase as "Error printing return value".
The host's error format names the phase. The host notes below say where to read it. The messages this skill's description quotes, such as "Syntax error compiling", "Execution error", and "Full report at", are the JVM Clojure format, and NullPointerException and ClassCastException are JVM exception types. cljs.main runs its compiler on the JVM and reports compiler errors in the same format, as in "Unexpected error (ExceptionInfo) compiling at (REPL:1)." ClojureDart reports a compiler error as "Compilation error" followed by sections such as "Faulty subform and/or expansion".
Inspecting exceptions
These functions exist on every Clojure host:
(ex-message e) ; the message
(ex-data e) ; the data map of an ex-info exception, or nil
(ex-cause e) ; the wrapped exception, or nil
Walk the chain with ex-cause until it returns nil, and read ex-message and ex-data at every level:
(->> e (iterate ex-cause) (take-while some?) (map (juxt ex-message ex-data)))
When the code throws its own errors, use ex-info with a data map that names the inputs that failed, and pass the original exception as the third argument when rethrowing so the chain keeps the root cause.
Host notes
- JVM Clojure.
clojure-jvm/references/debugging.mdin theclojure-jvmskill covers the Clojure CLI error format and its phases, the "Full report at" file,*eandThrowable->map, classpath errors, and the common JVM exception types. - ClojureScript. Compiler errors and warnings come from the build tool (shadow-cljs, figwheel-main, or
cljs.main). Runtime errors appear in the browser console or thenodeoutput, and source maps map their frames back to ClojureScript. Theclojurescriptskill covers source maps andcatch :default. - ClojureDart. Compiler dynamic warnings exit with status 0 but signal type problems. The
clojuredartskill's Gotchas describe how to tell an inference failure from a resolution failure.
Security
Reviews (0)
More from Clojure Skills (brackendev)
View source →More Build skills
Browse category →Frequently asked questions about clojure-debug
What does the clojure-debug skill do?
Use when a Clojure, ClojureScript, or ClojureDart program, REPL evaluation, build, or test fails with an error: a stack trace, an exception, a compiler or macroexpansion error, or `ex-info` data in output. Triggers: "Syntax error compiling", "Syntax error macroexpanding", "Syntax error reading source", "Execution error", "Error printing return value", "Unable to resolve symbol", "Could not locate ... on classpath", "did not conform to spec", "Full report at", `ExceptionInfo`, `CompilerException`, `ex-data`, `ex-cause`, `*e`, a `NullPointerException` or `ClassCastException` in Clojure code, or a failing test that reports an error rather than a failed assertion. Covers keeping the original evidence, separating the error phase and wrapper exceptions from the root cause, reading `ex-data`, finding the first application frame, reproducing the failure, and verifying a focused fix. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the clojure-debug skill?
Run `npx @skills-hub-ai/cli install clojure-brackendev-clojure-debug` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/clojure-brackendev-clojure-debug/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does clojure-debug work with?
clojure-debug runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the clojure-debug skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use clojure-debug after installing it?
In Claude Code, type `/clojure-brackendev-clojure-debug` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the clojure-debug skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.