con un clic
clojure-programmer
Review Clojure and ClojureScript codebases emphasising functional programming idioms.
Menú
Review Clojure and ClojureScript codebases emphasising functional programming idioms.
Expert in Ansible playbook development, role structure, and infrastructure-as-code best practices. Use when managing YAML files in roles/ or tasks/, fixing inventory.yaml, or ensuring idempotent task design.
Helper to prepare, review, and validate DokuWiki pages.
An expert in programming GNU R.
Review Haskell codebases emphasising functional programming idioms.
Check markdown content against standards.
Reviewing Python codebases emphasising functional programming idioms.
| name | clojure-programmer |
| description | Review Clojure and ClojureScript codebases emphasising functional programming idioms. |
Guide Clojure and ClojureScript development using an AI-friendly workflow, idiomatic coding conventions, and functional best practices. Use when writing, developing, or refactoring Clojure or ClojureScript code.
[clojure.string :as str], [clojure.java.io :as io]). Never use :use;
prefer :require with :as or :refer.-> (thread-first) when operating on maps/records
and ->> (thread-last) when operating on sequences. Use as-> for irregular
pipelines and cond-> / cond->> for conditional threading.? for predicates (e.g., valid?) and
! for side-effecting functions (e.g., save!).clojure.core functions for data manipulation instead of custom
classes.atom or
ref for explicitly managing shared, mutable state.deps.edn (Clojure CLI) for
Clojure projects, and shadow-cljs for ClojureScript.Integrant
over global state management.clojure.spec.clj-kondo for static analysis and linting, cljfmt for code
formatting, and clojure.test for unit testing. Use kaocha as an
alternative test runner for richer output and configuration.babashka for shell-script replacement and task automation
within the Clojure ecosystem.taoensso/timbre for structured, data-driven logging. Prefer
structured log maps over format strings.clojure -M:test, make test, or executing a babashka script).portal or
reveal. Instead, print data structures to standard output using prn or
clojure.pprint/pprint so you can read and analyse the terminal output.(comment ...) blocks that you cannot directly
evaluate interactively.src/ and test/ directory split.
Mirror the namespace hierarchy in the directory structure (e.g.,
my.app.core → src/my/app/core.clj).db, api, domain).defn, def,
defmulti). Generate API docs with Codox. Keep private helpers (defn-)
undocumented or with brief inline comments.(let [[a b & rest] coll] ...).(let [{:keys [name age]} person] ...). Use :strs and :syms for string/symbol keys.get-in or select-keys rather than deep destructuring.defn argument lists
to clarify intent at the call boundary.ex-info: Throw structured errors using (ex-info "message" {:type ::domain-error :context ...}). Always include a :type key for programmatic
handling.ex-data: Extract error context with (ex-data e) in catch clauses.
Pattern-match on :type to handle domain vs. infrastructure errors
differently.{:ok result} / {:error reason}) over throwing exceptions.
Reserve exceptions for truly unexpected conditions.Throwable or bare Exception
without logging and re-throwing or returning a structured error.my.app.core → my.app.core-test). One test namespace per source namespace.deftest / is: Use clojure.test/deftest and is for assertions.
Group related assertions under a single deftest; use nested testing blocks
to label sub-cases.use-fixtures with :each or :once to set up and tear
down state (e.g., database connections, temp files).with-redefs sparingly for third-party side effects.test.check for generative tests on pure
functions with well-defined invariants.atom with swap! / reset! for uncoordinated, synchronous,
independent state changes.ref with dosync / alter / commute when multiple
pieces of state must change atomically.agent for asynchronous, uncoordinated state changes where
ordering within a single agent is required.future for fire-and-forget background work; use
promise / deliver for one-shot async handoffs.core.async: Use channels and go blocks for complex async pipelines
and producer/consumer patterns. Prefer pipeline and pipeline-async over
manual channel wiring for parallelism..method syntax for instance methods and
ClassName/method for statics.^String, ^long) on interop-heavy
hotpaths to avoid reflection and improve performance.with-open for any java.io.Closeable to
ensure deterministic cleanup.shadow-cljs for all ClojureScript compilation and REPL
connections.reagent (React wrapper) for component-based UIs, and
re-frame for structured, event-driven state management.js/ (e.g., js/console.log). Use
clj->js / js->clj for data conversion at the boundary. Prefer :require
with :as over goog.module imports.:dev, :test, and :release build targets in
shadow-cljs.edn. Always verify advanced compilation output for externs and
dead-code elimination.let bindings,
map keys) for readability.def to hold mutable state at the top
level. Use defonce only when a singleton is genuinely required, and manage
it via atom with explicit reset semantics.