justfile
This skill should be used every time you work on justfile projects or just command changes in this repository.
SKILL.mdskills/software-engineering/justfile/SKILL.md
GitHubJustfile Structure
Architecture Overview
Use a modular justfile architecture with separate recipe files organized by category in a justfiles/ directory.
Directory Structure
justfiles/directory at project root - All recipe files live here- Category subdirectories - Group by purpose:
development/,building/,verification/,testing/,utilities/ - One command per file - Each recipe gets its own
.justfile (e.g.,justfiles/development/web.just) - Main
justfileat root - Imports all recipe files, contains help command
Main Justfile Structure
- Default command shows help - Not
--list, a themed help menu - Imports organized by category with section comment headers
# Default: Show help menu
default:
@just help
# ============================================================================
# Help Command
# ============================================================================
help:
@echo ""
@echo "\033[1;36m========== Project Commands ==========\033[0m"
# ... help content ...
# ============================================================================
# Development Commands
# ============================================================================
import 'justfiles/development/web.just'
import 'justfiles/development/desktop.just'
# ============================================================================
# Building Commands
# ============================================================================
import 'justfiles/building/build-server.just'
Example Directory Structure
project/
├── justfile # Main justfile with imports
└── justfiles/
├── development/
│ ├── web.just
│ ├── desktop.just
│ └── dev.just
├── building/
│ ├── build-server.just
│ ├── build-desktop.just
│ └── build-web.just
├── verification/
│ ├── check-server.just
│ ├── check-desktop.just
│ └── check-web.just
├── testing/
│ ├── test.just
│ ├── test-unit.just
│ ├── test-integration.just
│ ├── test-e2e.just
│ └── test-all.just
└── utilities/
├── clean.just
└── install-tools.just
Benefits
- Discoverability - Easy to find and edit specific commands
- Organization - Logical grouping by purpose
- Consistency - Uniform patterns across all commands
- Maintainability - Add new commands by creating new files
- Team-friendly - Clear structure for collaboration
Justfile Naming Conventions
Command Naming
- Commands use kebab-case -
build-server,test-e2e,install-tools - File name matches command name -
build-servercommand lives inbuild-server.just
Parameter Naming
- Parameters use SCREAMING_CASE -
PARAM,OPTIONAL,TARGET
Variadic Parameters and Quoting
- Variadic parameters (
*ARGS) don't preserve quotes - When using*ARGSto accept multiple words, the quotes from the shell are stripped - Wrap variadic parameters in quotes - Use
"{{ARGS}}"to pass multi-word arguments correctly to subcommands
# BAD: Quotes are not preserved, "foo bar" becomes two arguments
search *QUERY:
my-tool {{QUERY}}
# `just search foo bar` runs: my-tool foo bar (2 args)
# GOOD: Wrap in quotes to preserve as single argument
search *QUERY:
my-tool "{{QUERY}}"
# `just search foo bar` runs: my-tool "foo bar" (1 arg)
Examples
# Command: build-server
# File: justfiles/building/build-server.just
build-server TARGET="release":
cargo build --release --bin {{TARGET}}
# Command: test-e2e
# File: justfiles/testing/test-e2e.just
test-e2e HEADLESS="true":
playwright test --headed={{HEADLESS}}
# Command: search (with variadic parameter)
# File: justfiles/utilities/search.just
search *QUERY:
cargo run --bin search -- "{{QUERY}}"
Justfile Help Command Design
Help Command Design
- Help command uses themed sections with emojis and colors
- Default command shows help - Users see help when running
justwith no arguments
Color Codes
\033[1;36m- Cyan for section headers/boxes\033[0;33m- Yellow for command names\033[0;32m- Green for descriptions\033[1;35m- Magenta for category labels\033[0m- Reset to default
Section Emojis
- Most Common Commands
- Building
- Verification
- Testing
- Utilities
- Installation
Help Format Template
help:
@echo ""
@echo "\033[1;36m======================================\033[0m"
@echo "\033[1;36m Project Commands \033[0m"
@echo "\033[1;36m======================================\033[0m"
@echo ""
@echo "\033[1;35m Most Common Commands:\033[0m"
@echo " just \033[0;33mweb\033[0m \033[0;32mStart web dev server\033[0m"
@echo " just \033[0;33mdesktop\033[0m \033[0;32mStart desktop app\033[0m"
@echo " just \033[0;33mtest\033[0m \033[0;32mRun all tests\033[0m"
@echo ""
@echo "\033[1;35m Building:\033[0m"
@echo " just \033[0;33mbuild-server\033[0m \033[0;32mBuild production server\033[0m"
@echo ""
Justfile Templates
Recipe File Template
- Every recipe file has header comments - Brief description, Usage, Example
# Brief description of what this command does
# Usage: just command-name <required> [optional]
# Example: just command-name example-value
command-name PARAM OPTIONAL="default":
command {{PARAM}} {{OPTIONAL}}
Bash Script Template
- Use proper shebangs -
#!/usr/bin/env bash - Enable strict mode -
set -euo pipefail
# Description
# Usage: just command-name <param>
command-name PARAM:
#!/usr/bin/env bash
set -euo pipefail
# Script content here
echo "Processing {{PARAM}}"
Command Patterns
- User-friendly messages - Use emojis for feedback
- Calling other recipes - Use
@just command-name
# Good: User feedback with emojis
build-server:
@echo "Building server..."
cargo build --release
@echo "Build complete!"
# Good: Calling other recipes
test-all:
@just test
@just test-e2e
Justfile Command Categories
Standard Categories
Development (hot-reload servers)
web- Web dev serverdesktop- Desktop appdev- Both via mprocs
Building (release builds)
build-server- Production serverbuild-desktop- Desktop bundlebuild-web- WASM bundle
Verification (compile checks)
check-server- Server compilationcheck-desktop- Desktop compilationcheck-web- WASM compilation
Testing
test- All Rust teststest-unit- Unit tests onlytest-integration- Integration teststest-e2e- E2E tests (headless)test-e2e-ui- E2E tests (interactive)test-all- All tests combined
Utilities
clean- Clean build artifactsinstall-tools- Install dev tools
Category Guidelines
Place commands in the appropriate category based on their primary purpose:
- Hot-reload development →
development/ - Release/production builds →
building/ - Compilation checks (no artifacts) →
verification/ - Any kind of testing →
testing/ - Project maintenance →
utilities/