Clojure CLI and deps.edn — use when adding a dependency, library, or alias, choosing -M/-X/-T exec modes, inspecting the classpath or dependency tree, or building a jar or uberjar with tools.build.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Clojure Deps?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/just-sultanov-clojure-deps)
---
name: clojure-deps
description: Clojure CLI and deps.edn — use when adding a dependency, library, or alias, choosing -M/-X/-T exec modes, inspecting the classpath or dependency tree, or building a jar or uberjar with tools.build.
license: EPL-1.0
---
# Clojure Deps
Owns `deps.edn`, the Clojure CLI, `tools.deps`, and `tools.build`: coordinates,
aliases, exec modes, tool invocation, classpath inspection, and artifact
builds. Version gates and JDK upgrades live in `clojure-versions`; tool
installation and format/lint configuration live in `clojure-tooling`; a running
REPL and `add-lib` live in `clojure-repl`. The text is adapted from the Clojure
site, `tools.deps`, and `tools.build` under EPL 1.0; see [NOTICE.md](NOTICE.md).
## Ground rules
- **The CLI owns the classpath.** Declare paths and coordinates; let `clj`
resolve, download, and cache. Never hand-assemble a classpath for a build,
and never commit `.cpcache/`.
- **An alias is data with one purpose.** One alias per task, one exec mode per
invocation. Do not hide a `-main` in an alias you also call with `-X`.
- **The project is the source of truth.** Read its `deps.edn`, build script,
and CI before changing anything; match its CLI version and alias names.
## Workflow
### 1. Read the dependency environment
Read the project `deps.edn`, the user `deps.edn` when it affects the run,
`build.clj`, and every CI job that runs `clj`. List the paths, direct deps,
aliases, exec modes, and the entry point of each alias. Note the CLI version
from `clj --version`.
Done when you can state, for each command the project runs, its alias, exec
mode, entry point, and resolved lib list.
### 2. Add or change a coordinate
Choose the procurer from the source of the lib: `:mvn/version` for a published
artifact, `:git/tag` plus `:git/sha` (or a full `:git/sha`) for source, and
`:local/root` for a sibling directory or jar. Add it to `:deps` for the project
or to an alias's `:extra-deps` for an optional use, then inspect:
```bash
clj -Stree # every selected version
clj -X:deps tree :aliases '[:test]' # tree with an alias applied
```
The coordinate types and their settings are in
[deps-edn.md](references/deps-edn.md).
Done when `-Stree` shows the intended version with no unexplained duplicate,
and the lib appears in `clj -Spath`.
### 3. Add or change an alias
Pick the exec mode first, then the keys that mode reads: `:extra-deps`,
`:extra-paths`, `:jvm-opts`, and `:main-opts` for `-M`; `:exec-fn`,
`:exec-args`, and `:ns-default` for `-X`; a self-contained `:deps` plus
`:ns-default` for a `-T` build. Read [cli.md](references/cli.md) for the exec
modes and [deps-edn.md](references/deps-edn.md) for the merge rules.
Done when the alias runs the intended entry point from the project root after
`rm -rf .cpcache`, and a second alias applied with it does not silently change
the entry point.
### 4. Inspect the classpath and resolution
Use `-Spath` for the final classpath, `-Stree` for selection, `-X:deps list`
for libs and licenses, `-X:deps find-versions` for available versions,
`-Sverbose` for the config and cache directories, and `-Strace` when the tree
does not explain a choice. Read
[troubleshooting.md](references/troubleshooting.md) when a version, path, or
repository is not what you expect.
Done when you can point to the classpath entry or the tree edge that supplies
each namespace the program requires.
### 5. Build artifacts
Write or extend `build.clj` with `clean`, `jar`, and, for an application,
`uber`. Keep the version in one place: a var, `git-count-revs`, or the CI tag.
Assemble the class dir with `copy-dir`, write `pom.xml` with `write-pom`, and
package with `jar` or `uber`. Read [build.md](references/build.md) for the
recipes.
Done when `clj -T:build jar` (and `uber`) builds from a clean checkout, the jar
carries `pom.xml` and sources, and `java -jar` starts the application jar.
### 6. Wire CI
Run the same commands with a pinned CLI version: prepare deps with
`clj -P -M:test`, run tests, then build. Cache `~/.m2/repository` and
`~/.gitlibs`, upload the jar or uberjar, and never run a `fix` or an
interactive command. Read [cli.md](references/cli.md) for the option order.
Done when a clean CI run produces the same artifact as the local command, and
the log shows the pinned CLI version.
## Checklist
- [ ] Every coordinate has exactly one procurer and a version or sha.
- [ ] Every git coordinate names a tag plus sha or a full sha.
- [ ] Every alias has one purpose and one exec mode.
- [ ] `clj -Stree` shows the intended versions with no unexplained duplicate.
- [ ] `clj -Spath` includes every path and lib the program requires.
- [ ] The project runs after `rm -rf .cpcache`.
- [ ] `build.clj` has `clean` and `jar`; an application also has `uber`.
- [ ] The jar carries `pom.xml`; the uberjar starts with `java -jar`.
- [ ] `.cpcache/`, `target/`, and `classes/` are ignored.
- [ ] CI pins the CLI version and runs the same commands as local.
## Related skills
- `clojure-versions` — which release first has a form or API, the
`invoke-tool` 1.12 gate, the JDK baseline, and the upgrade procedure.
- `clojure-testing` — the `:test` alias recipes and runner choice; this
skill owns the alias mechanics, the classpath, and the CI sequence.
- `clojure-tooling` — installing and pinning cljfmt, clj-kondo, and
clojure-lsp, and the alias recipes that run them.
- `clojure-repl` — starting or connecting a REPL, reloading namespaces, and
`add-lib`/`add-libs`/`sync-deps`.
- `clojure-style` — naming and layout for the Clojure code the build program
contains.
## References
| File | Read when |
| --------------------------------------------------- | ------------------------------------------------------------- |
| [deps-edn.md](references/deps-edn.md) | choosing a coordinate, alias key, or procurer setting |
| [cli.md](references/cli.md) | choosing an exec mode or CLI option, reading classpath config |
| [tools.md](references/tools.md) | installing a tool, invoking one from Clojure, `-T` rules |
| [build.md](references/build.md) | writing `build.clj`, packaging, or computing a version |
| [troubleshooting.md](references/troubleshooting.md) | a version, path, repository, or cache is not as expected |