Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Shell Tools

ASecurity

Shell and tool-call environment facts: escaping inside single-quoted zsh/jq/Python strings, complex regex in zsh, explicit paths and per-call working directories, linter invocation, curl and JSON output handling, and choosing a built-in tool over a shell one-liner.

5 stars
0 votes
0 copies
0 views
Added 10/4/2026
ai-agentspythongoc++shellbashnodegitapi

Works with

cliapi

Security Analysis

A96/100
mediumUses curl or wget to download content

Pro shows the line behind each finding and how to fix it

Scanned 10/4/2026

$npx -y skills add juan294/cc-rpi --skill shell-tools --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Shell Tools?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Shell Tools
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/juan294-shell-tools/badge)](https://www.skillsdirectory.com/skills/juan294-shell-tools)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: "shell-tools"
description: "Shell and tool-call environment facts: escaping inside single-quoted zsh/jq/Python strings, complex regex in zsh, explicit paths and per-call working directories, linter invocation, curl and JSON output handling, and choosing a built-in tool over a shell one-liner."
---

# Shell & Tools

Environment facts about the shell, the file tools, and the CLIs around them.
These do not become knowable through reasoning -- they are properties of zsh,
jq, Python, and the tool layer.

## Sequencing Fallible Calls

Run resource-intensive verification sequentially. Fail fast when later checks
need earlier success:

```bash
pnpm run typecheck && pnpm run lint && pnpm run test
```

To run every check, collect each status and return an aggregate failure:

```bash
result=0
pnpm run typecheck || result=$?
pnpm run lint || result=$?
pnpm run test || result=$?
exit "$result"
```

A bare `first; second` returns only the second command's status. A passing
last command must not hide an earlier failure. Sibling cancellation is a
harness-specific behavior, not a universal shell property. When supported,
collect independent tool results with `Promise.allSettled` and inspect every
result. Do not infer that one failure cancelled or completed its siblings.

## Quoting and Escaping

Inside single quotes, every character is literal. Escaping an operator there
inserts a real backslash into the string and breaks the consumer.

Wrong -- backslash reaches jq and Python as data:

```bash
jq '.[] | select(.name \!= "review")'   # jq: INVALID_CHARACTER
python3 -c 'assert x \!= y'             # SyntaxError
```

Right -- write the operator plainly inside `'...'`:

```bash
jq '.[] | select(.name != "review")'
python3 -c 'assert x != y'
```

### Complex Regex in zsh

Shell quoting and executable capabilities are separate. Single-quoted
patterns pass literally to bash and zsh. macOS BSD grep does not support
`-P`; wrapping it in `bash -c` does not add PCRE support.

For JSON, parse JSON:

```bash
python3 -c 'import json; print(json.load(open("package.json"))["version"])'
```

For plain text use `rg`, a supported `grep -E` pattern, or Python `re`.
Discover which executable is installed and check its help before using
nonportable flags. Use a script for complex parsing.

## Paths

Resolve paths against the actual tool contract. The current Codex
`exec_command` schema defaults `workdir` to the turn cwd; an explicit `workdir`
selects that call's directory. A `cd` inside one process is not authority to
assume another call targets the same worktree. Current Claude cwd persistence
has not been verified here; inspect its native contract before relying on it.

Use an observed absolute path for cross-project operations, an explicit tool
working directory, or `git -C`. Check the actual branch before mutations.
File APIs need not perform shell expansion: resolve `~` yourself unless that
specific API documents expansion. Shell quoting can also suppress expansion.

```bash
git -C /absolute/path/to/worktree status --short
cd /absolute/path/to/project && pnpm test
```

### Do Not Fabricate Paths

Plausible-sounding directory names (`Projects`, `repos`, `workspace`) are
guesses. Discover the path instead:

```bash
pwd
ls /absolute/path/to/parent
```

Or use the Glob tool. An unobserved path is unknown; only an actual filesystem check can establish
that it is missing.

### Re-read Before Bulk Operations

Wrong -- act on a file list captured several steps ago:

```bash
rm /tmp/out/a.json /tmp/out/b.json   # b.json already gone -> non-zero exit
```

Right -- inspect ownership and preserve unknown files before removal:

```bash
ls /tmp/out/
# Delete only explicitly identified, task-owned disposable files.
```

## Choosing the Tool

### Run `--help` Before Guessing Flags

Each CLI has its own flag vocabulary. `--json` works on `gh` and not on
`vercel`; `--notes` works on `gh release create` and `--body` does not.

```bash
vercel deploy --help 2>&1 | head -30
```

### Write a Script Instead of a Mega One-Liner

Wrong -- a single command carrying loops, `awk`, and nested quoting:

```bash
for f in $(find . -name '*.md'); do awk '/^##/{c++} END{print FILENAME, c}' "$f"; done
```

Right -- write it to a file and run it, or use the built-in tools:

```bash
# Prefer Grep / Glob / Read when they answer the question.
# Otherwise:
cat > /tmp/count-headings.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
...
EOF
bash /tmp/count-headings.sh
```

Built-in Grep, Glob, and Read avoid shell quoting entirely and return
structured results.

### Linters Take Only Their Own File Types

Wrong -- `markdownlint` pointed at a shell script produces confident nonsense:

```bash
npx markdownlint '**/*' 2>&1
```

Right -- scope the glob, and use `--fix` before hand-editing:

```bash
npx markdownlint '**/*.md' --ignore node_modules 2>&1
ruff check --fix .        # "[*]" in ruff output means auto-fixable
eslint --fix .
```

Before "fixing" a warning, check whether the pattern is intentional. Add a
linter exception rather than changing correct content.

### Diagnose HTTP 403

403 means the server refused this request. Inspect the response for an
authentication, permission, resource-policy, rate-limit, or automation-block
reason. It does not prove every URL on the domain is blocked. Avoid blind
retries; retry only after a relevant correction or use an authorized alternate
source. See [HTTP semantics](https://www.rfc-editor.org/rfc/rfc9110.html#name-403-forbidden).

### Recover from Blocked Boilerplate Writes

Historical sessions reported blocked boilerplate writes, but did not establish
a universal filename restriction or current client reproduction. If a batch
fails, inspect each result and isolate the affected write with a legitimate
minimal template or reference. Preserve completed files and record unresolved
failures; do not repeat unchanged attempts or claim a platform cause without
evidence. Independent ordinary writes need no blanket sequential rule.

## JSON and HTTP Output

### Inspect Structure Before Indexing

Wrong -- assume the shape:

```python
data['results'][0]        # TypeError: list indices must be integers
```

Right -- look first:

```python
print(type(data))
print(data[:1] if isinstance(data, list) else list(data)[:5])
```

### Save curl Output Before Parsing

Wrong -- pipe straight into a parser; an HTML error page or auth failure
produces an unhelpful parse error instead of the real problem:

```bash
curl https://api.example.com/things | jq '.[].id'
```

Right -- check transport and HTTP status before parsing:

```bash
response_file=$(mktemp) || exit 1
trap 'rm -f "$response_file"' EXIT
http_code=$(curl -sS -w '%{http_code}' -o "$response_file" "$URL") || exit $?
case "$http_code" in
  2??) jq '.[].id' "$response_file" ;;
  *) printf 'HTTP %s; inspect the saved response securely\n' "$http_code" >&2; exit 1 ;;
esac
```

For a terse pipeline use `set -o pipefail` and `curl -fsS "$URL" | jq '.'`.
Without `pipefail`, a successful parser can mask curl's failure. Avoid printing
response bodies containing credentials or private data. See [curl's manual](https://curl.se/docs/manpage.html).

Attribution

juan294juan294
View sourceSee grades on GitHubMore from juan294 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →