skills/use-shell/SKILL.md
Use when: 'writing scripts', 'structural search', 'semantic search'.
npx skillsauth add kenoxa/spine use-shellInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Prefer native tools (Grep, Glob, Read, Edit/StrReplace) over shell equivalents. Shell is the fallback. Use trash, never rm.
| Instead of | Use |
|------------|-----|
| grep | rg |
| find | fd |
| grepping JSON | jq |
| grepping YAML | yq |
| perl/sed | sd |
| regex for code | ast-grep (sg) |
| rg for concept/ranked search | probe (probe search, probe extract) |
Lint shell scripts with shellcheck; format with shfmt. Include a short description (4–7 words) on every shell command.
sg -r supersedes rg + sd for structural code replacements; sd stays for text/config. Use --debug-query ast when patterns don't match as expected. For pattern syntax, flags, and examples → references/ast-grep.md.
Semantic code search with BM25 ranking and tree-sitter AST extraction. probe search for ranked results; probe extract file#symbol for complete function bodies; probe query for structural patterns (read-only complement to sg). For flags, JSON parsing, and gotchas → references/probe.md.
Always quote glob and regex arguments to prevent shell expansion:
rg 'pattern', not rg patternfd '*.ts', not fd *.tssg -p '$EXPR', not sg -p "$EXPR" (metavar $ expansion)When running expensive commands (test suites, benchmarks, coverage, builds, lints, migrations) whose output is piped through a display filter (head, tail, grep, rg, etc.), save full output before filtering:
set -o pipefail
cmd 2>&1 | tee .scratch/<session>/<slug>.log | <filter>
set -o pipefail prevents exit-code masking — tee returns 0 even when the command fails (E3)2>&1 — diagnostics and failures live on stderrbench-auth.log, test-unit.log).scratch/<session>/ for session-scoped lifecycle (SPINE.md §Sessions)When filtered or truncated display lacks needed context, Read the saved file — do not re-run the command.
dropdb, DROP DATABASE, db:drop, migrate reset, FLUSHALL, etc.) without explicit user permission — guard-shell blocks theserm or rm -rf instead of trashshellcheck on committed shell scriptsnpm/pnpm/yarn/bun — use nisd for structural code changes when sg -r handles the patternsg for text/config files — sd is simpler and correctsg patterns containing $ metavarssg -r ... -U without a search-only dry run firsttesting
Use when: 'clawpatch', 'clawpatch campaign', 'clawpatch review fix revalidate'.
tools
Use when: 'create a worktree', 'git worktree', 'parallel branch'.
tools
Use when: 'session state', 'resume work', 'worktree session'.
development
Use when: 'goal prompt', 'frame this', 'scope this', 'design', 'plan the approach', 'implement and review', 'just ship it', 'fix this', 'add this'.