ancoleman/ai-design-components/shell-scripting
Claude Code and agent skill by ancoleman/ai-design-components
- community
Checking that the SKILL.md file is still in the repository.
Write robust, portable shell scripts with proper error handling, argument parsing, and testing. Use when automating system tasks, building CI/CD scripts, or creating container entrypoints.
Install
npx vskill@latest install ancoleman/ai-design-components/shell-scriptingSKILL.md
Shell Scripting
Purpose
Provides patterns and best practices for writing maintainable shell scripts with error handling, argument parsing, and portability considerations. Covers POSIX sh vs Bash decision-making, parameter expansion, integration with common utilities (jq, yq, awk), and testing with ShellCheck and Bats.
When to Use This Skill
Use shell scripting when:
- Orchestrating existing command-line tools and system utilities
- Writing CI/CD pipeline scripts (GitHub Actions, GitLab CI)
- Creating container entrypoints and initialization scripts
- Automating system administration tasks (backups, log rotation)
- Building development tooling (build scripts, test runners)
Consider Python/Go instead when:
- Complex business logic or data structures required
- Cross-platform GUI needed
- Heavy API integration (REST, gRPC)
- Script exceeds 200 lines with significant logic complexity
POSIX sh vs Bash
Use POSIX sh (#!/bin/sh) when:
- Maximum portability required (Linux, macOS, BSD, Alpine)
- Minimal container images needed
- Embedded systems or unknown target environments
Use Bash (#!/bin/bash) when:
- Controlled environment (specific OS, container)
- Arrays or associative arrays needed
- Advanced parameter expansion beneficial
- Process substitution
<(cmd)useful
For detailed comparison and testing strategies, see references/portability-guide.md.
Essential Error Handling
Fail-Fast Pattern
Use for production automation, CI/CD scripts, and critical operations.
Explicit Exit Code Checking
Use for custom error messages and interactive scripts.
Trap Handlers for Cleanup
Use for guaranteed cleanup of temporary files, locks, and resources.
For comprehensive error patterns, see references/error-handling.md.
Argument Parsing
Short Options with getopts (POSIX)
Long Options (Manual Parsing)
For hybrid approaches and validation patterns, see references/argument-parsing.md.
Parameter Expansion Quick Reference
For complete expansion patterns and array handling, see references/parameter-expansion.md.
Common Utilities Integration
JSON with jq
YAML with yq
Text Processing
For detailed examples and best practices, see references/common-utilities.md.
Testing and Validation
ShellCheck: Static Analysis
Bats: Automated Testing
Run tests:
For CI/CD integration and debugging techniques, see references/testing-guide.md.
Defensive Programming Checklist
Platform Considerations
macOS vs Linux Differences
For complete platform differences, see references/portability-guide.md.
Script Categories
System Administration: Cron jobs, log rotation, backup automation Build/Deployment: CI/CD pipelines, Docker builds, deployments Development Tooling: Project setup, test runners, code generators Container Entrypoints: Initialization, signal handling, configuration
Production Script Template
For complete production template, see examples/production-template.sh.
Tool Recommendations
Core Tools:
- jq: JSON parsing and transformation
- yq: YAML parsing (v4 recommended)
- ShellCheck: Static analysis and linting
- Bats: Automated testing framework
Installation:
Related Skills
- linux-administration: System commands and administration
- building-ci-pipelines: Using scripts in CI/CD
- infrastructure-as-code: Terraform/Pulumi wrappers
- kubernetes-operations: kubectl scripts, Helm hooks
- writing-dockerfiles: Container entrypoints
Additional Resources
Reference Files:
references/error-handling.md- Comprehensive error patternsreferences/argument-parsing.md- Advanced parsing techniquesreferences/parameter-expansion.md- Complete expansion referencereferences/portability-guide.md- POSIX vs Bash differencesreferences/testing-guide.md- ShellCheck and Bats guidereferences/common-utilities.md- jq, yq, awk, sed usage
Example Scripts:
examples/production-template.sh- Production-ready templateexamples/getopts-basic.sh- Simple getopts usageexamples/getopts-advanced.sh- Complex option handlingexamples/long-options.sh- Manual long option parsingexamples/error-handling.sh- Error handling patternsexamples/json-yaml-processing.sh- jq/yq examples
Utility Scripts:
scripts/lint-script.sh- ShellCheck wrapper for CIscripts/test-script.sh- Bats wrapper for CI
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/shell-scripting/SKILL.md
Popularity
- Repository stars
- 521
- Repository forks
- 73
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 8 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ancoleman/ai-design-components/shell-scripting)