pluginagentmarketplace/custom-plugin-bash-shell · Archived

shell-automation

Production-grade shell automation - scripts, CI/CD, makefiles

First seen Jun 7, 2026

Installation

$ npx skills add pluginagentmarketplace/custom-plugin-bash-shell --skill shell-automation

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from pluginagentmarketplace/custom-plugin-bash-shell.

npx skills add pluginagentmarketplace/custom-plugin-bash-shell

Browse all from pluginagentmarketplace/custom-plugin-bash-shell

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
License LICENSE
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version2.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,496 B
  • docs SUMMARY.md 85 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Shell Automation Skill

Master shell automation, CI/CD, and deployment scripting

Learning Objectives

After completing this skill, you will be able to:

  • Write production-grade automation scripts
  • Create effective Makefiles
  • Set up CI/CD pipelines
  • Build deployment scripts
  • Test shell scripts with bats

Prerequisites

  • Strong Bash fundamentals
  • Git basics
  • Understanding of CI/CD concepts

Core Concepts

1. Script Template

#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"

log_info()  { printf '[INFO] %s\n' "$*" >&2; }
log_error() { printf '[ERROR] %s\n' "$*" >&2; }
die()       { log_error "$1"; exit "${2:-1}"; }

usage() {
    cat <<EOF
Usage: $SCRIPT_NAME [options] <argument>
Options:
    -h, --help      Show this help
    -v, --verbose   Enable verbose
EOF
}

main() {
    while [[ $# -gt 0 ]]; do
        case "$1" in
            -h|--help) usage; exit 0 ;;
            *) break ;;
        esac
    done
    log_info "Starting..."
}

main "$@"

2. Makefile Pattern

.PHONY: all build test lint clean help

SHELL := /bin/bash
.DEFAULT_GOAL := help

help: ## Show help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
		awk 'BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'

build: ## Build project
	./scripts/build.sh

test: ## Run tests
	bats tests/

lint: ## Run linter
	shellcheck scripts/*.sh

clean: ## Clean artifacts
	rm -rf dist/ build/

3. GitHub Actions

name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Lint
        run: shellcheck **/*.sh
      - name: Test
        run: bats tests/

4. Bats Testing

#!/usr/bin/env bats

setup() {
    source "./functions.sh"
    TEST_DIR="$(mktemp -d)"
}

teardown() {
    rm -rf "$TEST_DIR"
}

@test "function returns success" {
    run my_function "arg"
    [ "$status" -eq 0 ]
}

@test "output contains expected" {
    run my_function "arg"
    [[ "$output" == *"expected"* ]]
}

Common Patterns

Deployment Script

#!/usr/bin/env bash
set -euo pipefail

deploy() {
    local version="${1:-$(git describe --tags)}"

    log_info "Deploying $version"

    # Pre-flight checks
    preflight_check

    # Create backup
    create_backup

    # Deploy
    rsync -avz --delete dist/ /opt/app/

    # Restart service
    systemctl restart app

    log_info "Deployed $version"
}

rollback() {
    local previous
    previous=$(ls -t /opt/backups | head -1)
    log_info "Rolling back to $previous"
    rsync -avz "/opt/backups/$previous/" /opt/app/
    systemctl restart app
}

Retry Pattern

retry() {
    local max="${1:-3}"
    local delay="${2:-1}"
    shift 2

    for ((i=1; i<=max; i++)); do
        if "$@"; then
            return 0
        fi
        log_info "Retry $i/$max in ${delay}s..."
        sleep "$delay"
        delay=$((delay * 2))
    done
    return 1
}

# Usage
retry 5 2 curl -sf https://api.example.com

Anti-Patterns

Don't Do Why
Skip ShellCheck Always lint Catch bugs
No error handling Use set -e Fail early
Hardcode paths Use variables Flexibility
Skip tests Write bats tests Reliability

Practice Exercises

  1. Deploy Script: Zero-downtime deployment
  2. Backup System: Automated backups with rotation
  3. CI Pipeline: Complete GitHub Actions workflow
  4. Test Suite: Comprehensive bats tests

Troubleshooting

Common Errors

Error Cause Fix
Script not running Not executable chmod +x
Command not found PATH issue Use full path
Syntax error Missing quotes ShellCheck

Debug Techniques

# Enable trace
set -x

# Run with debug
bash -x script.sh

# ShellCheck
shellcheck script.sh

Resources