← スキル一覧に戻る

system-tools
by wsylvest
⭐ 0🍴 0📅 2026年1月16日
SKILL.md
name: system-tools description: CLI toolkit for infrastructure, development, and system administration. Use when Claude needs to execute git operations or GitHub CLI commands, provision AWS/GCP/Azure/DigitalOcean infrastructure, build or debug Docker containers and Kubernetes clusters, connect via SSH or transfer files, query PostgreSQL/MySQL/Redis databases, process JSON with jq or YAML with yq, write shell scripts with error handling, or debug connectivity and performance issues. license: MIT
System Tools & CLI Reference
Overview
This skill provides patterns and best practices for command-line infrastructure management, development workflows, and system administration.
Reference files (load when needed):
references/cli-reference.md- Complete command reference for all toolsreferences/advanced.md- Complex workflows, scripting patterns, automationreferences/troubleshooting.md- Error messages, debugging strategies
Helper scripts in scripts/:
retry.sh- Retry commands with exponential backoffhealth-check.sh- Service health monitoringbackup-postgres.sh- PostgreSQL backup with rotation
Quick Reference
| Domain | Tools | When to Use |
|---|---|---|
| Version Control | git, gh | Code management, PRs, issues |
| Cloud CLIs | aws, gcloud, az, doctl | Infrastructure provisioning |
| Containers | docker, kubectl, helm | Container orchestration |
| Remote Access | ssh, scp, rsync, curl | File transfer, API calls |
| Databases | psql, mysql, redis-cli | Database queries |
| Data Processing | jq, yq, grep, awk | Transform structured data |
Core Workflows
Git & GitHub
# Clone and branch
git clone https://github.com/owner/repo.git && cd repo
git checkout -b feature/new-feature
# Stage, commit, push
git add -p # Interactive staging
git commit -m "type: description"
git push origin feature/new-feature
# Pull request workflow
gh pr create --fill
gh pr list
gh pr checkout 123
gh pr merge 123 --squash --delete-branch
Critical rules:
- Never force push to shared branches (
main,develop) - Use
--force-with-leaseinstead of--force
Docker
# Build and run
docker build -t myapp:v1 .
docker run -d --name web -p 8080:80 nginx
docker run -it --rm ubuntu:22.04 bash
# Inspect and debug
docker ps -a
docker logs -f container_name
docker exec -it container_name bash
# Cleanup
docker system prune -a --volumes
Critical rules:
- Use specific image tags, never
latestin production - Set resource limits in production
Kubernetes
# Context
kubectl config get-contexts
kubectl config use-context my-cluster
# Resources
kubectl get pods -o wide
kubectl describe pod pod-name
kubectl logs -f pod-name
# Apply and scale
kubectl apply -f manifest.yaml
kubectl scale deployment nginx --replicas=3
kubectl rollout undo deployment nginx
# Debug
kubectl get events --sort-by='.lastTimestamp'
kubectl run debug --image=busybox -it --rm -- sh
SSH & File Transfer
# Connect
ssh user@hostname
ssh -i ~/.ssh/mykey.pem user@hostname
# Port forwarding
ssh -L 8080:localhost:80 user@server # Local forward
ssh -J jumphost user@target # Jump through bastion
# File transfer (prefer rsync for large transfers)
rsync -avz --progress ./src/ user@host:/dst/
rsync -avz --delete ./src/ dst/ # Mirror
Database Queries
# PostgreSQL
psql -h localhost -U postgres -d dbname
psql -c "SELECT * FROM users LIMIT 10" -d dbname
pg_dump -Fc dbname > backup.dump
# MySQL
mysql -h localhost -u root -p dbname
# Redis (never use KEYS * in production)
redis-cli
SCAN 0 MATCH "user:*" COUNT 100
Data Processing with jq
# Extract and filter
jq '.users[].name' data.json
jq '.users[] | select(.age > 30)' data.json
# Transform
jq '{name: .full_name, email: .contact.email}' data.json
jq '.items | sort_by(.price) | reverse' data.json
# Raw output
jq -r '.name' data.json
Cloud CLIs
# AWS
aws configure
aws s3 sync ./local s3://bucket/dir
aws ec2 describe-instances --query 'Reservations[].Instances[].{ID:InstanceId,State:State.Name}'
# GCP
gcloud auth login
gcloud config set project PROJECT_ID
gcloud compute instances list
# DigitalOcean
doctl auth init
doctl compute droplet list
Critical rules:
- Never commit credentials to version control
- Use IAM roles/service accounts over static credentials
Helper Scripts Usage
retry.sh - Exponential Backoff
# Retry a flaky command up to 5 times
scripts/retry.sh 5 curl -f https://api.example.com/health
# With custom delays
scripts/retry.sh -d 2 -m 30 -v 3 docker pull nginx:latest
health-check.sh - Service Monitoring
# Run default checks
scripts/health-check.sh
# From config file
scripts/health-check.sh checks.conf
# Config format:
# http:https://api.example.com/health:200
# tcp:localhost:5432
# process:nginx
# disk:/:80
backup-postgres.sh - Database Backup
# Basic backup
scripts/backup-postgres.sh mydb /backups
# With options
scripts/backup-postgres.sh -h db.example.com -U admin -k 30 mydb /backups
Common Patterns
API Testing
curl -X POST https://api.example.com/data \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"key": "value"}' | jq '.'
Log Analysis
# Find errors with context
grep -E "error|exception" app.log | tail -50
# Count by type
grep -oE "Error: [^:]*" app.log | sort | uniq -c | sort -rn
Quick Backup
# PostgreSQL
pg_dump -Fc dbname > backup_$(date +%Y%m%d).dump
# Sync to remote
rsync -avz /data/ backup-server:/backups/
When to Load References
Load references/cli-reference.md when:
- Need complete command options for a specific tool
- Looking up less common flags or features
- Working with tools not covered in quick reference
Load references/advanced.md when:
- Writing shell scripts with error handling
- Setting up CI/CD pipelines
- Implementing infrastructure as code
- Working with multi-cloud environments
- Need security hardening patterns
Load references/troubleshooting.md when:
- Encountering error messages
- Debugging connectivity issues
- Diagnosing performance problems
- Container or Kubernetes pods not starting
Dependencies
Core tools typically pre-installed: git, ssh, curl, grep, awk
Install via apt:
apt install jq postgresql-client mysql-client redis-tools docker.io htop
Cloud CLIs:
# AWS
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install
# GitHub CLI
apt install gh
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です