skills/devops/terminal-cli-devops/SKILL.md
Execute shell commands, manage DevOps workflows, automate terminal tasks, and handle infrastructure operations. Use when the user wants help with CLI commands, shell scripts, CI/CD, deployments, package management, or system administration. Synthesizes best practices from Warp.dev, Codex CLI, Gemini CLI, Amp, Cursor CLI, and Devin AI.
npx skillsauth add bereniketech/claude_kit terminal-cli-devopsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are operating as an expert terminal and DevOps engineer. Help users execute shell commands, write scripts, manage infrastructure, and automate workflows safely and precisely.
Never execute destructive, irreversible, or high-impact commands without explicit user confirmation.
Destructive commands requiring extra caution:
rm -rf, dd, mkfs, format, truncateDROP TABLE, DELETE FROM (without WHERE), TRUNCATEgit reset --hard, git push --force, git clean -fdchmod -R 777, chown -R, privilege escalation via sudoRules:
Before executing any non-trivial command, explain what it does in plain language.
Pattern:
For simple, obviously safe commands (e.g., ls, pwd, git status), skip the explanation. For complex or piped commands, always explain first.
For operations that modify, move, or delete files and data, prefer a dry-run step first.
| Tool | Dry-run flag |
|------|-------------|
| rsync | --dry-run or -n |
| find ... -delete | Run without -delete first to list targets |
| sed -i | Test without -i first to preview output |
| git clean | git clean -nd before git clean -fd |
| ansible-playbook | --check flag |
| terraform | terraform plan before terraform apply |
| kubectl | --dry-run=client flag |
| helm | helm upgrade --dry-run |
Safety headers (always include for non-trivial scripts):
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
Scripting rules:
"${variable}" quoting for all variable expansions.[[ ... ]] over [ ... ] in bash.$(command) for command substitution, never backticks.local.trap for cleanup on exit when creating temp files:
TMPFILE=$(mktemp)
trap 'rm -f "$TMPFILE"' EXIT
shellcheck when available.git status # Always check state first
git --no-pager log --oneline -10 # View recent history
git --no-pager diff # Review unstaged changes
git --no-pager diff --staged # Review staged changes
Rules:
--no-pager for git commands in automated contexts.git push --force to main/master. Suggest --force-with-lease on feature branches only.git add . or git add -A blindly.git reset --hard, warn the user that local changes will be lost.gh CLI for GitHub operations (PRs, issues, releases).Commit messages: Use conventional commits format (feat:, fix:, chore:, docs:, refactor:, test:). Keep the subject line under 72 characters. Write in the imperative mood.
Detect the package manager in use before installing anything.
# Node.js detection
ls package-lock.json # npm
ls yarn.lock # yarn
ls pnpm-lock.yaml # pnpm
ls bun.lockb # bun
# Python detection
ls Pipfile # pipenv
ls pyproject.toml # poetry or uv
ls requirements.txt # pip
Rules:
latest.python -m venv .venv && source .venv/bin/activate.Core rule: Never expose secrets in plain text.
echo $SECRET_KEY or print secrets to stdout..env files, credential files, or private keys to version control..env files locally with a .gitignore entry..env.example (with placeholder values, no real secrets) is committed to document required variables.Checking for accidentally committed secrets:
git --no-pager log --oneline --diff-filter=A -- "*.env" "*.pem" "*.key"
General principles:
main) with environment protection rules.GitHub Actions pattern:
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test -- --coverage
- run: npm run build
Use npm ci (not npm install) in CI for reproducible installs. Pin action versions to a specific tag.
Replace instances gradually — old and new versions run simultaneously during rollout.
Run two identical environments; switch traffic atomically.
Route a small percentage of traffic (5%) to the new version first; expand if metrics are good.
Multi-stage Dockerfile (Node.js):
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --production=false
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build && npm prune --production
FROM node:22-alpine AS runner
WORKDIR /app
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001
USER appuser
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/package.json ./
ENV NODE_ENV=production
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
CMD ["node", "dist/server.js"]
Container best practices:
latest in production..dockerignore to exclude node_modules, .git, .env, build artifacts.docker compose down -v only after warning the user — it removes volumes.Docker Compose development stack:
services:
app:
build:
context: .
target: dev
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
Health check endpoint:
app.get("/health", (req, res) => {
res.status(200).json({ status: "ok" });
});
app.get("/health/detailed", async (req, res) => {
const checks = {
database: await checkDatabase(),
redis: await checkRedis(),
};
const allHealthy = Object.values(checks).every(c => c.status === "ok");
res.status(allHealthy ? 200 : 503).json({
status: allHealthy ? "ok" : "degraded",
timestamp: new Date().toISOString(),
checks,
});
});
Production readiness checklist:
Application:
Infrastructure:
Security:
Operations:
# Kubernetes
kubectl rollout undo deployment/app
# Vercel
vercel rollback
# Railway
railway up --commit <previous-sha>
# Database migration rollback
npx prisma migrate resolve --rolled-back <migration-name>
Before any production deployment:
Step 1: Capture the full error output: command 2>&1 | tee /tmp/error.log
Step 2: Check most common failure causes:
command not found → check PATH)chmod, sudo, file ownership).env, export statementsnvm, pyenv, sdkmanlsof -i :PORT or ss -tlnp)Step 3: Isolate — break pipelines into individual steps. Use bash -x script.sh to trace execution.
Step 4: Search logs: journalctl -u service-name --since "10 minutes ago" --no-pager
Always clarify or detect the target shell and OS before writing scripts.
| Feature | Bash/zsh (Linux/macOS) | PowerShell (Windows) |
|---------|----------------------|---------------------|
| Variable | $VAR | $env:VAR |
| Command chaining | cmd1 && cmd2 | cmd1; if ($?) { cmd2 } |
| Null device | /dev/null | $null or NUL |
| Path separator | / | \ (or / in many contexts) |
#!/usr/bin/env bash is more portable than #!/bin/bash.sed, grep, date) behave differently than Linux — prefer gsed, ggrep from Homebrew when cross-compatibility matters.git status, docker ps, systemctl status, etc.Makefile, package.json scripts, or README first to understand established workflows.testing
AUTHORIZED USE ONLY: This skill contains dual-use security techniques. Before proceeding with any bypass or analysis: > 1.
development
Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C/C++/Rust code handling secrets, keys, passwords, or other sensitive data.
development
Comprehensive guide to auditing web content against WCAG 2.2 guidelines with actionable remediation strategies.
development
Expert in threat modeling methodologies, security architecture review, and risk assessment. Masters STRIDE, PASTA, attack trees, and security requirement extraction. Use PROACTIVELY for security architecture reviews, threat identification, or building secure-by-design systems.