Skip to content
Skills Library
Programming · Analysis

overview

/overview

Cross-language CLI and scripting guidance for IT automation, system administration, and DevOps workflows: language selection (Bash vs PowerShell vs Python vs Node.js), pipes, exit codes, environment variables, argument parsing, error handling, and cross-platform scripting best practices. WHEN: \"which scripting language\", \"Bash vs PowerShell\", \"Bash vs Python\", \"CLI\", \"command line\", \"scripting\", \"shell script\", \"automation script\", \"cron\", \"task scheduler\", \"shell\", \"terminal\", \"pipe\", \"redirect\", \"stdin\", \"stdout\", \"stderr\", \"exit code\", \"shebang\". Do NOT

Licence
MIT
Last repository change
23.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 23.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Cross-language CLI and scripting guidance for IT automation, system administration, and DevOps workflows: language selection (Bash vs PowerShell vs Python vs Node.js), pipes, exit codes, environment variables, argument parsing, error handling, and cross-platform scripting best practices. WHEN: \"which scripting language\", \"Bash vs PowerShell\", \"Bash vs Python\", \"CLI\", \"command line\", \"scripting\", \"shell script\", \"automation script\", \"cron\", \"task scheduler\", \"shell\", \"terminal\", \"pipe\", \"redirect\", \"stdin\", \"stdout\", \"stderr\", \"exit code\", \"shebang\". Do NOT

Triggers from the description

which scripting language\Bash vs PowerShell\Bash vs Python\CLI\command line\scripting\shell script\automation script\
Original author description

Cross-language CLI and scripting guidance for IT automation, system administration, and DevOps workflows: language selection (Bash vs PowerShell vs Python vs Node.js), pipes, exit codes, environment variables, argument parsing, error handling, and cross-platform scripting best practices. WHEN: \"which scripting language\", \"Bash vs PowerShell\", \"Bash vs Python\", \"CLI\", \"command line\", \"scripting\", \"shell script\", \"automation script\", \"cron\", \"task scheduler\", \"shell\", \"terminal\", \"pipe\", \"redirect\", \"stdin\", \"stdout\", \"stderr\", \"exit code\", \"shebang\". Do NOT

How it works

  1. When to Use This Skill vs. a Technology Skill
  2. How to Approach Tasks
  3. Language Selection Guide
  4. Cross-Language Concepts
  5. Common Pitfalls
  6. Technology Skills
Original SKILL.md headings · 262 lines, 1,290 words
SKILL.md preview
---
name: overview
description: "Cross-language CLI and scripting guidance for IT automation, system administration, and DevOps workflows: language selection (Bash vs PowerShell vs Python vs Node.js), pipes, exit codes, environment variables, argument parsing, error handling, and cross-platform scripting best practices. WHEN: \"which scripting language\", \"Bash vs PowerShell\", \"Bash vs Python\", \"CLI\", \"command line\", \"scripting\", \"shell script\", \"automation script\", \"cron\", \"task scheduler\", \"shell\", \"terminal\", \"pipe\", \"redirect\", \"stdin\", \"stdout\", \"stderr\", \"exit code\", \"shebang\". Do NOT use for single-technology syntax, commands, or debugging — read that technology's skill directly (e.g. `powershell`, `bash`, `python`, `nodejs`, `aws-cli`, `azure-cli`, `kubectl`)."
license: MIT
---

# CLI & Scripting Domain Overview

This skill covers cross-language guidance for command-line interfaces and scripting languages used in IT automation, system administration, and DevOps: language selection, and the patterns (exit codes, streams, env vars, argument parsing, error handling) that recur across every shell/language. Read it for language-selection and cross-language questions; read a technology skill directly for implementation depth.

## When to Use This Skill vs. a Technology Skill

**Use this skill when the question is cross-language or about picking a tool:**
- "Should I write this in Bash or Python?"
- "What's the PowerShell equivalent of Bash's `set -euo pipefail`?"
- "How do exit codes work across shells?"
- "General scripting best practices for a new automation project"

**Read a technology skill directly when the question is technology-specific:**
- "PowerShell pipeline / advanced function / remoting question" -> `powershell` skill
- "Bash quoting / sed / awk / jq question" -> `bash` skill
- "Python argparse / pathlib / subprocess question" -> `python` skill
- "Node.js CLI tool / fetch / stream question" -> `nodejs` skill
- "AWS CLI command / JMESPath query" -> `aws-cli` skill
- "Azure CLI (`az`) command" -> `azure-cli` skill
- "kubectl command / debugging a pod" -> `kubectl` skill

## How to Approach Tasks

1. **Identify the language** -- Look for file extensions, shebang lines, syntax patterns, or explicit mentions. If unclear, ask or recommend based on the task.

2. **Route to a technology skill** -- Read the matching skill above for deep expertise.

3. **Apply cross-language principles** -- The concepts below apply regardless of language.

4. **Recommend** -- Provide actionable, tested guidance.

