Justfile Development
Workflows for authoring, reviewing, planning, and updating justfiles with the just command runner.
When to Use
- Creating a new justfile for a project
- Adding or modifying recipes
- Reviewing a justfile for quality issues
- Planning which recipes a project needs
- Upgrading a justfile as a project matures
- Converting a Makefile to a justfile
- Setting up monorepo module structure
Workflows
Author
When creating a new justfile or adding recipes.
New Justfile Scaffold:
set shell := ["bash", "-cu"]
default:
@just --list
# =============================================================================
# Development
# =============================================================================
# Build the project
[group('dev')]
build:
<build-command>
# =============================================================================
# Testing
# =============================================================================
# Run test suite
[group('test')]
test:
<test-command>
# =============================================================================
# Code Quality
# =============================================================================
# Format code
[group('lint')]
fmt:
<fmt-command>
# Run linter
[group('lint')]
lint:
<lint-command>
# =============================================================================
# Utilities
# =============================================================================
# Remove build artifacts
[group('util')]
[confirm('Remove all build artifacts?')]
clean:
<clean-command>
Recipe Writing Rules:
| Rule |
Example |
Always add [group('name')] |
[group('dev')] |
| Doc comment above every recipe |
# Build the project |
Private helpers start with _ |
_ensure-tool name: |
[confirm] on destructive ops |
[confirm('Delete all?')] |
| Prefer parameters over env vars |
recipe name='default': |
| Single responsibility |
Compose with dependencies |
No && chaining |
Use separate lines or deps |
No cd |
Use [working-directory] |
Adding Recipes to Existing Justfiles:
- Identify the correct group (see Standard Groups below)
- Place recipe near related recipes in the same section
- Add doc comment
- Add
[group] attribute
- If destructive, add
[confirm]
Review
Use this checklist when reviewing justfiles.
## Justfile Review
- [ ] `set shell` declared at top
- [ ] All recipes grouped with `[group('name')]`
- [ ] Every recipe has a doc comment
- [ ] No ungrouped recipes (except `default`)
- [ ] Private helpers prefixed with `_`
- [ ] Destructive recipes use `[confirm]`
- [ ] No `cd` usage (use `[working-directory]`)
- [ ] No `&&` chaining (use dependencies or separate lines)
- [ ] No secrets in justfile (env vars or `op://`)
- [ ] `default` recipe shows `just --list`
- [ ] Section separators between groups
- [ ] Recipe names are kebab-case
- [ ] No monolithic recipes (compose from focused ones)
- [ ] Parameters preferred over env vars for inputs
Common Issues:
| Issue |
Fix |
Missing set shell |
Add set shell := ["bash", "-cu"] at top |
| Ungrouped recipes |
Add [group('name')] attribute |
| Missing doc comments |
Add # Description above recipe |
cd in recipe body |
Use [working-directory('path')] |
&& chaining |
Split into separate lines or deps |
| Hardcoded secrets |
Replace with env('VAR') or op:// |
| God recipe doing everything |
Split into focused recipes, compose with deps |
Plan
Use when deciding what recipes a project needs.
3-Question Assessment:
| Question |
Yes |
No |
| Has CI? |
Add quality gates (coverage, check-all) |
Skip quality recipes |
| Deploys to prod? |
Add security + deploy recipes |
Skip deploy/security |
| Multiple languages? |
Add module structure |
Keep single justfile |
Recipe Sets by Project Type:
| Project Type |
Baseline |
Quality |
Deploy |
Modules |
| Rust CLI |
build, test, lint, fmt, clean |
coverage, bench, release |
docker |
— |
| Rust lib |
build, test, lint, fmt, docs |
coverage, bench |
release |
— |
| Web app |
build, test, lint, fmt, dev |
coverage |
docker, deploy |
if polyglot |
| Monorepo |
orchestrate, default |
per-package |
per-service |
yes |
| MCP server |
build, test, lint, fmt |
coverage |
docker, release |
— |
Decision: Single File vs Modules:
| Criteria |
Single justfile |
Modules |
| Recipe count |
< 20 |
> 20 |
| Languages |
1 |
2+ |
| Repo structure |
flat |
monorepo/workspace |
| Shared recipes |
none |
CDN imports needed |
Convert
When migrating from a Makefile to a justfile.
Steps:
- Map targets to recipes (all recipes are phony — no
.PHONY needed)
- Add
set shell := ["bash", "-cu"] at top
- Add
default recipe with @just --list
- Group recipes with
[group('name')] and add section separators
- Add doc comments above each recipe
- Fix anti-patterns (see translations below)
- Add
[confirm] to destructive recipes
- Validate:
just --list shows grouped, documented recipes
Makefile → just Translations:
| Makefile |
just |
.PHONY: target |
Not needed (all recipes are phony) |
target: dep1 dep2 |
recipe: dep1 dep2 (same syntax) |
cd dir && cmd |
[working-directory('dir')] attribute |
cmd1 && cmd2 |
Separate lines in recipe body |
$(VAR) |
{{VAR}} |
@echo "msg" |
@echo "msg" (same) |
export VAR=val |
export VAR := "val" at top |
include file.mk |
import "file.just" |
Update
When upgrading an existing justfile.
Maturity Progression:
| Level |
When |
Add |
| 0: Baseline |
Every project |
default, build, test, lint, fmt, clean |
| 1: Quality |
CI/CD added |
coverage, test-watch, check-all, bench |
| 2: Security |
Deploying |
audit, sbom, doctor |
| 3: Production |
Prod systems |
deploy, migrate, logs, status |
| 4: Polyglot |
Multi-language |
modules, orchestration |
YAGNI: Only add levels you currently need. Reassess when project scope changes.
Module Migration:
When a justfile exceeds ~20 recipes, consider splitting:
- Create
just/ directory
- Move related recipes to
just/<group>.just
- Add
import? "just/<group>.just" to root justfile
- Or use CDN:
mod name "https://just.arusty.dev/modules/<name>.just"
Quick Reference
Standard Groups
| Group |
Purpose |
Typical Recipes |
dev |
Development |
build, setup, install, watch, dev |
test |
Testing |
test, coverage, bench, test-watch |
lint |
Code quality |
fmt, lint, clippy, check |
docs |
Documentation |
docs-build, docs-serve |
docker |
Containers |
docker-build, docker-run, docker-push |
release |
Publishing |
release, version-bump, changelog |
util |
Maintenance |
clean, update, doctor |
Essential Syntax
| Feature |
Syntax |
| Settings |
set shell := ["bash", "-cu"] |
| Groups |
[group('dev')] |
| Confirm |
[confirm('message')] |
| Working dir |
[working-directory('path')] |
| Private |
_recipe-name: |
| Parameters |
recipe name: |
| Default params |
recipe name='value': |
| Variadic |
recipe *args: |
| Dependencies |
recipe: dep1 dep2 |
| Param deps |
recipe: (dep1 "arg") |
| Conditional |
if os() == "macos" { ... } |
| Shebang |
#!/usr/bin/env python3 |
| Script attr |
[script('python3')] |
| Optional import |
import? "just/mod.just" |
| CDN module |
mod name "https://url" |
Common Functions
| Function |
Returns |
os() |
"linux", "macos", "windows" |
arch() |
"x86_64", "aarch64" |
env('VAR') |
Environment variable value |
env('VAR', 'default') |
With fallback |
justfile_directory() |
Dir containing justfile |
invocation_directory() |
Dir where just was called |
aRustyDev Conventions
- Shell: always
set shell := ["bash", "-cu"]
- CDN modules from
just.arusty.dev
- Local modules in
just/ with import?
- Gist templates via
just apply-gist (see gist-templates rule)
- KuzuDB recipes follow
graph-data-pattern rule
Language Patterns
Quick lookup — see references/recipe-patterns.md for full details.
| Recipe |
Rust |
Go |
TypeScript |
Python |
fmt |
cargo fmt |
gofmt -w . |
prettier --write . |
ruff format . |
lint |
cargo clippy |
golangci-lint run |
eslint . |
ruff check . |
test |
cargo test |
go test ./... |
vitest |
pytest |
build |
cargo build |
go build ./... |
tsc |
python -m build |
coverage |
cargo tarpaulin |
go test -cover |
vitest --coverage |
pytest --cov |
See Also
references/syntax-quick-ref.md — full syntax reference
references/recipe-patterns.md — recipe patterns by category and language
references/module-system.md — module system deep dive
references/maturity-model.md — maturity assessment details
examples/rust-project.just — complete Rust CLI/lib justfile
examples/monorepo-root.just — monorepo router pattern
examples/arustydev.just — aRustyDev conventions with gist templates
tables/standard-groups.md — group definitions and ordering
tables/language-recipes.md — Rust/Go/TS/Python recipe matrix
1---2name: justfile-dev3description: Justfile authoring, reviewing, and planning for the just command runner. Use when creating new justfiles, adding recipes, reviewing existing justfiles for quality, planning recipe sets for new projects, or upgrading justfiles as projects mature. Covers syntax patterns, module system, recipe groups, language-specific templates, and maturity assessment.4---56# Justfile Development78Workflows for authoring, reviewing, planning, and updating justfiles with the `just` command runner.910## When to Use1112- Creating a new justfile for a project13- Adding or modifying recipes14- Reviewing a justfile for quality issues15- Planning which recipes a project needs16- Upgrading a justfile as a project matures17- Converting a Makefile to a justfile18- Setting up monorepo module structure1920## Workflows2122### Author2324When creating a new justfile or adding recipes.2526**New Justfile Scaffold:**2728```just29set shell := ["bash", "-cu"]3031default:32 @just --list3334# =============================================================================35# Development36# =============================================================================3738# Build the project39[group('dev')]40build:41 <build-command>4243# =============================================================================44# Testing45# =============================================================================4647# Run test suite48[group('test')]49test:50 <test-command>5152# =============================================================================53# Code Quality54# =============================================================================5556# Format code57[group('lint')]58fmt:59 <fmt-command>6061# Run linter62[group('lint')]63lint:64 <lint-command>6566# =============================================================================67# Utilities68# =============================================================================6970# Remove build artifacts71[group('util')]72[confirm('Remove all build artifacts?')]73clean:74 <clean-command>75```7677**Recipe Writing Rules:**7879| Rule | Example |80|------|---------|81| Always add `[group('name')]` | `[group('dev')]` |82| Doc comment above every recipe | `# Build the project` |83| Private helpers start with `_` | `_ensure-tool name:` |84| `[confirm]` on destructive ops | `[confirm('Delete all?')]` |85| Prefer parameters over env vars | `recipe name='default':` |86| Single responsibility | Compose with dependencies |87| No `&&` chaining | Use separate lines or deps |88| No `cd` | Use `[working-directory]` |8990**Adding Recipes to Existing Justfiles:**91921. Identify the correct group (see Standard Groups below)932. Place recipe near related recipes in the same section943. Add doc comment954. Add `[group]` attribute965. If destructive, add `[confirm]`9798### Review99100Use this checklist when reviewing justfiles.101102```markdown103## Justfile Review104105- [ ] `set shell` declared at top106- [ ] All recipes grouped with `[group('name')]`107- [ ] Every recipe has a doc comment108- [ ] No ungrouped recipes (except `default`)109- [ ] Private helpers prefixed with `_`110- [ ] Destructive recipes use `[confirm]`111- [ ] No `cd` usage (use `[working-directory]`)112- [ ] No `&&` chaining (use dependencies or separate lines)113- [ ] No secrets in justfile (env vars or `op://`)114- [ ] `default` recipe shows `just --list`115- [ ] Section separators between groups116- [ ] Recipe names are kebab-case117- [ ] No monolithic recipes (compose from focused ones)118- [ ] Parameters preferred over env vars for inputs119```120121**Common Issues:**122123| Issue | Fix |124|-------|-----|125| Missing `set shell` | Add `set shell := ["bash", "-cu"]` at top |126| Ungrouped recipes | Add `[group('name')]` attribute |127| Missing doc comments | Add `# Description` above recipe |128| `cd` in recipe body | Use `[working-directory('path')]` |129| `&&` chaining | Split into separate lines or deps |130| Hardcoded secrets | Replace with `env('VAR')` or `op://` |131| God recipe doing everything | Split into focused recipes, compose with deps |132133### Plan134135Use when deciding what recipes a project needs.136137**3-Question Assessment:**138139| Question | Yes | No |140|----------|-----|----|141| Has CI? | Add quality gates (coverage, check-all) | Skip quality recipes |142| Deploys to prod? | Add security + deploy recipes | Skip deploy/security |143| Multiple languages? | Add module structure | Keep single justfile |144145**Recipe Sets by Project Type:**146147| Project Type | Baseline | Quality | Deploy | Modules |148|-------------|----------|---------|--------|---------|149| Rust CLI | build, test, lint, fmt, clean | coverage, bench, release | docker | — |150| Rust lib | build, test, lint, fmt, docs | coverage, bench | release | — |151| Web app | build, test, lint, fmt, dev | coverage | docker, deploy | if polyglot |152| Monorepo | orchestrate, default | per-package | per-service | yes |153| MCP server | build, test, lint, fmt | coverage | docker, release | — |154155**Decision: Single File vs Modules:**156157| Criteria | Single `justfile` | Modules |158|----------|-------------------|---------|159| Recipe count | < 20 | > 20 |160| Languages | 1 | 2+ |161| Repo structure | flat | monorepo/workspace |162| Shared recipes | none | CDN imports needed |163164### Convert165166When migrating from a Makefile to a justfile.167168**Steps:**1691701. Map targets to recipes (all recipes are phony — no `.PHONY` needed)1712. Add `set shell := ["bash", "-cu"]` at top1723. Add `default` recipe with `@just --list`1734. Group recipes with `[group('name')]` and add section separators1745. Add doc comments above each recipe1756. Fix anti-patterns (see translations below)1767. Add `[confirm]` to destructive recipes1778. Validate: `just --list` shows grouped, documented recipes178179**Makefile → just Translations:**180181| Makefile | just |182|----------|------|183| `.PHONY: target` | Not needed (all recipes are phony) |184| `target: dep1 dep2` | `recipe: dep1 dep2` (same syntax) |185| `cd dir && cmd` | `[working-directory('dir')]` attribute |186| `cmd1 && cmd2` | Separate lines in recipe body |187| `$(VAR)` | `{{VAR}}` |188| `@echo "msg"` | `@echo "msg"` (same) |189| `export VAR=val` | `export VAR := "val"` at top |190| `include file.mk` | `import "file.just"` |191192### Update193194When upgrading an existing justfile.195196**Maturity Progression:**197198| Level | When | Add |199|-------|------|-----|200| 0: Baseline | Every project | default, build, test, lint, fmt, clean |201| 1: Quality | CI/CD added | coverage, test-watch, check-all, bench |202| 2: Security | Deploying | audit, sbom, doctor |203| 3: Production | Prod systems | deploy, migrate, logs, status |204| 4: Polyglot | Multi-language | modules, orchestration |205206**YAGNI**: Only add levels you currently need. Reassess when project scope changes.207208**Module Migration:**209210When a justfile exceeds ~20 recipes, consider splitting:2112121. Create `just/` directory2132. Move related recipes to `just/<group>.just`2143. Add `import? "just/<group>.just"` to root justfile2154. Or use CDN: `mod name "https://just.arusty.dev/modules/<name>.just"`216217## Quick Reference218219### Standard Groups220221| Group | Purpose | Typical Recipes |222|-------|---------|-----------------|223| `dev` | Development | build, setup, install, watch, dev |224| `test` | Testing | test, coverage, bench, test-watch |225| `lint` | Code quality | fmt, lint, clippy, check |226| `docs` | Documentation | docs-build, docs-serve |227| `docker` | Containers | docker-build, docker-run, docker-push |228| `release` | Publishing | release, version-bump, changelog |229| `util` | Maintenance | clean, update, doctor |230231### Essential Syntax232233| Feature | Syntax |234|---------|--------|235| Settings | `set shell := ["bash", "-cu"]` |236| Groups | `[group('dev')]` |237| Confirm | `[confirm('message')]` |238| Working dir | `[working-directory('path')]` |239| Private | `_recipe-name:` |240| Parameters | `recipe name:` |241| Default params | `recipe name='value':` |242| Variadic | `recipe *args:` |243| Dependencies | `recipe: dep1 dep2` |244| Param deps | `recipe: (dep1 "arg")` |245| Conditional | `if os() == "macos" { ... }` |246| Shebang | `#!/usr/bin/env python3` |247| Script attr | `[script('python3')]` |248| Optional import | `import? "just/mod.just"` |249| CDN module | `mod name "https://url"` |250251### Common Functions252253| Function | Returns |254|----------|---------|255| `os()` | `"linux"`, `"macos"`, `"windows"` |256| `arch()` | `"x86_64"`, `"aarch64"` |257| `env('VAR')` | Environment variable value |258| `env('VAR', 'default')` | With fallback |259| `justfile_directory()` | Dir containing justfile |260| `invocation_directory()` | Dir where `just` was called |261262## aRustyDev Conventions263264- Shell: always `set shell := ["bash", "-cu"]`265- CDN modules from `just.arusty.dev`266- Local modules in `just/` with `import?`267- Gist templates via `just apply-gist` (see `gist-templates` rule)268- KuzuDB recipes follow `graph-data-pattern` rule269270## Language Patterns271272Quick lookup — see `references/recipe-patterns.md` for full details.273274| Recipe | Rust | Go | TypeScript | Python |275|--------|------|----|------------|--------|276| `fmt` | `cargo fmt` | `gofmt -w .` | `prettier --write .` | `ruff format .` |277| `lint` | `cargo clippy` | `golangci-lint run` | `eslint .` | `ruff check .` |278| `test` | `cargo test` | `go test ./...` | `vitest` | `pytest` |279| `build` | `cargo build` | `go build ./...` | `tsc` | `python -m build` |280| `coverage` | `cargo tarpaulin` | `go test -cover` | `vitest --coverage` | `pytest --cov` |281282## See Also283284- `references/syntax-quick-ref.md` — full syntax reference285- `references/recipe-patterns.md` — recipe patterns by category and language286- `references/module-system.md` — module system deep dive287- `references/maturity-model.md` — maturity assessment details288- `examples/rust-project.just` — complete Rust CLI/lib justfile289- `examples/monorepo-root.just` — monorepo router pattern290- `examples/arustydev.just` — aRustyDev conventions with gist templates291- `tables/standard-groups.md` — group definitions and ordering292- `tables/language-recipes.md` — Rust/Go/TS/Python recipe matrix