Claude
Skills
Sign in
Back

devops-tooling

Included with Lifetime
$97 forever

Git operations, shell scripting, CI/CD pipelines, and terminal automation. Use for conventional commits, PowerShell/Bash scripting, configuring GitHub Actions, or automating development tooling workflows.

Cloud & DevOpsdevopstoolingworkflowqualityplanningscripts

What this skill does


# Devops Tooling

Comprehensive toolkit for Git workflows, shell scripting, and development automation.

- Leverage native parallel subagent dispatch and 200k+ context windows where available.


## When to Use This Skill

Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.

- Creating conventional commits and managing Git workflows
- Writing Bash, Zsh, or PowerShell automation scripts
- Configuring CI/CD pipelines (GitHub Actions, Azure DevOps)
- Automating development, testing, or deployment tasks
- Troubleshooting Git conflicts and repository hygiene issues

## Part 1: Git Workflows

### Conventional Commits

The conventional commit specification provides an easy-to-extend set of rules for creating an explicit commit history.

#### Commit Format

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

#### Types

| Type | Purpose | Example |
|-------|---------|---------|
| `feat` | New feature | `feat(auth): add OAuth2 support` |
| `fix` | Bug fix | `fix(api): resolve null reference` |
| `docs` | Documentation only | `docs(readme): update setup guide` |
| `style` | Formatting/style (no logic) | `style(ui): fix indentation` |
| `refactor` | Refactor production code | `refactor(svc): extract helpers` |
| `perf` | Performance improvement | `perf(db): add index on email` |
| `test` | Adding tests | `test(auth): add unit tests` |
| `build` | Build system or deps | `build(ci): upgrade Node to v20` |
| `ci` | CI configuration changes | `ci(github): add workflow for PRs` |
| `chore` | Maintenance tasks | `chore(deps): update packages` |
| `revert` | Revert previous commit | `revert: feat(login)` |

#### Breaking Changes

Breaking changes must be indicated by `!` after the type/scope, or via `BREAKING CHANGE` in footer:

```bash


feat(api)!: remove deprecated v1 endpoint


feat(api): remove deprecated v1 endpoint

BREAKING CHANGE: v1 endpoints are no longer supported. Use v2.
```

#### Good Examples

```bash


feat(auth): implement JWT refresh tokens


fix(ui): resolve mobile navigation overlap issue


docs(api): add authentication examples


refactor(user): extract validation logic to separate module


perf(images): implement lazy loading


feat(core)!: change data structure from array to object
```

### Git Operations

#### Branch Management

```bash


git checkout -b feature/PROJ-123/user-auth


git checkout develop


git branch -d feature/PROJ-123/user-auth


git push origin --delete feature/PROJ-123/user-auth


git branch -m new-name


git branch -a
```

#### Commit Workflow

```bash


git add .


git add file1.ts file2.ts


git add -i


git commit -m "feat(auth): add OAuth2 support"


git commit --amend


git log --oneline --graph --all


git show <commit-hash>
```

#### Merge & Rebase

```bash


git merge feature/new-feature


git rebase develop


git rebase -i HEAD~3


git rebase --abort
git merge --abort


git rebase --continue
git merge --continue
```

#### Handling Conflicts

```bash


git status


vim conflicting-file.ts


git add conflicting-file.ts


git commit  # for merges
git rebase --continue  # for rebases
```

#### Stashing

```bash


git stash push -m "Work in progress"


git stash pop


git stash apply stash@{2}


git stash list


git stash drop stash@{2}


git stash clear
```

#### Tagging

```bash


git tag -a v1.0.0 -m "Release v1.0.0"


git tag v1.0.0


git tag


git push origin --tags


git push origin v1.0.0


git tag -d v1.0.0


git push origin --delete v1.0.0
```

#### Git Diff

```bash


git diff


git diff --staged


git diff src/app.ts


git diff HEAD~2 HEAD


git log --oneline v1.0.0..v2.0.0


git diff --stat
```

#### Git Configuration

```bash


git config --global user.name "Your Name"
git config --global user.email "[email protected]"


git config --global init.defaultBranch main


git config --global commit.gpgsign true


git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status


git config --unset user.name


git config --list
```

---

## Part 2: Shell Scripting (bash/zsh)

### General Principles