## Language Selection Guide

Choose the right tool for the job:

### Use Bash When
- Running on Linux/macOS and the task is gluing existing CLI tools together
- Processing text streams with grep, sed, awk, jq
- Writing cron jobs, systemd timers, CI/CD pipeline steps
- Task requires < 100 lines and involves mostly command orchestration
- You need maximum portability across Unix systems (POSIX sh subset)
- File manipulation with find, rsync, tar, chmod

### Use PowerShell When
- Managing Windows systems (Active Directory, Registry, IIS, Windows Services)
- Working with structured data (objects, not text) through pipelines
- Need cross-platform scripting with rich type system
- Interacting with .NET APIs, COM objects, WMI/CIM
- Building tools that need `-WhatIf`, `-Confirm`, `-Verbose` support
- Azure/M365 administration (Az module, Microsoft Graph)

### Use Python When
- Task exceeds ~100 lines or involves complex logic
- Need third-party libraries (requests, pandas, paramiko, boto3)
- Building reusable tools with proper argument parsing
- Data processing, API integration, or report generation
- Cross-platform scripts that need to handle binary data, encoding, or complex I/O
- When maintainability matters more than brevity

### Decision Matrix

| Factor | Bash | PowerShell | Python |
|--------|------|------------|--------|
| Text stream processing | Best | Good | Good |
| Structured data / objects | Poor | Best | Good |
| Windows administration | Poor | Best | Fair |
| Linux administration | Best | Good | Good |
| API interaction | Fair | Good | Best |
| Complex logic (>100 LOC) | Poor | Good | Best |
| Third-party ecosystem | Fair | Good | Best |
| Startup time | Fastest | Slow | Fast |
| Learning curve | Medium | Medium | Low |

## Cross-Language Concepts

### Exit Codes

Every process returns an integer exit code. Zero means success; non-zero means failure.

```bash
# Bash: $? holds last exit code
command
echo $?                    # 0 = success
```

```powershell
# PowerShell: $LASTEXITCODE for native commands, $? for cmdlets
git status
$LASTEXITCODE              # 0 = success
Get-Item missing.txt
$?                         # $false = cmdlet failed
```

```python
# Python: subprocess.run returns CompletedProcess with .returncode
import subprocess
result = subprocess.run(["git", "status"], capture_output=True)
result.returncode          # 0 = success
```

### Standard Streams (stdin, stdout, stderr)

All three languages work with three standard streams: stdin (fd 0), stdout (fd 1), stderr (fd 2).

```bash
# Bash: redirect with >, 2>, &>, |
command > out.txt 2> err.txt    # separate stdout/stderr
command 2>&1 | tee log.txt      # combine and tee
command < input.txt              # pipe file to stdin
```

```powershell
# PowerShell: streams are numbered (1=output, 2=error, 3=warning, etc.)
command > out.txt 2> err.txt
command *> all.txt               # all streams
Write-Error "problem" 2> Variable:errs
```

```python
# Python: subprocess handles streams explicitly
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print(result.stdout)
print(result.stderr)
```

### Environment Variables

```bash
# Bash: export for child processes
export API_KEY="secret"
echo "$API_KEY"
API_KEY=val command             # set for single command only
```

```powershell
# PowerShell: $env: drive
$env:API_KEY = 'secret'
[System.Environment]::GetEnvironmentVariable('PATH', 'Machine')
```

```python
# Python: os.environ dict
import os
key = os.environ.get("API_KEY", "default")
os.environ["NEW_VAR"] = "value"  # for child processes
```

### Argument Parsing Patterns

```bash
# Bash: getopts (short) or manual while/case (long options)
while [[ $# -gt 0 ]]; do
  case $1 in
    -v|--verbose) VERBOSE=true; shift ;;
    -o|--output)  OUTPUT="$2"; shift 2 ;;
    *)            ARGS+=("$1"); shift ;;
  esac
done
```

```powershell
# PowerShell: param() block with attributes
param(
    [Parameter(Mandatory)][string]$Path,
    [ValidateSet('csv','json')][string]$Format = 'csv',
    [switch]$Verbose
)
```

```python
# Python: argparse module
import argparse
parser = argparse.ArgumentParser(description="My tool")
parser.add_argument("path", help="Input file")
parser.add_argument("-f", "--format", choices=["csv","json"], default="csv")
parser.add_argument("-v", "--verbose", action="store_true")
args = parser.parse_args()
```

### Error Handling Patterns

```bash
# Bash: set -euo pipefail + trap
set -euo pipefail
trap 'echo "Error at line $LINENO"; exit 1' ERR
```

```powershell
# PowerShell: try/catch + $ErrorActionPreference
$ErrorActionPreference = 'Stop'
try { risky_operation } catch { Write-Error $_.Exception.Message }
```

```python
# Python: try/except with specific exceptions
try:
    risky_operation()
except FileNotFoundError as e:
    logging.error("File missing: %s", e)
    sys.exit(1)
```

