Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Teaches functional Clojure patterns for data-first domain modeling, REPL-driven development, and spec validation.
Use this skill ↓65% 83%+17 ptsof test cases passed
Passed 19 of 23 test cases with the skill, and 15 of 23 without it.
3 of 3 safety checks passed
Not used yet
Cross-references: fp-principles | fp-domain-modeling
# Install Clojure CLI
brew install clojure/tools/clojure # macOS
# Create project
mkdir -p order-service/src/order_service order-service/test/order_service
# Run REPL: clj | Run tests: clj -X:test
Namespace caveat: Clojure namespaces use - but filenames use _ (JVM requirement). order-service.core lives in order_service/core.clj.
Clojure is dynamically typed. Domain modeling uses maps with qualified keywords, validated at runtime.
(require '[clojure.spec.alpha :as s])
;; Domain wrappers as specs
(s/def ::order-id pos-int?)
(s/def ::email (s/and string? #(clojure.string/includes? % "@")))
(s/def ::customer-name (s/and string? #(> (count %) 0)))
;; Record types as spec'd maps
(s/def ::customer (s/keys :req [::customer-name ::email] :opt [::phone]))
;; Choice types as spec alternatives
(s/def ::payment-method
(s/or :credit-card (s/keys :req [::card-number ::expiry-date])
:bank-transfer (s/keys :req [::account-number])
Next to this one in the catalogue, plus more from the same author.