alpha

Gives an AI coding assistant Clojure conventions: REPL-driven development through Calva, docstring placement, aligned data structures and namespace handling.
description: 'Clojure-specific coding patterns, inline def usage, code block templates, and namespace handling for Clojure development.'
applyTo: '**/*.{clj,cljs,cljc,bb,edn.mdx?}'
“Use the repl” means to use the Evaluate Clojure Code tool from Calva Backseat Driver. It connects you to the same REPL as the user is connected to via Calva.
Do not over-escape JSON arguments when invoking REPL tools.
{
"namespace": "<current-namespace>",
"replSessionKey": "cljs",
"code": "(def foo \"something something\")"
}
defnDocstrings belong immediately after the function name and before the argument vector.
(defn my-function
"This function does something."
[arg1 arg2]
;; function body
)
declare except when truly necessary.Always align multi-line elements vertically in all data structures: vectors, maps, lists, sets, all code (since Clojure code is data). Misalignment causes the bracket balancer to close brackets incorrectly, creating invalid forms.
;; ❌ Wrong - misaligned vector elements
(select-keys m [:key-a
:key-b
:key-c]) ; Misalignment → incorrect ] placement
;; ✅ Correct - aligned vector elements
(select-keys m [:key-a
:key-b
:key-c]) ; Proper alignment → correct ] placement
;; ❌ Wrong - misaligned map entries
{:name "Alice"
:age 30
:city "Oslo"} ; Misalignment → incorrect } placement
;; ✅ Correct - aligned map entries
{:name "Alice"
:age 30
:city "Oslo"} ; Proper alignment → correct } placement
Critical: The bracket balancer relies on consistent indentation to determine structure.
Use clojure.repl.deps/add-libs for dynamic dependency loading during REPL sessions.
(require '[clojure.repl.deps :refer [add-libs]])
(add-libs '{dk.ative/docjure {:mvn/version "1.15.0"}})
*clojure-version*
;; => {:major 1, :minor 12, :incremental 1, :qualifier nil}
Never edit code files when the REPL is unavailable. When REPL evaluation returns errors indicating that the REPL is unavailable, stop immediately and inform the user. Let the user restore REPL before continuing.
my.project.ns → my/project/ns.clj).After editing files, reload the edited namespace in the REPL so updated definitions are active.
(require 'my.namespace :reload)
Consistent indentation is crucial to help the bracket balancer.
;; ❌
(defn my-function [x]
(+ x 2))
;; ✅
(defn my-function [x]
(+ x 2))
Keep the condition and body on separate lines:
(when limit
(println "Limit set to:" limit))
Keep the and and or arguments on separate lines:
(if (and condition-a
condition-b)
this
that)
Prefer inline def debugging over println/console.log.
def for Debuggingdef bindings keep intermediate state inspectable during REPL work.(defn process-instructions [instructions]
(def instructions instructions)
(let [grouped (group-by :status instructions)]
grouped))
You can also use "inline def" when showing the user code in the chat, to make it easy for the user to experiment with the code from within the code blocks. The user can use Calva to evaluate the code directly in your code blocks. (But the user can't edit the code there.)
Prefer using the REPL and return values from your evaluations, over printing things to stdout.
stdin(read-line), it will prompt the user through VS Code.We try to keep our data structures as flat as possible, leaning heavily on namespaced keywords and optimizing for easy destructuring. Generally in the app we use namespaced keywords, and most often "synthetic" namespaces.
Destructure keys directly in the parameter list.
(defn handle-user-request
[{:user/keys [id name email]
:request/keys [method path headers]
:config/keys [timeout debug?]}]
(when debug?
(println "Processing" method path "for" name)))
Among many benefits this keeps function signatures transparent.
Rename incoming keys when necessary to avoid hiding core functions.
(defn create-item
[{:prompt-sync.file/keys [path uri]
file-name :prompt-sync.file/name
file-type :prompt-sync.file/type}]
#js {:label file-name
:type file-type})
Common symbols to keep free:
classcountempty?filterfirstgetkeykeywordmapmergenamereducerestsetstrsymboltypeupdateDo not wrap core functions unless a name genuinely clarifies composition.
(remove (set exclusions) items) ; a wrapper function would not make this clearer
Rich Comment Forms (comment ...) serve a different purpose than direct REPL evaluation. Use RCFs in file editing to document usage patterns and examples for functions you've already validated in the REPL.
RCF = Rich Comment Forms.
When files are loaded code in RCFs is not evaluated, making them perfect for documenting example usage, since humans easily can evaluate the code in there at will.
(defn process-user-data
"Processes user data with validation"
[{:user/keys [name email] :as user-data}]
;; implementation here
)
(comment
;; Basic usage
(process-user-data {:user/name "John" :user/email "john@example.com"})
;; Edge case - missing email
(process-user-data {:user/name "Jane"})
;; Integration example
(->> users
(map process-user-data)
(filter :valid?))
:rcf) ; Optional marker for end of comment block
;; In chat - show direct REPL evaluation:
(in-ns 'my.namespace)
(let [test-data {:user/name "example"}]
(process-user-data test-data))
;; In files - document with RCF:
(comment
(process-user-data {:user/name "example"})
:rcf)
Reload the target namespace and execute tests from the REPL for immediate feedback.
(require '[my.project.some-test] :reload)
(clojure.test/run-tests 'my.project.some-test)
(cljs.test/run-tests 'my.project.some-test)
Prefer running individual test vars from within the test namespace when investigating failures.
Iterate with real data before editing files.
(def sample-text "line 1\nline 2\nline 3\nline 4\nline 5")
(defn format-line-number [n padding marker-len]
(let [num-str (str n)
total-padding (- padding marker-len)]
(str (apply str (repeat (- total-padding (count num-str)) " "))
num-str)))
(deftest line-number-formatting
(is (= " 5" (editor-util/format-line-number 5 3 0))
"Single digit with padding 3, no marker space")
(is (= " 42" (editor-util/format-line-number 42 3 0))
"Double digit with padding 3, no marker space"))
Keep deftest names descriptive (area/thing style) without redundant -test suffixes.
Attach expectation messages directly to is, using testing blocks only when grouping multiple related assertions.
(deftest line-marker-formatting
(is (= "→" (editor-util/format-line-marker true))
"Target line gets marker")
(is (= "" (editor-util/format-line-marker false))
"Non-target gets empty string"))
(deftest context-line-extraction
(testing "Centered context extraction"
(let [result (editor-util/get-context-lines "line 1\nline 2\nline 3" 2 3)]
(is (= 3 (count (str/split-lines result)))
"Should have 3 lines")
(is (str/includes? result "→")
"Should have marker"))))
Guidelines:
testing for grouping related checks.line-marker-formatting or context-line-extraction.Remember to prefer the REPL in your work. Keep in mind that the user does not see what you evaluate. Nor the results. Communicate with the user in the chat about what you evaluate and what you get back.
© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Four city outfit change with depth reference
Directs a 12-second vertical video where one woman spins through four city outfit changes, locked to outfit pictures, a face crop and a depth-video motion reference.
video-prompt, reference-image, character-consistency, face-reference, timed-beats, multi-shot, vertical-format, transformation, video-ad, travel, scene-transitions, camera-movement, fashion, cityscape, landmarks, short-form-video, long-form, structured-output, woman, fashion-shoot

Quiet Kyoto autumn travel vlog, 30 seconds
Generates a slow, natural 30-second autumn travel vlog in Kyoto of the woman from a reference image, with short casual dialogue, handheld camera and film grain, avoiding an ad look.
video-prompt, vlog, reference-image, character-consistency, handheld, film-grain, home-video, travel, japan, multi-shot, lip-sync, natural-light, guardrails, seedance, for-content-creators, timed-beats, long-form, casual, candid, autumn

Ice heroine fights hunters in Seoul parking garage
Plans a 30-second supernatural action film where an ice-powered heroine defends a puppy from hunters in a Seoul parking garage, with identity locked to two reference images.
video-prompt, kling, timed-beats, multi-shot, action, martial-arts, visual-effects, character-consistency, reference-image, korea, cityscape, night-scene, slow-motion, tracking-shot, cinematic, creatures, film-score, negative-prompt, dramatic-lighting, neon, advanced, lip-sync, woman
Loading reviews…
Loading comments…