clojure-rules

A style guide for writing clear, idiomatic Clojure code. Clojure is a programming language that emphasizes simple functions, unchanging data, and functional programming.

In plain words
What is it for?
Use it when writing, reviewing, or restructuring Clojure code.
Why use it?
It helps developers make consistent code choices and avoid practices that make Clojure programs harder to maintain.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/theronic/clojure-prompts/clojure-rules
Clone the repo
git clone --depth 1 https://github.com/theronic/clojure-prompts
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 18,796 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.18796
Opus 5 $0.00000 $0.09398
Sonnet 5 $0.00000 $0.03759
Haiku 4.5 $0.00000 $0.01880

Measured 2d ago against content hash a1bfaa024548, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

clojure-rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

clojure-rules.mdc · 1,916 lines

How it starts

The opening of the file, as written. The whole thing — 1,916 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Idiomatic Clojure: A Comprehensive Style Guide

Introduction

This guide distills wisdom from foundational Clojure resources, including "The Joy of Clojure" by Michael Fogus and Chris Houser and "Elements of Clojure" by Zachary Tellman. It provides comprehensive guidelines for writing idiomatic, maintainable, and effective Clojure code.

Clojure's design emphasizes simplicity, immutability, and functional programming, enabling powerful abstractions that separate "what" from "how" and allowing developers to manage complexity through effective indirection. This guide will help you harness these strengths to produce robust, elegant Clojure code.

1. Clojure Philosophy and Fundamentals

1.1 Core Principles

Simplicity

Clojure embodies simplicity through its design and encourages developers to create simple, composable solutions.

  • Simplicity over complexity: Clojure follows Rich Hickey's definition of simplicity as the opposite of complexity, not the opposite of easy. Simple means "one fold" or "one braid" - a unit that cannot be broken down further.
  • Build simple abstractions: Create focused functions that do one thing well rather than monolithic functions that serve multiple purposes.
  • Compose simple parts: Solve complex problems by combining simple, well-understood components.
  • Avoid incidental complexity: Don't introduce complexity that isn't inherent to the problem domain.
;; Simple, focused function
(defn celsius->fahrenheit [c]
  (+ (* c (/ 9 5)) 32))

;; Complex, less focused function with side effects
(defn process-temperature [c]
  (println "Processing temperature...")
  (let [f (+ (* c (/ 9 5)) 32)]
    (println "Result:" f)
    (swap! temperature-log conj {:input c :output f :timestamp (java.util.Date.)})
    f))
Immutability

Immutability is a cornerstone of Clojure's design philosophy, enabling safer code and simplifying reasoning about program behavior.

  • Data is immutable by default: Clojure collections cannot be changed after creation.
  • Transformations create new data: Functions like assoc, conj, and update return new collections rather than modifying existing ones.
  • Structural sharing preserves efficiency: Clojure's persistent data structures efficiently reuse parts of existing collections when creating new ones.
  • Immutability enables reasoning: It's easier to understand code when you know data cannot change unexpectedly.
  • Immutability supports concurrency: Immutable data eliminates a whole class of concurrency bugs related to shared mutable state.

Read the full file on GitHub · 1,916 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 1,916 lines · 0 tokens per session scan A a1bfaa024548

Subscribe to this mod's changes

clojure-rules is a cursor rule published in the GitHub repository theronic/clojure-prompts (37 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 18,796 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.