swe-programming-clojure
Clojure coding standards from authoritative docs/explanation/software-engineering/programming-languages/clojure/ documentation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Clojure coding standards from authoritative docs/explanation/software-engineering/programming-languages/clojure/ documentation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
AI agent development standards including frontmatter structure, naming conventions, tool access patterns, model selection, and reference documentation structure
Comprehensive project planning standards for plans/ directory including folder structure (ideas/, backlog/, in-progress/, done/), stage-aware naming convention (done uses YYYY-MM-DD__identifier/; backlog and in-progress use identifier/ with no date prefix), five-document file organization (README.md, brd.md, prd.md, tech-docs.md, delivery.md for multi-file default; single README.md for trivially-small single-file exception), BRD/PRD content-placement rules, Gherkin acceptance criteria, and the mandatory structured multiple-choice grilling gates (pre-write and post-write) for resolving design decisions with the user. Essential for creating structured, executable project plans.
Trunk Based Development workflow - all development on main branch with small frequent commits, minimal branching, and continuous integration. Covers when branches are justified (exceptional cases only), commit patterns, feature flag usage for incomplete work, environment branch rules (deployment only), and AI agent default behavior (the repo-wide default delivery mode is `worktree-to-pr` -- a short-lived plan branch in a disposable worktree pushed to a draft PR; direct push to main remains available as an explicit selection). Essential for understanding repository git workflow and keeping branches short-lived
Workflow pattern standards for creating multi-agent orchestrations including YAML frontmatter (name, description, tags, status, agents, parameters), execution phases (sequential/parallel/conditional), agent coordination patterns, and Gherkin success criteria. Essential for defining reusable, validated workflow processes.
Common software development workflow patterns shared across all language developer agents
Three-stage content quality workflow pattern (Maker creates, Checker validates, Fixer remediates) with detailed execution workflows. Use when working with content quality workflows, validation processes, audit reports, or implementing maker/checker/fixer agent roles.
| name | swe-programming-clojure |
| description | Clojure coding standards from authoritative docs/explanation/software-engineering/programming-languages/clojure/ documentation |
Progressive disclosure of Clojure coding standards for agents writing Clojure code.
Usage: Auto-loaded for agents when writing Clojure code. Provides quick reference to idioms, best practices, and antipatterns.
Authoritative Source: docs/explanation/software-engineering/programming-languages/clojure/README.md
IMPORTANT: This skill provides demo-specific style guides, not educational tutorials.
Complete the demo Clojure learning path first:
Functions/Variables: kebab-case - calculate-zakat, total-amount, validate-contract
Predicates: end with ? - valid-nisab?, above-threshold?
Side-effecting functions: end with ! - save-transaction!, send-notification!
Namespaces: reverse-domain + feature - com.demo.zakat.calculator
Namespace aliases: standard abbreviations - (require [clojure.string :as str])
;; CORRECT: Pure function for Zakat calculation
(defn calculate-zakat
"Calculate Zakat amount. Returns 2.5% if wealth >= nisab, else 0."
[wealth nisab]
(if (>= wealth nisab)
(* wealth 0.025M)
0M))
;; CORRECT: Threading macro for readability
(defn process-contracts [contracts nisab]
(->> contracts
(filter #(>= (:wealth %) nisab))
(map #(assoc % :zakat-amount (calculate-zakat (:wealth %) nisab)))
(remove nil?)))
;; CORRECT: Destructuring in function args
(defn format-payment [{:keys [amount currency date]}]
(str amount " " currency " on " date))
;; CORRECT: Namespaced keywords for domain concepts
{:zakat/wealth 10000M
:zakat/nisab 5000M
:zakat/amount 250M
:contract/id "murabaha-001"
:contract/type :murabaha
:contract/status :active}
;; WRONG: Unnamespaced keywords for domain data
{:wealth 10000M ; ambiguous in a larger system
:id "001"}
;; CORRECT: ex-info for structured errors
(defn validate-wealth [wealth]
(when (neg? wealth)
(throw (ex-info "Invalid wealth amount"
{:type :validation-error
:field :wealth
:value wealth
:message "Wealth cannot be negative"}))))
;; CORRECT: Catch specific ex-info
(try
(validate-wealth -100M)
(catch clojure.lang.ExceptionInfo e
(let [data (ex-data e)]
(log/error "Validation failed" data))))
;; CORRECT: Atom for uncoordinated state
(def zakat-cache (atom {}))
;; CORRECT: swap! for atomic update (pure function)
(defn cache-calculation! [wealth result]
(swap! zakat-cache assoc wealth result))
;; CORRECT: Refs for coordinated STM
(def total-zakat (ref 0M))
(def transaction-log (ref []))
(defn record-zakat! [amount]
(dosync
(alter total-zakat + amount)
(alter transaction-log conj {:amount amount :time (java.time.Instant/now)})))
;; CORRECT: Transducer pipeline (lazy, composable)
(def eligible-contracts-xf
(comp
(filter #(>= (:wealth %) nisab-threshold))
(map #(assoc % :zakat (* (:wealth %) 0.025M)))
(take 100)))
;; Apply to any collection
(into [] eligible-contracts-xf all-contracts)
(transduce eligible-contracts-xf + all-contracts)
;; CORRECT: clojure.test with descriptive names
(ns com.demo.zakat.calculator-test
(:require [clojure.test :refer [deftest testing is are]]
[com.demo.zakat.calculator :refer [calculate-zakat]]))
(deftest calculate-zakat-test
(testing "wealth above nisab"
(is (= 250M (calculate-zakat 10000M 5000M))))
(testing "wealth below nisab"
(is (= 0M (calculate-zakat 1000M 5000M))))
(testing "wealth equal to nisab"
(is (= 125M (calculate-zakat 5000M 5000M)))))
Authoritative Index: docs/explanation/software-engineering/programming-languages/clojure/README.md