Shell Scripting
Master shell scripting best practices, error handling, portability, debugging, and performance optimization for reliable automation scripts
Install
npx skills add cosmicstack-labs/mercury-agent-skills --skill Shell Scriptinggit clone --depth 1 https://github.com/cosmicstack-labs/mercury-agent-skills.git /tmp/mercury-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/mercury-agent-skills/categories/automation/shell-scripting ~/.claude/skills/Shell-ScriptingPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Shell Scripting ## Core Principles ### 1. Fail Explicitly A script that encounters an error should stop, not continue with corrupted state. Use defensive coding: validate assumptions, check exit codes, and never assume success. ### 2. Clarity Over Cleverness Shell scripting is already cryptic enough. Write scripts that are easy to read, not impressive one-liners. Your future self will thank you. ### 3. Portability By Default Unless you have a specific reason to require Bash 4+, write for POSIX sh. Your script may need to run in a container, an embedded system, or a legacy environment. ### 4. Defensive Safety Every variable could be empty. Every command could fail. Every file could be missing. Write scripts that survive these realities. ### 5. Principle of Least Surprise Scripts should behave predictably. Use consistent exit codes, clear error messages, and help text. No silent failures, no hidden side effects. ## Scripting Maturity Model | Level | Name | Description | |-------|------|-------------| | 0 | Ad-hoc | One-off commands saved to a file. No error handling. Only the author understands it. | | 1 | Functional | Has shebang and basic structure. Handles common success paths. Brittle. | | 2 | Defensive | Uses `set -euo pipefail`, checks exit codes, validates arguments. Has basic error messages. | | 3 | Robust | Uses functions, has help text, proper argument parsing with defaults. Handles cleanup with traps. Portable across environments. |
Details
- Skill name
Shell Scripting- Repository
- cosmicstack-labs/mercury-agent-skills
- Path
categories/automation/shell-scripting/SKILL.md- License
- MIT
- Repo updated
- 25 August 2026
FAQ
What does the Shell Scripting skill do?
Master shell scripting best practices, error handling, portability, debugging, and performance optimization for reliable automation scripts
How do I install the Shell Scripting skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add cosmicstack-labs/mercury-agent-skills --skill Shell Scripting. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Shell Scripting popular?
It lives in cosmicstack-labs/mercury-agent-skills, which has 492 GitHub stars and 68 forks.
Related skills
Accessibility
492cosmicstack-labs/mercury-agent-skills
Achieve and maintain WCAG compliance through inclusive design practices, proper ARIA usage, and comprehensive testing methodologies.
Accessibility Testing
492cosmicstack-labs/mercury-agent-skills
WCAG 2.1/2.2 audit, axe, Lighthouse, manual testing, screen reader testing, and remediation
Agent Audit Logging
492cosmicstack-labs/mercury-agent-skills
Implement comprehensive audit logging and reporting for multi-agent systems. Covers event capture, structured logging, traceability, compliance reporting, forensic analysis, and real-time monitoring dashboards for agent actions and decisions.
Twitter Account Manager
492cosmicstack-labs/mercury-agent-skills
EDUCATIONAL / RESEARCH ONLY — Single-account always-on Twitter/X manager driven by cookies + headless Playwright. Runs a 10-minute scheduler that drafts posts, engages with timeline/search results, and queues anything risky for Telegram human approval. Hard daily ceilings, structural prompt-injection defenses, and DM auto-reply permanently disabled. Accounts WILL be terminated — we do not encourage use.
Screenshot
492cosmicstack-labs/mercury-agent-skills
Capture high-fidelity screenshots of any website using Playwright — supports custom viewports, dark/light mode, mobile/tablet/desktop presets, split-screen, element-based capture by CSS selector, and text-based area capture. Integrates with Telegram or any output channel for delivery.
Workflow Automation
492cosmicstack-labs/mercury-agent-skills
Master workflow design, n8n patterns, automation triggers, error handling, and monitoring for reliable business process automation
Browse the most popular Claude skills, all productivity & notes skills, or write your own with the skills generator.