### Pipe / Pipeline Patterns

Pipes connect commands. Each language handles them differently:

- **Bash**: Text streams. Each stage processes lines of text. `cmd1 | cmd2 | cmd3`
- **PowerShell**: Object pipelines. Each stage processes .NET objects with properties. `Get-Process | Where-Object CPU -gt 50 | Select-Object Name, CPU`
- **Python**: No built-in pipe operator. Chain via function calls, generators, or subprocess pipes.

### Signal Handling

```bash
# Bash: trap for signals
trap 'cleanup; exit' INT TERM HUP
trap cleanup EXIT
```

```powershell
# PowerShell: Register-EngineEvent or try/finally
try { long_operation } finally { cleanup }
```

```python
# Python: signal module
import signal
signal.signal(signal.SIGTERM, lambda sig, frame: cleanup())
```

## Common Pitfalls

**1. Forgetting to quote variables in Bash**
Unquoted variables undergo word splitting and glob expansion. Always use `"$var"`, never bare `$var`.

**2. Ignoring exit codes**
Always check `$?` (Bash), `$LASTEXITCODE` (PowerShell), or `.returncode` (Python subprocess). Unchecked failures cascade silently.

**3. Using shell=True in Python subprocess**
`subprocess.run(cmd, shell=True)` is a command injection risk. Pass a list of arguments instead: `subprocess.run(["git", "status"])`.

**4. Hardcoding paths with wrong separators**
Use `os.path.join()` or `pathlib.Path` in Python, `Join-Path` in PowerShell, and `"$dir/$file"` in Bash. Never hardcode `\` or `/`.

**5. Not handling encoding**
Specify `encoding="utf-8"` explicitly in Python file operations. In PowerShell, use `-Encoding UTF8`. In Bash, ensure `LANG` or `LC_ALL` is set.

**6. Running destructive operations without dry-run mode**
Always implement `--dry-run` / `-WhatIf` for scripts that modify, delete, or move files.

## Technology Skills

For deep expertise in a specific technology, read:

- `powershell` skill -- PowerShell 7.4/7.6 LTS: pipelines, modules, remoting, parallel execution
- `bash` skill -- Bash 5.x: variables, text processing (grep/sed/awk/jq), process management, networking
- `python` skill -- Python 3.10-3.14: file ops, subprocess, HTTP/API, argparse, system automation
- `nodejs` skill -- Node.js 20/22/24/26: file system, child_process, fetch, CLI tool building, npm
- `aws-cli` skill -- AWS CLI v2: authentication, JMESPath, IAM, S3, Lambda, CloudFormation, and more
- `azure-cli` skill -- Azure CLI (`az`): authentication, resource groups, VMs, AKS, Key Vault, and more
- `kubectl` skill -- kubectl: kubeconfig, output formats, workload/networking/RBAC commands, debugging

Versions

RepositoryScoreLicence
This page · chrishuffman5/domain-expert100MIT
A7-studio/jobmigo100MIT
8beeeaaat/touchdesigner-mcp100MIT
onsi/gomega100MIT
chrishuffman5/domain-expert100MIT
chrishuffman5/domain-expert100MIT
chrishuffman5/domain-expert100MIT
chrishuffman5/domain-expert100MIT
chrishuffman5/domain-expert100MIT

Database snapshot: 13.11.2026 · package version 567d5a620de0 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95bash
    Use when writing shell scripts or working with Bash, Zsh, or POSIX-compatible shells on macOS and Linux. Covers scripting fundamentals, variables, control flow, functions, pipes, process management, and common patterns for automation and developer tooling. USE FOR: Bash, Zsh,…
  • 100shell-expert
    Shell scripting expertise, command-line tools, automation, and cross-platform scripting best practices. Covers shell script development, CLI tool usage, and system automation with bash, zsh, and POSIX shell. Use when user mentions shell scripts, bash, zsh, CLI commands, pipes,…
  • 100linux-bash-scripting
    Defensive Bash scripting for Linux: safe foundations, argument parsing, production patterns, ShellCheck compliance. Use when writing "bash script", "shell script", "linux automation", "system script", "cron job", "deployment script", "CLI tool in bash", or "automate with bash".
  • 100ops-scripting-standards
    Use when you write a Bash, PowerShell, or Python automation script. Fail on errors and unset variables, support a dry run, and make a second run change nothing.
  • 100shell-scripting
    Write robust, safe bash/shell scripts and one-liners, and explain or fix existing ones. Use when users want a shell script, a command pipeline, automation glue, or ask why a bash snippet misbehaves (quoting, globbing, exit codes). Triggers on mentions of bash, shell script, .sh,…
  • 100linux-bash-scripting
    Defensive Bash scripting for Linux: safe foundations, argument parsing, production patterns, ShellCheck compliance. Use when writing bash scripts, shell scripts, cron jobs, or CLI tools in bash.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.