scripting
DevOps scripting with Bash, Python, and Go for automation, tooling, and infrastructure management
Packaged view
This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.
Install command
npx @skill-hub/cli install benchflow-ai-skillsbench-scripting
Repository
Skill path: registry/terminal_bench_2.0/full_batch_reviewed/terminal_bench_2_0_openssl-selfsigned-cert/environment/skills/scripting
DevOps scripting with Bash, Python, and Go for automation, tooling, and infrastructure management
Open repositoryBest for
Primary workflow: Run DevOps.
Technical facets: Full Stack, DevOps.
Target audience: everyone.
License: Unknown.
Original source
Catalog source: SkillHub Club.
Repository owner: benchflow-ai.
This is still a mirrored public skill entry. Review the repository before installing into production workflows.
What it helps with
- Install scripting into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
- Review https://github.com/benchflow-ai/SkillsBench before adding scripting to shared team environments
- Use scripting for development workflows
Works across
Favorites: 0.
Sub-skills: 0.
Aggregator: No.
Original source / Raw SKILL.md
---
name: scripting
description: DevOps scripting with Bash, Python, and Go for automation, tooling, and infrastructure management
sasmp_version: "1.3.0"
bonded_agent: 01-devops-fundamentals
bond_type: PRIMARY_BOND
---
# Scripting Skill
## MANDATORY
- Bash scripting fundamentals
- Python for DevOps automation
- Command-line argument parsing
- Error handling and logging
- File and process manipulation
## OPTIONAL
- Go for CLI tools
- PowerShell for Windows
- Regular expressions
- API interactions
- Configuration file parsing
## ADVANCED
- Building CLI tools
- Cross-platform scripting
- Performance optimization
- Testing automation scripts
- Packaging and distribution
## Assets
- See `assets/scripting-patterns.yaml` for script templates
---
## Referenced Files
> The following files are referenced in this skill and included for context.
### assets/scripting-patterns.yaml
```yaml
# DevOps Scripting Patterns
# Bash, Python, and Go templates
bash_patterns:
script_template: |
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# Script configuration
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
# Logging functions
log_info() { echo "[INFO] $(date '+%Y-%m-%d %H:%M:%S') $*"; }
log_error() { echo "[ERROR] $(date '+%Y-%m-%d %H:%M:%S') $*" >&2; }
log_warn() { echo "[WARN] $(date '+%Y-%m-%d %H:%M:%S') $*"; }
# Cleanup function
cleanup() {
local exit_code=$?
# Add cleanup tasks here
exit $exit_code
}
trap cleanup EXIT
# Usage function
usage() {
cat <<EOF
Usage: $SCRIPT_NAME [OPTIONS]
Options:
-h, --help Show this help message
-v, --verbose Enable verbose output
-e, --env Environment (dev|staging|prod)
Examples:
$SCRIPT_NAME --env prod
EOF
exit 0
}
# Parse arguments
parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help) usage ;;
-v|--verbose) VERBOSE=true; shift ;;
-e|--env) ENV="$2"; shift 2 ;;
*) log_error "Unknown option: $1"; exit 1 ;;
esac
done
}
# Main function
main() {
parse_args "$@"
log_info "Starting script..."
# Main logic here
log_info "Script completed successfully"
}
main "$@"
common_operations:
file_operations: |
# Check if file exists
[[ -f "$file" ]] && echo "File exists"
# Read file line by line
while IFS= read -r line; do
echo "$line"
done < "$file"
# Find and process files
find . -name "*.log" -mtime +7 -exec rm {} \;
string_operations: |
# String substitution
new_string="${original//old/new}"
# String length
length=${#string}
# Substring
substring="${string:0:10}"
array_operations: |
# Define array
declare -a servers=("server1" "server2" "server3")
# Iterate
for server in "${servers[@]}"; do
echo "Processing $server"
done
# Array length
echo "Count: ${#servers[@]}"
python_patterns:
cli_template: |
#!/usr/bin/env python3
"""DevOps automation script."""
import argparse
import logging
import sys
from pathlib import Path
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def parse_args():
"""Parse command line arguments."""
parser = argparse.ArgumentParser(
description='DevOps automation script'
)
parser.add_argument(
'-e', '--env',
choices=['dev', 'staging', 'prod'],
required=True,
help='Target environment'
)
parser.add_argument(
'-v', '--verbose',
action='store_true',
help='Enable verbose output'
)
return parser.parse_args()
def main():
"""Main entry point."""
args = parse_args()
if args.verbose:
logging.getLogger().setLevel(logging.DEBUG)
logger.info(f'Starting deployment to {args.env}')
try:
# Main logic here
deploy(args.env)
logger.info('Deployment completed successfully')
except Exception as e:
logger.error(f'Deployment failed: {e}')
sys.exit(1)
def deploy(env: str):
"""Deploy to specified environment."""
logger.info(f'Deploying to {env}...')
# Deployment logic
if __name__ == '__main__':
main()
api_client: |
import requests
from typing import Dict, Any
class APIClient:
def __init__(self, base_url: str, token: str):
self.base_url = base_url
self.session = requests.Session()
self.session.headers.update({
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
})
def get(self, endpoint: str) -> Dict[str, Any]:
response = self.session.get(f'{self.base_url}{endpoint}')
response.raise_for_status()
return response.json()
def post(self, endpoint: str, data: Dict) -> Dict[str, Any]:
response = self.session.post(
f'{self.base_url}{endpoint}',
json=data
)
response.raise_for_status()
return response.json()
kubernetes_client: |
from kubernetes import client, config
def get_pods(namespace: str = 'default'):
"""Get pods in namespace."""
config.load_kube_config()
v1 = client.CoreV1Api()
pods = v1.list_namespaced_pod(namespace)
return [
{
'name': pod.metadata.name,
'status': pod.status.phase,
'ip': pod.status.pod_ip
}
for pod in pods.items
]
go_patterns:
cli_template: |
package main
import (
"flag"
"fmt"
"log"
"os"
)
var (
env = flag.String("env", "dev", "Target environment")
verbose = flag.Bool("verbose", false, "Verbose output")
)
func main() {
flag.Parse()
log.SetFlags(log.LstdFlags | log.Lshortfile)
if *verbose {
log.Println("Verbose mode enabled")
}
log.Printf("Deploying to %s environment\n", *env)
if err := deploy(*env); err != nil {
log.Fatalf("Deployment failed: %v", err)
}
log.Println("Deployment completed successfully")
}
func deploy(env string) error {
// Deployment logic
fmt.Printf("Deploying to %s...\n", env)
return nil
}
best_practices:
general:
- "Use shebang for interpreter"
- "Set strict error handling"
- "Include help/usage information"
- "Log important operations"
- "Handle errors gracefully"
bash:
- "Use shellcheck for linting"
- "Quote variables properly"
- "Use functions for organization"
- "Avoid parsing ls output"
python:
- "Use type hints"
- "Follow PEP 8 style"
- "Use virtual environments"
- "Handle exceptions properly"
testing:
- "Unit test critical functions"
- "Use integration tests"
- "Test error conditions"
- "Mock external services"
```