- Generate clean, simple, and concise code
- Ensure scripts are easily readable and understandable
- Add comments where needed for understanding
- Generate concise echo outputs for execution status
- Avoid unnecessary output and excessive logging

### Error Handling & Safety

#### Enable Strict Mode

Always enable strict mode at the top of scripts:

```bash
#!/bin/bash
set -euo pipefail
```

- `-e`: Exit on first error
- `-u`: Treat unset variables as errors
- `-o pipefail`: Surface pipeline failures

#### Cleanup with Traps

```bash
cleanup() {
    # Remove temporary files
    if [[ -n "${TEMP_DIR:-}" && -d "$TEMP_DIR" ]]; then
        rm -rf "$TEMP_DIR"
    fi

    # Close connections
    if [[ -n "${CONNECTION:-}" ]]; then
        echo "Closing connection..."
        # connection close logic
    fi
}

trap cleanup EXIT


trap 'echo "Interrupted"; cleanup; exit 1' INT TERM
```

#### Validate Requirements

```bash
validate_requirements() {
    local errors=0

    # Check required variables
    if [[ -z "${RESOURCE_GROUP:-}" ]]; then
        echo "Error: RESOURCE_GROUP environment variable not set" >&2
        ((errors++))
    fi

    # Check required commands
    for cmd in curl jq az; do
        if ! command -v "$cmd" &> /dev/null; then
            echo "Error: $cmd is not installed" >&2
            ((errors++))
        fi
    done

    # Return appropriate exit code
    return $errors
}


if ! validate_requirements; then
    exit 1
fi
```

### Working with Variables

```bash


echo "Config: ${CONFIG_FILE:-./config.default.yaml}"


name="World"
echo "Hello, ${name}!"


apps=("app1" "app2" "app3")
for app in "${apps[@]}"; do
    echo "Processing: $app"
done


declare -A config
config[host]="localhost"
config[port]="8080"
echo "Connecting to ${config[host]}:${config[port]}"
```

### Control Flow

```bash


if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    echo "Linux detected"
elif [[ "$OSTYPE" == "darwin"* ]]; then
    echo "macOS detected"
else
    echo "Unknown OS"
fi


case "$1" in
    start)
        echo "Starting service..."
        ;;
    stop)
        echo "Stopping service..."
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac


for i in {1..5}; do
    echo "Iteration $i"
done


timeout=30
elapsed=0
while [[ $elapsed -lt $timeout ]]; do
    if check_ready; then
        echo "Service ready"
        break
    fi
    sleep 1
    ((elapsed++))
done
```

### Parsing JSON with jq

```bash


result=$(curl -s "https://api.example.com/data")
name=$(echo "$result" | jq -r '.name')
count=$(echo "$result" | jq '.items | length')
first_item=$(echo "$result" | jq -r '.items[0]')


active_users=$(echo "$result" | jq '.users[] | select(.status == "active")')


read -r first_name last_name email <<<$(echo "$result" | jq -r '"\(.firstName) \(.lastName) \(.email)"')


echo "$result" | jq '.count += 1' > updated.json


jq -n \
  --arg name "John" \
  --arg age "30" \
  '{name: $name, age: ($age | tonumber)}'
```

### Parsing Arguments

```bash
#!/bin/bash


verbose=0
output_file="output.txt"
config="./config.yaml"


while [[ $# -gt 0 ]]; do
    case $1 in
        -v|--verbose)
            verbose=1
            shift
            ;;
        -o|--output)
            output_file="$2"
            shift 2
            ;;
        -c|--config)
            config="$2"
            shift 2
            ;;
        -h|--help)
            show_help
            exit 0
            ;;
        *)
            echo "Unknown option: $1" >&2
            exit 1
            ;;
    esac
done

echo "Config: $config"
echo "Output: $output_file"
echo "Verbose: $verbose"
```

### File Operations

```bash


if [[ -f "$FILE_PATH" ]]; then
    echo "File exists"
fi


if [[ ! -d "$DIR_PATH" ]]; then
    mkdir -p "$DIR_PATH"
fi


mkdir -p ./dir1/dir2


cp -r source_dir/ d
Files: 7
Size: 73.3 KB
Complexity: 69/100
Category: Cloud & DevOps

Related in Cloud & DevOps