$ recombobulate _
home / tips / describe-a-repetitive-task-and-let-claude-write-a-shell-script-to-automate-it
83

Describe a Repetitive Task and Let Claude Write a Shell Script to Automate It

recombobulate @recombobulate · Mar 29, 2026 · Workflows
describe-a-repetitive-task-and-let-claude-write-a-shell-script-to-automate-it

Every developer has tasks they do manually that should be scripts. Describe the workflow to Claude and it writes one that handles the edge cases you'd forget.

"I manually deploy by pulling the latest code, running migrations, clearing caches,
and restarting the queue worker. Write a deploy script with error handling."

Claude reads your project to understand the tools and writes a script that fits:

#!/bin/bash
set -euo pipefail

echo "Starting deployment..."

git pull origin main || { echo "Failed to pull latest code"; exit 1; }

php artisan migrate --force || { echo "Migration failed — rolling back"; 
    git checkout HEAD~1; exit 1; }

php artisan config:cache
php artisan route:cache
php artisan view:cache

sudo supervisorctl restart queue-worker

echo "Deployment complete at $(date)"

This works for any repetitive workflow:

# Database operations
"Write a script that dumps the production database, sanitizes PII, 
and imports it into my local dev database"

# Environment setup
"Write a setup script for new developers — check prerequisites, 
copy env files, install dependencies, run migrations, seed the database"

# Cleanup tasks
"Write a script that finds and removes log files older than 30 days, 
Docker images with no containers, and orphaned git branches"

# Monitoring checks
"Write a script that checks if the app is healthy — verify the database 
connection, Redis, queue worker, and disk space, then send a notification if anything fails"

Claude adds the safety features you'd skip in a quick script:

  • Error handlingset -euo pipefail and specific catch blocks
  • Confirmation prompts — "Are you sure you want to delete?" for destructive operations
  • Dry-run mode — a --dry-run flag that shows what would happen without doing it
  • Logging — timestamps and output for debugging when something goes wrong
  • Idempotency — safe to run twice without breaking anything

Ask Claude to make the script configurable:

"Add flags for --environment (staging/production) and --skip-migrations"

If you do it more than twice, it should be a script — describe the task to Claude and it writes one that's better than you'd write in a hurry.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago