Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

command-prompt命令提示符

Agent Skill

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

总安装

233

周安装

10

GitHub Stars

3

下载量

82
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:command-prompt(命令提示符)
来源仓库:https://github.com/iuliandita/skills
仓库路径:skills/command-prompt
安装命令:
npx skills add https://github.com/iuliandita/skills --skill command-prompt
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/iuliandita/skills --skill command-prompt

简介

提供多 shell 环境下的命令编写与配置参考,支持主流版本。

  • 适用于编写脚本、配置 dotfiles 或调试 shell 特定行为。
  • 自动识别目标 shell 并匹配相应语法与最佳实践。
  • 涉及敏感操作时应显式确认步骤,防止误执行危险命令。
  • command-prompt 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Command Prompt: Shell Scripting and Configuration

Reference skill for writing commands, scripts, and configuration across Unix shells. Detects the target shell from context and routes to the appropriate reference.

Target versions (April 2026):

  • Zsh: 5.10
  • Bash: 5.3
  • Fish: 4.6
  • Nushell: 0.111
  • Tcsh: 6.24
  • Dash: 0.5.13

When to use

  • Writing shell commands, scripts, or one-liners
  • Configuring dotfiles (.zshrc, .bashrc, .profile, config.fish)
  • Writing completions, shell functions, or aliases
  • Porting scripts between shells
  • Debugging shell-specific behavior (globbing, arrays, expansion, quoting)
  • Setting up oh-my-zsh, starship, p10k, or other shell frameworks
  • Choosing which shell to target for a new script
  • Writing interactive commands on the user's local machine (zsh)

When NOT to use

  • Remote FreeBSD/OPNsense/pfSense commands - use firewall-appliance (handles tcsh/csh in the BSD context)
  • Ansible shell/command modules - use ansible (module gotchas differ from raw shell)
  • CI/CD pipeline shell blocks - use ci-cd (restricted environments, no interactive features)
  • General Linux sysadmin that isn't shell-specific - just do the task directly

AI Self-Check

