Automating Repetitive Tasks
Developers are supposed to be good at automation, but we're often terrible at automating our own work. We'll spend an hour doing something manually that could be scripted in 20 minutes because "it's faster this time."
Except it's never just this time. The same task comes back next week, next month, forever. Here's how we've gotten better at recognizing what to automate and actually doing it.
The Rule of Three
Our automation trigger: if you do something manually three times, it gets automated. Not after five times. Not "eventually." Three times, then it's script time.
This threshold is low enough to catch things before they waste too much time, but high enough to avoid automating stuff that only happens once.
What We've Automated
Project Setup
Starting a new project used to take half a day. Create repo, set up CI/CD, configure linting, add our preferred libraries, create the folder structure. Now it takes 5 minutes.
We have template repos for different project types. Run one command, answer a few questions, and everything's configured. ESLint, Prettier, TypeScript, testing setup, GitHub Actions, deployment config. All ready to go.
Tools that help:
- GitHub template repos - Clone a pre-configured starting point
- create-t3-app - If you're in the Next.js/tRPC world
- Custom CLI scripts - For our specific preferences
Code Formatting and Linting
We don't manually format code. Ever. Prettier runs on save and on commit. ESLint catches problems before they hit the PR.
This isn't about saving time. It's about removing decisions. Nobody argues about semicolons or tabs vs spaces because the tools decide. The code looks the same no matter who wrote it.
Our setup:
- Prettier - Format on save in VS Code
- ESLint - Strict config that catches real bugs
- Husky + lint-staged - Run checks before every commit
Testing and Deployment
Manual testing and deployment is asking for mistakes. We automate it:
- Push to a branch → tests run automatically
- Open a PR → preview deployment created
- Merge to main → production deployment
GitHub Actions handles most of this. The YAML is annoying to write, but you only write it once. Then every deploy is consistent and documented.
Database Migrations
Database changes used to be scary. Now we run:
npx prisma migrate dev
Changes are versioned, reversible, and applied the same way in every environment. No more "works on my machine" database issues.
Repetitive Code
Some code is just boilerplate. Creating a new API endpoint, adding a new component, setting up a new page. We use code generators:
- Plop - Generate files from templates with a CLI
- VS Code snippets - Type a shortcut, get a component skeleton
- Hygen - More powerful code generation
A 30-line component template saves 5 minutes per component. Do that 100 times and you've saved a day.
Automation Tools We Use
npm Scripts
Package.json scripts are underrated. Complex commands become:
npm run dev
npm run test
npm run deploy
Anyone joining the project knows exactly how to run things without reading documentation.
Make and Shell Scripts
For anything beyond npm scripts, we use shell scripts or Makefiles. Yes, Make is old. It also works everywhere and is surprisingly good at orchestrating tasks.
Common uses:
- Setting up local development environment
- Running multiple services together
- Database backup and restore
- Deployment to specific environments
GitHub Actions
Anything that should happen automatically when code changes. Tests, deployments, notifications, dependency updates. The free tier is generous enough for most projects.
We have reusable workflows that we copy between repos. Write once, use everywhere.
Zapier and Make (formerly Integromat)
For non-code automation. When a new client signs up, create a Slack channel and Notion page. When an invoice is paid, update the spreadsheet. These tools connect services that don't have native integrations.
What Not to Automate
Not everything should be automated:
- One-time tasks - If you'll genuinely never do it again, just do it manually.
- Tasks that require judgment - Code review, design decisions, user communication.
- Complex edge cases - Sometimes manual handling is safer than trying to account for every possibility.
The goal isn't to automate everything. It's to automate the boring, repetitive stuff so you have more time for the interesting work.
Starting Small
If you're not automating much yet, start with:
- Code formatting - Prettier on save. Takes 5 minutes to set up.
- One npm script - Whatever command you type most often.
- VS Code snippets - For your most common boilerplate.
Once you feel the benefit, you'll naturally look for more things to automate.
The Investment Mindset
Automation is an investment. You spend time now to save time later. The math isn't always obvious, but consider:
- How often do you do this task?
- How long does it take manually?
- How long would automation take?
- Will it prevent mistakes?
A 30-minute automation that saves 5 minutes per week pays off in 6 weeks. After that, it's pure profit.
But don't only think about time. Automated processes are consistent. They don't forget steps. They don't make typos. They don't get tired on Friday afternoon. That reliability is worth something too.
Documentation
Automated processes need documentation. Not novels, just enough that someone else can understand and modify them.
For scripts, a comment at the top explaining what it does and how to run it is usually enough. For complex workflows, a README in the same directory.
Your future self will thank you when the script breaks and you need to fix it.