Home › Clojure › Clojure project CLAUDE.md

Clojure project CLAUDE.md

CLAUDE.md for Clojure projects: deps.edn or Leiningen commands, REPL-friendly namespaces, pure functions and data, malli/spec at boundaries, clj-kondo, and tests.

Claude Code (CLAUDE.md)Clojure

How to use

Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

CLAUDE.mdDownload  
# CLAUDE.md: Clojure

## Commands
- Detect the build tool: `deps.edn` → Clojure CLI (`clojure -M:test`, `clojure -T:build`), `project.clj` → Leiningen (`lein test`, `lein uberjar`). Use the aliases already defined; don't add a second tool.
- Lint: `clj-kondo --lint src test` · Format: `cljfmt check` (or `cljfmt fix` on changed files) if configured.
- Run focused tests by namespace (`clojure -M:test -n my.app.core-test` with Kaocha/Cognitect runner as configured).

## Code
- Namespaces mirror paths (`src/my/app/orders.clj` → `my.app.orders`, dashes in names, underscores in file paths). Keep `:require` sorted with explicit `:as` aliases; no `:use` or `:refer :all`.
- Prefer pure functions on plain maps and vectors. Push side effects (DB, HTTP, time, randomness) to the edges and pass dependencies in, so functions are testable from the REPL.
- Use namespaced keywords for domain data (`:order/id`). Validate data at system boundaries with the project's choice (malli or clojure.spec), not throughout the core.
- State: no global `def` atoms for app state. Use the project's lifecycle library (Integrant, Component, mount) and keep reloadable namespaces free of side effects at load time.
- Errors: throw `ex-info` with a message and a data map (`{:type ::not-found :id id}`); catch at the boundary and translate to responses.
- Threading macros (`->`, `->>`, `some->`, `cond->`) for pipelines; keep functions short; avoid deep nesting of `let` and `if`.
- Laziness: realize sequences that touch resources inside the `with-open` (`doall`, `into`, `run!`). Never return a lazy seq over a closed resource.
- Java interop with type hints where reflection warnings appear (`(set! *warn-on-reflection* true)` in hot namespaces).
- ClojureScript (if present): shadow-cljs builds via `npx shadow-cljs compile <build>`; keep `.cljc` for shared code with reader conditionals.

## Done when
clj-kondo shows no new warnings and the relevant tests pass. Say if you evaluated code in a REPL versus ran the test suite.

More: all Clojure rules · all Claude Code (CLAUDE.md) rules

Related rules

Bun runtime CLAUDE.md

CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.

Claude Code (CLAUDE.md)Bun

Django CLAUDE.md

CLAUDE.md for Django 5 projects with DRF, pytest-django and PostgreSQL.

Claude Code (CLAUDE.md)Django

Django models & migrations .claude/rules file

A path-scoped Claude Code rules file for Django models, migrations, and ORM queries, loaded only for those files.

Claude Code (CLAUDE.md)Django

Elixir Phoenix CLAUDE.md

CLAUDE.md for Phoenix 1.8 + LiveView 1.x apps in Elixir: contexts, Ecto changesets, and ExUnit tests.

Claude Code (CLAUDE.md)Elixir / Phoenix

Laravel Filament admin panel CLAUDE.md

CLAUDE.md for Laravel apps with Filament admin panels: resources, forms and tables, policies for authorization, relation managers, actions, and Pest tests.

Claude Code (CLAUDE.md)Laravel

Go backend CLAUDE.md

CLAUDE.md for idiomatic Go HTTP services using the standard library, sqlc and table-driven tests.

Claude Code (CLAUDE.md)Go

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.