Skill

Automate OS Scripting and Troubleshooting

7-phase OS/shell scripting workflow bundle: environment assessment, ShellCheck, debugging, script development, Bats testing, and automation.


78
Spark score
out of 100
Updated 16 days ago
Version 14.4.0

Add to Favorites

Why it matters

Streamline operating system administration and shell scripting with a comprehensive workflow for troubleshooting, debugging, and automating tasks across Linux, macOS, and Windows.

Outcomes

What it gets done

01

Debug shell script errors and system issues

02

Develop production-ready bash scripts with error handling

03

Automate system administration tasks and process management

04

Test and verify script functionality with automated test suites

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-os-scripting | bash

Overview

OS/Shell Scripting Troubleshooting Workflow Bundle

A 7-phase shell scripting workflow bundle covering environment assessment, ShellCheck linting, debugging, script development, Bats testing, system troubleshooting, and cron/systemd automation. Use for debugging shell scripts, building production-ready bash scripts, troubleshooting system issues, or automating administration tasks.

What it does

OS/Shell Scripting Troubleshooting Workflow Bundle orchestrates skills across seven phases for debugging shell scripts, troubleshooting systems, and automating administration on Linux, macOS, and Windows. Phase 1 (Environment Assessment) invokes bash-linux/bash-pro/bash-defensive-patterns to identify the OS, check tools/permissions, and review logs via diagnostic commands (uname -a, top, ps aux, netstat -tulpn). Phase 2 (Script Analysis) runs shellcheck-configuration for linting (shellcheck script.sh) alongside bats-testing-patterns. Phase 3 (Debugging) uses systematic-debugging/debugger/error-detective with concrete techniques:

### Enable debug mode
set -x  # Print commands
set -e  # Exit on error
set -u  # Exit on undefined variable
set -o pipefail  # Pipeline failure detection

### Add logging
log() {
    echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" >> /var/log/script.log
}

### Trap errors
trap 'echo "Error on line $LINENO"' ERR

### Test sections
bash -n script.sh  # Syntax check
bash -x script.sh  # Trace execution

When to use - and when NOT to

Use it for debugging shell script errors, creating production-ready bash scripts, troubleshooting system issues, or automating administration tasks. Phase 4 (Script Development, via bash-pro/bash-defensive-patterns/linux-shell-scripting) provides a full script template with set -euo pipefail, a leveled log/info/warn/error logging pattern, and a usage()/argument-parsing main() structure. Phase 5 (Testing) writes Bats tests asserting exit status and output content. Phase 6 (System Troubleshooting, via devops-troubleshooter/incident-responder/server-management) covers log inspection (journalctl -xe), network diagnostics (ping, traceroute, dig), process inspection (strace -p PID, lsof -p PID), and disk troubleshooting. Phase 7 (Automation) schedules scripts via cron examples and a systemd timer unit (OnCalendar=daily).

Inputs and outputs

Five named troubleshooting scenarios bundle their own command sets: high CPU usage (ps aux --sort=-%cpu, pidstat), memory issues (free -h, vmstat, /proc/meminfo), disk space (df -h, du -sh /* | sort -h), network issues (ip addr show, ss -tulpn), and service failures (systemctl status, journalctl -u <service> -f, systemctl restart). Each phase includes copy-paste prompts for invoking its named sub-skill directly (e.g. "Use @bash-pro to create a production-ready backup script").

Integrations

Before completing the workflow, a quality-gate checklist requires: all scripts pass ShellCheck, tests pass with Bats, error handling is implemented, logging is configured, documentation is complete, and automation is scheduled. Related workflow bundles cover adjacent domains: development, cloud-devops, security-audit, and database.

Who it's for

System administrators and developers who need an end-to-end, phase-structured process for writing, linting, debugging, testing, and scheduling shell scripts and diagnosing system issues across Linux/macOS/Windows, with concrete diagnostic commands and a quality gate before calling the work done.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.