Before returning any generated shell script or command, verify:

  • Shebang matches the detected target shell (not assumed bash)
  • set -euo pipefail (bash/zsh) or set -eu (POSIX sh) present in scripts
  • All variables double-quoted ("$var") unless word splitting is intentional
  • No shell-isms from the wrong shell (no [[]] in #!/bin/sh, no BASH_SOURCE in zsh)
  • Array indexing correct for the target shell (bash: 0-indexed, zsh: 1-indexed)
  • printf used over echo for non-trivial output
  • Glob safety guards in place (empty-glob case handled)
  • No hardcoded paths for tools (/usr/bin/git) - use command -v or bare command names
  • Temp files use mktemp with cleanup traps, not hardcoded /tmp/foo
  • No secrets in command history (use read -s or environment variables)

Workflow

Step 1: Detect the target shell

Before writing any shell code, determine the target shell. Check these signals in order:

SignalHow to checkRoutes to
ShebangFirst line of existing script#!/usr/bin/env zsh -> zsh, #!/usr/bin/env bash -> bash, #!/bin/sh -> posix-sh
File name/extension.zsh, .zshrc, .zprofile, .zshenv -> zsh; .bash, .bashrc, .bash_profile -> bash; .fish, config.fish -> fish
User's shellConversation context, $SHELLUser's local machine = zsh
Task typeWhat the script doesSee routing below

Task-based routing

TaskTarget shellWhy
Interactive commands on user's machinezshUser's default shell
Portable scripts (new)bashWidest deployment, good feature set
Docker/CI containersbash or shContainers often lack zsh
Minimal Alpine/BusyBox scriptsPOSIX shOnly ash/dash available
BSD system administrationtcshFreeBSD default (but see firewall-appliance skill)
Cross-shell startup (env vars, PATH)POSIX sh.profile sourced by all POSIX shells
Maximum portability requirementPOSIX shOnly standard guaranteed on all Unixes

Step 2: Load the right reference

Target shellReference file
Zshreferences/zsh.md (~680 lines, 14 sections)
Bashreferences/bash.md (~710 lines, 13 sections)
POSIX shreferences/posix-sh.md (~490 lines, 10 sections)
Fish, tcsh, nushell, othersreferences/alt-shells.md (~420 lines, 4 shells)

Don't load all references. Pick the one that matches. If porting between two shells, load both.

Step 3: Write code, then verify

Use the cross-shell comparison below for quick lookups. After writing, run through the Verification Checklist at the bottom of this section.


Quick Cross-Shell Comparison

FeaturePOSIX shBashZshFish
Arraysno (use $@)0-indexed1-indexedlists (1-indexed)
Assoc arraysnodeclare -A (4.0+)typeset -Ano
Glob **/noshopt -s globstarbuilt-inbuilt-in
Failed globpasses literalpasses literalerrorno match
[[]]noyesyesno (use test)
Process sub <()noyesyes + =()`(command \psub)`
Word splittingon unquoted $varon unquoted $varnono
Arithmetic$(()) only$(()), (()), let$(()), (())math
String lowercase-${var,,}${var:l}string lower
Completionsnonebasic (bash-completion)powerful (compsys)powerful (built-in)
Config file.profile.bashrc.zshrcconfig.fish
Shebang#!/bin/sh#!/usr/bin/env bash#!/usr/bin/env zsh#!/usr/bin/env fish
Script safetyset -euset -euo pipefailset -euo pipefailN/A (strict by default)
Non-forking cmd subno${cmd;} (5.3+)${cmd} (5.10+)no

Universal Patterns (All POSIX Shells)

These work in sh, bash, and zsh. Fish has different syntax for most of these - see the alt-shells reference.

Piping and redirection

PatternEffect
`cmd1 \cmd2`Pipe stdout of cmd1 to stdin of cmd2
cmd > fileRedirect stdout to file (overwrite)
cmd >> fileRedirect stdout to file (append)
cmd 2> fileRedirect stderr to file
cmd &> fileRedirect both stdout and stderr (bash/zsh, not POSIX)
cmd 2>&1Redirect stderr to stdout
cmd > /dev/null 2>&1Silence all output (POSIX-portable)
cmd < fileFeed file as stdin
cmd <<'EOF'Here document (single-quoted delimiter = no expansion)
cmd <<< "string"Here string (bash/zsh, not POSIX)
`cmd1 \tee file \cmd2`Send stdout to both file and cmd2

Chaining

PatternBehavior
cmd1; cmd2Run sequentially, ignore exit codes
cmd1 && cmd2Run cmd2 only if cmd1 succeeds (exit 0)
`cmd1 \\cmd2`Run cmd2 only if cmd1 fails (exit non-0)
cmd &Run in background
`cmd1 && cmd2 \\cmd3`Poor man's if/else (not reliable - cmd3 runs if cmd2 fails too)

Job control

CommandEffect
Ctrl+ZSuspend foreground job
bg / bg %NResume job in background
fg / fg %NResume job in foreground
jobsList background jobs
kill %NKill job by number
waitWait for all background jobs
wait $PIDWait for specific PID
disown %NDetach job from shell (survives logout)

Signals and traps

# Cleanup on exit (works in sh, bash, zsh)
cleanup() {
    rm -f "$tmpfile"
}
trap cleanup EXIT INT TERM

# Ignore a signal
trap '' HUP

# Common signals: EXIT (0), HUP (1), INT (2), TERM (15), USR1 (10), USR2 (12)

# Graceful kill with SIGTERM -> wait -> SIGKILL escalation
kill_gracefully() {
    local pid=$1 timeout=${2:-5}
    kill -TERM "$pid" 2>/dev/null || return
    local i=0
    while kill -0 "$pid" 2>/dev/null && [ $i -lt $timeout ]; do
        sleep 1; i=$((i+1))
    done
    kill -0 "$pid" 2>/dev/null && kill -KILL "$pid"
}

Interactive "kill by name" (zsh) - covers search, space-safe names, confirm, TERM->KILL escalation:

pk() {                                           # usage: pk <pattern>
    local pattern=$1 pids
    pids=(${(f)"$(pgrep -af -- "$pattern")"})    # -f matches full cmdline (spaces ok)
    (( $#pids )) || { print -u2 "no match"; return 1 }
    printf '%s\n' "${pids[@]}"                   # show PID + cmdline
    read -q "?kill these? [y/N] " || { print; return 1 }
    print
    for line in $pids; do kill_gracefully ${line%% *} 3; done
}

Quoting rules

SyntaxExpansionUse for
"double"$var, $(cmd), ${param} expand; \ escapesMost strings with variables
'single'Nothing expands, completely literalRegexes, JSON, strings with $ or !
$'ansi'\n, \t, \' interpreted (bash/zsh)Strings needing literal control chars
\charEscapes one characterSingle special chars in unquoted context

Golden rule: when in doubt, double-quote. "$var" is almost always correct. Unquoted $var causes word splitting (in sh/bash) or glob expansion.

Exit codes

CodeMeaning
0Success
1General error
2Misuse of shell builtin
126Command found but not executable
127Command not found
128+NKilled by signal N (e.g., 130 = Ctrl+C / SIGINT)

Common portable idioms

# Check if command exists
command -v git >/dev/null 2>&1 || { echo "git required" >&2; exit 1; }

# Default variable value
: "${VAR:=default}"       # set VAR to "default" if unset or empty
name="${1:-anonymous}"     # parameter default

# Temporary file (portable)
tmpfile=$(mktemp) || exit 1
trap 'rm -f "$tmpfile"' EXIT

# Read file line by line
while IFS= read -r line; do
    printf '%s\n' "$line"
done < file.txt

# Loop over glob results
for f in *.txt; do
    [ -e "$f" ] || continue    # guard against no matches (POSIX sh)
    echo "$f"
done

Completions Quick Reference (Zsh)

Zsh's completion system (compsys) handles subcommand routing natively. Minimal working example for a CLI tool with subcommands:

#compdef mycli

_mycli() {
  local -a subcmds=(
    'init:Initialize a new project'
    'build:Build the project'
    'deploy:Deploy to target environment'
  )

  _arguments -C \
    '(-h --help)'{-h,--help}'[Show help]' \
    '1:command:->subcmd' \
    '*::arg:->args'

  case $state in
    subcmd) _describe 'command' subcmds ;;
    args)
      case $words[1] in
        deploy) _arguments '--env[Target environment]:env:(dev staging prod)' ;;
      esac
      ;;
  esac
}

