cli-just by paulrberg/agent-skills
npx skills add https://github.com/paulrberg/agent-skills --skill cli-justJust 是一款受 make 语法启发的命令运行器,本技能提供专家级指导。可用于创建 justfile 文件、编写配方、配置设置以及实现任务自动化工作流。
核心功能:
set allow-duplicate-recipes # 允许配方覆盖导入的配方
set allow-duplicate-variables # 允许变量覆盖导入的变量
set shell := ["bash", "-euo", "pipefail", "-c"] # 启用严格错误处理的 bash
set unstable # 启用不稳定功能(模块、script 属性)
set dotenv-load # 自动加载 .env 文件
set positional-arguments # 将配方参数作为 $1, $2 等传递
| 属性 | 用途 |
|---|---|
[arg("p", long, ...)] | 将参数配置为 --flag 选项(v1.46) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
[arg("p", pattern="…")] | 约束参数以匹配正则表达式模式 |
[group("name")] | 在 just --list 输出中对配方进行分组 |
[no-cd] | 不切换到 justfile 所在目录 |
[private] | 在 just --list 中隐藏(与 _ 前缀作用相同) |
[script] | 将配方作为单个脚本块执行 |
[script("interpreter")] | 使用特定解释器(bash、python 等) |
[confirm("prompt")] | 运行前需要用户确认 |
[doc("text")] | 覆盖配方文档 |
[positional-arguments] | 仅为此配方启用位置参数 |
[arg()] 属性将参数配置为 CLI 风格的选项:
# 长选项 (--target)
[arg("target", long)]
build target:
cargo build --target {{ target }}
# 短选项 (-v)
[arg("verbose", short="v")]
run verbose="false":
echo "Verbose: {{ verbose }}"
# 长选项 + 短选项组合
[arg("output", long, short="o")]
compile output:
gcc main.c -o {{ output }}
# 无值标志(存在即设置为 "true")
[arg("release", long, value="true")]
build release="false":
cargo build {{ if release == "true" { "--release" } else { "" } }}
# 帮助字符串(在 `just --usage` 中显示)
[arg("target", long, help="Build target architecture")]
build target:
cargo build --target {{ target }}
使用示例:
just build --target x86_64
just build --target=x86_64
just compile -o main
just build --release
just --usage build # 显示配方参数帮助
多个属性可以组合使用:
[no-cd, private]
[group("checks")]
recipe:
echo "hello"
终端格式化常量全局可用(无需定义):
| 常量 | 描述 |
|---|---|
CYAN, GREEN, RED, YELLOW, BLUE, MAGENTA | 文本颜色 |
BOLD, ITALIC, UNDERLINE, STRIKETHROUGH | 文本样式 |
NORMAL | 重置格式化 |
BG_* | 背景颜色(BG_RED, BG_GREEN 等) |
HEX, HEXLOWER | 十六进制数字 |
用法:
@status:
echo -e '{{ GREEN }}Success!{{ NORMAL }}'
echo -e '{{ BOLD + CYAN }}Building...{{ NORMAL }}'
# 要求可执行文件存在(如果未找到则使配方失败)
jq := require("jq")
# 获取环境变量(带默认值)
log_level := env("LOG_LEVEL", "info")
# 获取 justfile 目录路径
root := justfile_dir()
在多步骤工作流中显示格式化的状态:
@_run-with-status recipe *args:
echo ""
echo -e '{{ CYAN }}→ Running {{ recipe }}...{{ NORMAL }}'
just {{ recipe }} {{ args }}
echo -e '{{ GREEN }}✓ {{ recipe }} completed{{ NORMAL }}'
alias rws := _run-with-status
为代码质量工具配对检查(验证)和写入(修复)配方:
[group("checks")]
@biome-check +globs=".":
na biome check {{ globs }}
alias bc := biome-check
[group("checks")]
@biome-write +globs=".":
na biome check --write {{ globs }}
alias bw := biome-write
聚合所有检查并附带状态报告:
[group("checks")]
@full-check:
just _run-with-status biome-check
just _run-with-status prettier-check
just _run-with-status tsc-check
echo ""
echo -e '{{ GREEN }}All code checks passed!{{ NORMAL }}'
alias fc := full-check
[group("checks")]
@full-write:
just _run-with-status biome-write
just _run-with-status prettier-write
echo ""
echo -e '{{ GREEN }}All code fixes applied!{{ NORMAL }}'
alias fw := full-write
| 配方 | 别名 | 配方 | 别名 |
|---|---|---|---|
| full-check | fc | full-write | fw |
| biome-check | bc | biome-write | bw |
| prettier-check | pc | prettier-write | pw |
| mdformat-check | mc | mdformat-write | mw |
| tsc-check | tc | ruff-check | rc |
| test | t | build | b |
Just 通过两种方法支持任何语言的内联脚本:
使用 [script("interpreter")] 以获得跨平台兼容性:
[script("node")]
fetch-data:
const response = await fetch('https://api.example.com/data');
const data = await response.json();
console.log(data);
[script("python3")]
analyze:
import json
with open('package.json') as f:
pkg = json.load(f)
print(f"Package: {pkg['name']}@{pkg['version']}")
[script("bash")]
deploy:
set -e
npm run build
aws s3 sync dist/ s3://bucket/
在配方开头使用 #!/usr/bin/env interpreter:
node-script:
#!/usr/bin/env node
console.log(`Node ${process.version}`);
console.log(JSON.stringify(process.env, null, 2));
python-script:
#!/usr/bin/env python3
import sys
print(f"Python {sys.version}")
bash-script:
#!/usr/bin/env bash
set -euo pipefail
echo "Running on $(uname -s)"
何时使用哪种方法:
[script()] - 更好的跨平台支持,语法更清晰set unstable 即可工作从另一个文件包含配方:
import "./just/settings.just"
import "./just/base.just"
import? "./local.just" # 可选(如果缺失不报错)
加载子模块(需要 set unstable):
mod foo # 加载 foo.just 或 foo/justfile
mod bar "path/to/bar" # 自定义路径
mod? optional # 可选模块
# 调用模块中的配方
just foo::build
适用于使用 @sablier/devkit 的项目:
import "./node_modules/@sablier/devkit/just/base.just"
import "./node_modules/@sablier/devkit/just/npm.just"
标准章节标题格式:
# ---------------------------------------------------------------------------- #
# 依赖项
# ---------------------------------------------------------------------------- #
常见章节(按顺序):
始终定义一个默认配方:
# 显示可用命令
default:
@just --list
在顶部记录必需的工具:
# ---------------------------------------------------------------------------- #
# 依赖项
# ---------------------------------------------------------------------------- #
# Bun: https://bun.sh
bun := require("bun")
# Ni: https://github.com/antfu-collective/ni
na := require("na")
ni := require("ni")
nlx := require("nlx")
# 用法:直接在配方中调用(不要使用插值)
build:
bun next build
注意: require() 在配方求值时验证工具是否存在。直接使用变量名(例如 bun),不要使用插值({{ bun }})。
对于本技能未涵盖的 Just 功能(新属性、高级函数、边缘情况),请获取最新文档:
使用 library ID 为 `/websites/just_systems-man` 的 context7 MCP 来获取最新的 Just 文档。
可搜索的示例主题:
modules import mod - 模块系统详情settings - 所有可用设置attributes - 配方属性functions - 内置函数script recipes - 脚本块语法如需详细模式和全面覆盖范围,请查阅:
references/settings.md - 设置配置和模块系统references/recipes.md - 配方属性、参数、依赖项和前缀references/syntax.md - 常量、函数、变量和 CLI 选项references/patterns.md - 既定约定、章节组织、助手模式examples/ 目录中的工作 justfile 模板:
devkit.just - 导入 @sablier/devkit 的最小模板standalone.just - 包含所有模式的完整独立模板/websites/just_systems-man不要使用 just --fmt 或 just --dump。用户有特定的格式化偏好,内置格式化器无法满足。请按原样保留现有格式。
@ 前缀来抑制命令回显:@echo "quiet"+ 表示可变参数:test +args* 表示可选的可变参数:build *flagsGLOBS := "\"**/*.json\""[no-cd] 以保持在当前目录_ 开头或使用 [private]每周安装数
116
仓库
GitHub 星标数
41
首次出现
2026年2月9日
安全审计
安装于
claude-code104
codex96
opencode96
gemini-cli95
github-copilot95
amp95
Expert guidance for Just, a command runner with syntax inspired by make. Use this skill for creating justfiles, writing recipes, configuring settings, and implementing task automation workflows.
Key capabilities:
set allow-duplicate-recipes # Allow recipes to override imported ones
set allow-duplicate-variables # Allow variables to override imported ones
set shell := ["bash", "-euo", "pipefail", "-c"] # Strict bash with error handling
set unstable # Enable unstable features (modules, script attribute)
set dotenv-load # Auto-load .env file
set positional-arguments # Pass recipe args as $1, $2, etc.
| Attribute | Purpose |
|---|---|
[arg("p", long, ...)] | Configure parameter as --flag option (v1.46) |
[arg("p", pattern="…")] | Constrain parameter to match regex pattern |
[group("name")] | Group recipes in just --list output |
[no-cd] | Don't change to justfile directory |
[private] | Hide from just --list (same as _ prefix) |
[script] | Execute recipe as single script block |
[script("interpreter")] | Use specific interpreter (bash, python, etc.) |
[confirm("prompt")] | Require user confirmation before running |
[doc("text")] | Override recipe documentation |
[positional-arguments] | Enable positional args for this recipe only |
The [arg()] attribute configures parameters as CLI-style options:
# Long option (--target)
[arg("target", long)]
build target:
cargo build --target {{ target }}
# Short option (-v)
[arg("verbose", short="v")]
run verbose="false":
echo "Verbose: {{ verbose }}"
# Combined long + short
[arg("output", long, short="o")]
compile output:
gcc main.c -o {{ output }}
# Flag without value (presence sets to "true")
[arg("release", long, value="true")]
build release="false":
cargo build {{ if release == "true" { "--release" } else { "" } }}
# Help string (shown in `just --usage`)
[arg("target", long, help="Build target architecture")]
build target:
cargo build --target {{ target }}
Usage examples:
just build --target x86_64
just build --target=x86_64
just compile -o main
just build --release
just --usage build # Show recipe argument help
Multiple attributes can be combined:
[no-cd, private]
[group("checks")]
recipe:
echo "hello"
Terminal formatting constants are globally available (no definition needed):
| Constant | Description |
|---|---|
CYAN, GREEN, RED, YELLOW, BLUE, MAGENTA | Text colors |
BOLD, ITALIC, UNDERLINE, STRIKETHROUGH |
Usage:
@status:
echo -e '{{ GREEN }}Success!{{ NORMAL }}'
echo -e '{{ BOLD + CYAN }}Building...{{ NORMAL }}'
# Require executable exists (fails recipe if not found)
jq := require("jq")
# Get environment variable with default
log_level := env("LOG_LEVEL", "info")
# Get justfile directory path
root := justfile_dir()
Display formatted status during multi-step workflows:
@_run-with-status recipe *args:
echo ""
echo -e '{{ CYAN }}→ Running {{ recipe }}...{{ NORMAL }}'
just {{ recipe }} {{ args }}
echo -e '{{ GREEN }}✓ {{ recipe }} completed{{ NORMAL }}'
alias rws := _run-with-status
Pair check (verify) and write (fix) recipes for code quality tools:
[group("checks")]
@biome-check +globs=".":
na biome check {{ globs }}
alias bc := biome-check
[group("checks")]
@biome-write +globs=".":
na biome check --write {{ globs }}
alias bw := biome-write
Aggregate all checks with status reporting:
[group("checks")]
@full-check:
just _run-with-status biome-check
just _run-with-status prettier-check
just _run-with-status tsc-check
echo ""
echo -e '{{ GREEN }}All code checks passed!{{ NORMAL }}'
alias fc := full-check
[group("checks")]
@full-write:
just _run-with-status biome-write
just _run-with-status prettier-write
echo ""
echo -e '{{ GREEN }}All code fixes applied!{{ NORMAL }}'
alias fw := full-write
| Recipe | Alias | Recipe | Alias |
|---|---|---|---|
| full-check | fc | full-write | fw |
| biome-check | bc | biome-write | bw |
| prettier-check | pc | prettier-write | pw |
| mdformat-check | mc | mdformat-write | mw |
| tsc-check | tc | ruff-check | rc |
| test | t | build | b |
Just supports inline scripts in any language via two methods:
Use [script("interpreter")] for cross-platform compatibility:
[script("node")]
fetch-data:
const response = await fetch('https://api.example.com/data');
const data = await response.json();
console.log(data);
[script("python3")]
analyze:
import json
with open('package.json') as f:
pkg = json.load(f)
print(f"Package: {pkg['name']}@{pkg['version']}")
[script("bash")]
deploy:
set -e
npm run build
aws s3 sync dist/ s3://bucket/
Use #!/usr/bin/env interpreter at the recipe start:
node-script:
#!/usr/bin/env node
console.log(`Node ${process.version}`);
console.log(JSON.stringify(process.env, null, 2));
python-script:
#!/usr/bin/env python3
import sys
print(f"Python {sys.version}")
bash-script:
#!/usr/bin/env bash
set -euo pipefail
echo "Running on $(uname -s)"
When to use which:
[script()] - Better cross-platform support, cleaner syntaxset unstableInclude recipes from another file:
import "./just/settings.just"
import "./just/base.just"
import? "./local.just" # Optional (no error if missing)
Load submodule (requires set unstable):
mod foo # Loads foo.just or foo/justfile
mod bar "path/to/bar" # Custom path
mod? optional # Optional module
# Call module recipes
just foo::build
For projects using @sablier/devkit:
import "./node_modules/@sablier/devkit/just/base.just"
import "./node_modules/@sablier/devkit/just/npm.just"
Standard section header format:
# ---------------------------------------------------------------------------- #
# DEPENDENCIES #
# ---------------------------------------------------------------------------- #
Common sections (in order):
Always define a default recipe:
# Show available commands
default:
@just --list
Document required tools at the top:
# ---------------------------------------------------------------------------- #
# DEPENDENCIES #
# ---------------------------------------------------------------------------- #
# Bun: https://bun.sh
bun := require("bun")
# Ni: https://github.com/antfu-collective/ni
na := require("na")
ni := require("ni")
nlx := require("nlx")
# Usage: invoke directly in recipes (not with interpolation)
build:
bun next build
Note: require() validates the tool exists at recipe evaluation time. Use the variable name directly (e.g., bun), not with interpolation ({{ bun }}).
For Just features not covered in this skill (new attributes, advanced functions, edge cases), fetch the latest documentation:
Use context7 MCP with library ID `/websites/just_systems-man` to get up-to-date Just documentation.
Example topics to search:
modules import mod - Module system detailssettings - All available settingsattributes - Recipe attributesfunctions - Built-in functionsscript recipes - Script block syntaxFor detailed patterns and comprehensive coverage, consult:
references/settings.md - Settings configuration and module systemreferences/recipes.md - Recipe attributes, parameters, dependencies, and prefixesreferences/syntax.md - Constants, functions, variables, and CLI optionsreferences/patterns.md - Established conventions, section organization, helper patternsWorking justfile templates in examples/:
devkit.just - Minimal template importing @sablier/devkitstandalone.just - Full standalone template with all patterns/websites/just_systems-manDo not use just --fmt or just --dump. The user has bespoke formatting preferences that the built-in formatter does not respect. Preserve existing formatting as-is.
@ prefix to suppress command echo: @echo "quiet"+ for variadic parameters: test +args* for optional variadic: build *flagsGLOBS := "\"**/*.json\""[no-cd] in monorepos to stay in current directory_ or use [private]Weekly Installs
116
Repository
GitHub Stars
41
First Seen
Feb 9, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code104
codex96
opencode96
gemini-cli95
github-copilot95
amp95
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
43,100 周安装
| Text styles |
NORMAL | Reset formatting |
BG_* | Background colors (BG_RED, BG_GREEN, etc.) |
HEX, HEXLOWER | Hexadecimal digits |