Skip to content
Back to skills

Repo Automation Scripts

BSecurity

Automated scripts for common repository tasks including setup, cleanup, dependency updates, and maintenance.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
developmentbashreactnodedockertestinggitdatabasedocumentation

Security analysis

B89/100
  • highPerforms destructive filesystem operations
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 2, 2026

npx -y skills add majiayu000/claude-skill-registry --skill repo-automation-scripts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Repo Automation Scripts?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Repo Automation Scripts
[![Security: B β€” Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-repo-automation-scripts/badge)](https://www.skillsdirectory.com/skills/majiayu000-repo-automation-scripts)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Repository Automation Scripts
description: Automated scripts for common repository tasks including setup, cleanup, dependency updates, and maintenance.
---

# Repository Automation Scripts

## Overview

Repository Automation Scripts are helper scripts that automate repetitive tasks, reduce manual errors, and improve developer productivity.

**Core Principle**: "If you do it more than twice, automate it."

---

## 1. Setup Script

```bash
#!/bin/bash
# scripts/setup.sh

set -e  # Exit on error

echo "πŸš€ Setting up development environment..."

# Check prerequisites
check_command() {
  if ! command -v $1 &> /dev/null; then
    echo "❌ $1 is required but not installed."
    exit 1
  fi
}

check_command node
check_command docker
check_command git

# Install dependencies
echo "πŸ“¦ Installing dependencies..."
npm install

# Setup environment
if [ ! -f .env ]; then
  echo "πŸ“ Creating .env from .env.example..."
  cp .env.example .env
fi

# Start Docker services
echo "🐳 Starting Docker services..."
docker-compose up -d

# Wait for database
echo "⏳ Waiting for database..."
sleep 5

# Run migrations
echo "πŸ—„οΈ  Running database migrations..."
npm run db:migrate

# Seed database
echo "🌱 Seeding database..."
npm run db:seed

echo "βœ… Setup complete! Run 'npm run dev' to start"
```

---

## 2. Cleanup Script

```bash
#!/bin/bash
# scripts/cleanup.sh

echo "🧹 Cleaning up development environment..."

# Stop Docker containers
docker-compose down

# Remove node_modules
rm -rf node_modules

# Remove build artifacts
rm -rf .next dist build

# Remove logs
rm -rf logs/*.log

# Remove .env (optional)
read -p "Remove .env file? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
  rm -f .env
fi

echo "βœ… Cleanup complete!"
```

---

## 3. Dependency Update Script

```bash
#!/bin/bash
# scripts/update-deps.sh

echo "πŸ“¦ Updating dependencies..."

# Update package.json
npx npm-check-updates -u

# Install updated dependencies
npm install

# Run tests
npm test

# If tests pass, commit
if [ $? -eq 0 ]; then
  git add package.json package-lock.json
  git commit -m "chore: update dependencies"
  echo "βœ… Dependencies updated and committed"
else
  echo "❌ Tests failed. Please review changes."
  git checkout package.json package-lock.json
fi
```

---

## 4. Database Reset Script

```bash
#!/bin/bash
# scripts/db-reset.sh

echo "πŸ—„οΈ  Resetting database..."

# Confirm action
read -p "This will delete all data. Continue? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
  exit 1
fi

# Reset database
npm run db:reset

# Seed with fresh data
npm run db:seed

echo "βœ… Database reset complete!"
```

---

## 5. Code Generation Script

```bash
#!/bin/bash
# scripts/generate-component.sh

COMPONENT_NAME=$1

if [ -z "$COMPONENT_NAME" ]; then
  echo "Usage: ./scripts/generate-component.sh ComponentName"
  exit 1
fi

COMPONENT_DIR="src/components/$COMPONENT_NAME"

mkdir -p $COMPONENT_DIR

# Create component file
cat > $COMPONENT_DIR/$COMPONENT_NAME.tsx << EOF
import React from 'react';
import styles from './$COMPONENT_NAME.module.css';

interface ${COMPONENT_NAME}Props {
  // Add props here
}

export const $COMPONENT_NAME: React.FC<${COMPONENT_NAME}Props> = (props) => {
  return (
    <div className={styles.container}>
      <h1>$COMPONENT_NAME</h1>
    </div>
  );
};
EOF

# Create CSS module
cat > $COMPONENT_DIR/$COMPONENT_NAME.module.css << EOF
.container {
  /* Add styles here */
}
EOF

# Create test file
cat > $COMPONENT_DIR/$COMPONENT_NAME.test.tsx << EOF
import { render, screen } from '@testing-library/react';
import { $COMPONENT_NAME } from './$COMPONENT_NAME';

describe('$COMPONENT_NAME', () => {
  it('renders correctly', () => {
    render(<$COMPONENT_NAME />);
    expect(screen.getByText('$COMPONENT_NAME')).toBeInTheDocument();
  });
});
EOF

# Create index file
cat > $COMPONENT_DIR/index.ts << EOF
export { $COMPONENT_NAME } from './$COMPONENT_NAME';
EOF

echo "βœ… Component $COMPONENT_NAME created at $COMPONENT_DIR"
```

---

## 6. Pre-push Validation Script

```bash
#!/bin/bash
# scripts/pre-push.sh

echo "πŸ” Running pre-push checks..."

# Lint
echo "πŸ“ Linting..."
npm run lint
if [ $? -ne 0 ]; then
  echo "❌ Linting failed"
  exit 1
fi

# Type check
echo "πŸ”€ Type checking..."
npm run type-check
if [ $? -ne 0 ]; then
  echo "❌ Type check failed"
  exit 1
fi

# Tests
echo "πŸ§ͺ Running tests..."
npm test
if [ $? -ne 0 ]; then
  echo "❌ Tests failed"
  exit 1
fi

echo "βœ… All checks passed!"
```

---

## 7. Makefile for Common Tasks

```makefile
# Makefile

.PHONY: setup dev test lint clean

setup:
  @./scripts/setup.sh

dev:
  @npm run dev

test:
  @npm test

lint:
  @npm run lint
  @npm run type-check

clean:
  @./scripts/cleanup.sh

db-reset:
  @./scripts/db-reset.sh

update-deps:
  @./scripts/update-deps.sh

help:
  @echo "Available commands:"
  @echo "  make setup       - Setup development environment"
  @echo "  make dev         - Start development server"
  @echo "  make test        - Run tests"
  @echo "  make lint        - Run linting and type checking"
  @echo "  make clean       - Clean up environment"
  @echo "  make db-reset    - Reset database"
  @echo "  make update-deps - Update dependencies"
```

---

## 8. GitHub Actions Automation

```yaml
# .github/workflows/dependency-update.yml
name: Dependency Update

on:
  schedule:
    - cron: '0 0 * * 1'  # Every Monday
  workflow_dispatch:

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Update dependencies
        run: ./scripts/update-deps.sh
      
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          title: 'chore: update dependencies'
          body: 'Automated dependency update'
          branch: 'chore/update-dependencies'
```

---

## 9. Repository Automation Checklist

- [ ] **Setup Script**: One-command environment setup?
- [ ] **Cleanup Script**: Easy cleanup of dev environment?
- [ ] **Update Script**: Automated dependency updates?
- [ ] **Code Generation**: Templates for common files?
- [ ] **Pre-push Checks**: Validation before pushing?
- [ ] **Makefile**: Common tasks documented?
- [ ] **Documentation**: Scripts documented in README?
- [ ] **Permissions**: Scripts executable (`chmod +x`)?

---

## Related Skills
- `45-developer-experience/local-dev-standard`
- `45-developer-experience/release-workflow`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.