Place in a file named _mycli on your fpath, then ensure the directory is registered:

# In .zshrc, BEFORE compinit:
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit

Or source inline with compdef _mycli mycli (no fpath needed). The reference files have deeper coverage: glob-qualified completions, _files, _hosts, _values, and async completion patterns.


Verification Checklist

Before returning any shell script, check:

  • Shebang matches the target shell. #!/usr/bin/env bash for bash, #!/usr/bin/env zsh for zsh, #!/bin/sh for POSIX sh. Never #!/bin/bash (not portable across distros).
  • set -euo pipefail present for bash and zsh scripts. For POSIX sh: set -eu (no pipefail).
  • Variables are quoted. "$var" not $var, unless word splitting is intentional.
  • No shell-isms in the wrong shell. No [[]] in #!/bin/sh. No BASH_SOURCE in zsh. No bash arrays in POSIX sh.
  • Glob safety. POSIX sh: guard with [-e "$f"] || continue. Zsh: use (N) qualifier. Bash: shopt -s nullglob or guard.
  • Array indexing matches the shell. Bash: 0-indexed. Zsh: 1-indexed. POSIX sh: no arrays.
  • printf over echo for anything non-trivial (echo behavior varies across shells and platforms).

Reference Files

  • references/zsh.md - Zsh 5.9/5.10 patterns, glob qualifiers, arrays, parameter expansion, completions, autoloading, dotfile config, prompt hooks, zsh-only features, 5.10 additions (non-forking ${}, namerefs, SRANDOM), bash porting matrix
  • references/bash.md - Bash 5.3 patterns, parameter expansion, arrays, conditionals, process substitution, error handling, traps, heredocs, coprocesses, bash 5.x features (non-forking ${cmd;}, GLOBSORT, SRANDOM), script template
  • references/posix-sh.md - Portable POSIX sh patterns, what's POSIX and what's not, bashism avoidance checklist, which-sh-am-I, arithmetic, parameter expansion, portable conditionals
  • references/alt-shells.md - Fish 4.6 (syntax, functions, completions, config, 4.6 additions), tcsh/csh 6.24 (syntax, when you'll encounter it), nushell 0.111 (structured pipelines, types), elvish 0.22/oils 0.37 (brief)

Related Skills

  • firewall-appliance - OPNsense/pfSense uses tcsh/csh on FreeBSD. That skill handles the BSD firewall context; this skill covers tcsh syntax in general.
  • ansible - Ansible shell/command modules have their own idiosyncrasies beyond raw shell scripting. Use ansible for playbook work.
  • ci-cd - CI shell blocks run in restricted environments (no interactive features, possibly no bash). Use ci-cd for pipeline design; use this skill for the shell syntax within them.

Rules

  1. Detect the shell first. Check shebang, file extension, or ask. Don't assume bash when the user might mean zsh.
  2. Load the right reference. Don't wing zsh arrays or bash parameter expansion from memory - the subtle differences justify loading the reference every time.
  3. Shebang is #!/usr/bin/env <shell>. Not #!/bin/bash. The env form is portable across distros. Exception: #!/bin/sh for POSIX scripts (this IS the standard form).
  4. set -euo pipefail in every bash/zsh script. No exceptions for scripts beyond a one-liner.
  5. User's interactive shell is zsh. When writing commands for the user to run locally, use zsh syntax. Bash for scripts and remote machines unless the script specifically needs zsh.
  6. Don't mix shell syntaxes. A bash script uses bash idioms. A zsh script uses zsh idioms. "Works in both" compromises use neither well and confuse readers.
  7. Quote your variables. "$var" is the default. Unquoted $var is the exception that needs justification.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.67%
按下载量换算31

Claude

30.14%
按下载量换算25

Cursor

19.26%
按下载量换算16

Gemini CLI

9.9%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills