Skip to content
Development
Command

/local-sync

Full local development sync after git pull

From plugin
safe-agentic-workflow
39524 skills11 agents24 commands
Install
$ npx -y skills add bybren-llc/safe-agentic-workflow --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/local-sync

Context preview

What this command does when you run it.

Full local development sync after git pull

Command definition

local-sync.md
description: Full local development sync after git pull
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]

> **๐Ÿ“‹ TEMPLATE**: This command is a template. See "Customization Guide" below to adapt for your infrastructure.

Perform complete local development environment sync after pulling from dev branch. This ensures dependencies, database, and validation are all up-to-date.

Workflow

1. Git Branch Cleanup (Best Practice)

**Check current branch and switch to dev if needed:**

CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"

**If on feature branch:**

  • Check for uncommitted changes
  • If clean, switch to dev: `git checkout dev`
  • If dirty, offer to stash: `git stash && git checkout dev`
  • Save feature branch name for cleanup

**Switch to dev branch:**

git checkout dev

2. Git Pull

Pull latest changes from origin/dev:

git pull origin dev

If pull fails due to uncommitted changes:

  • Stash changes: `git stash`
  • Pull again
  • Reapply stash: `git stash pop`

3. Branch Cleanup (Git Best Practice)

**After pulling latest dev, clean up merged branches:**

**Check if previous feature branch is merged:**

# If we switched from a feature branch, check if it's merged
git branch --merged dev | grep -v "^\*" | grep -v "dev" | grep -v "master"

**Offer to delete merged feature branch:**

# Example: {{TICKET_PREFIX}}-381-rename-slash-commands-remote-prefix
git branch -d {{TICKET_PREFIX}}-381-rename-slash-commands-remote-prefix

**Prune remote tracking branches:**

# Remove stale remote tracking branches
git fetch --prune origin

**List stale local branches:**

# Show branches not updated in 30+ days
git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short) | %(committerdate:relative)' | grep -E 'weeks|months|years' ago

**Offer to delete stale branches** (interactive)

4. Smart Change Detection

Detect what changed to determine necessary steps:

# Check if package.json changed
DEPS_CHANGED=$(git diff HEAD@{1} HEAD -- package.json yarn.lock)

# Check if prisma schema changed
SCHEMA_CHANGED=$(git diff HEAD@{1} HEAD -- prisma/schema.prisma prisma/migrations/)

**Decision Logic:**

  • If `$DEPS_CHANGED` is empty โ†’ **Skip Step 5 (yarn install)**
  • If `$SCHEMA_CHANGED` is empty โ†’ **Skip Step 6 (Prisma operations)**
  • If both empty โ†’ **Fast path: Jump to Step 7 (Docker check)**

5. Install Dependencies (Conditional)

Only run if package.json or yarn.lock changed

If `$DEPS_CHANGED` has content:

yarn install

Show summary:

  • Packages added
  • Packages removed
  • Packages updated

If `$DEPS_CHANGED` is empty:

โญ๏ธ  Skipped: No dependency changes detected

6. Prisma Client Update (Conditional)

Only run if schema or migrations changed

If `$SCHEMA_CHANGED` has content:

npx prisma generate

Check for pending migrations:

npx prisma migrate status

If migrations pending:

  • Show migration names
  • Offer to run: `npx prisma migrate deploy`
  • OR suggest: `npx prisma migrate dev` for development

If `$SCHEMA_CHANGED` is empty:

โญ๏ธ  Skipped: No schema changes detected

7. Validation (Optional)

Only run if user opts in

Ask user: "Run full validation (yarn ci:validate)? This takes ~30s. (y/N)"

If user chooses Yes:

yarn ci:validate

This runs:

1. `yarn type-check` - TypeScript validation 2. `yarn lint` - ESLint validation 3. `yarn test:unit` - Unit tests

If user chooses No or skips:

โญ๏ธ  Skipped: Run 'yarn ci:validate' manually if needed

8. Docker Services Check

Verify Docker services are running:

docker ps --filter name={{PROJECT_NAME}} --format 'table {{.Names}}\t{{.Status}}\t{{.State}}'

If services not running:

  • Suggest: `./scripts/dev-docker.sh start`
  • OR: `docker-compose up -d`

9. Status Report

Generate comprehensive sync report:

๐Ÿ”„ Local Development Sync Complete

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Git Sync
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Branch:        dev
Commits:       3 new commits pulled
Latest:        fd85ba3 - feat(marketing): RenderTrust pages [{{TICKET_PREFIX}}-379]

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Dependencies
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

package.json:  โœ… No changes
yarn.lock:     โœ… No changes
Status:        โญ๏ธ  Skipped (no changes)

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Database
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Prisma Schema: โœ… No changes
Migrations:    โœ… All applied (14 total)
Client:        โญ๏ธ  Skipped (schema unchanged)

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Validation
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Status:        โญ๏ธ  Skipped (user opted out)
Suggestion:    Run `yarn ci:validate` manually if needed

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Docker Services ({{TICKET_PREFIX}}-401: STANDARD Ports)
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

{{PROJECT_NAME}}-dev-app:        โœ… Up 3 hours (healthy) โ†’ port 3000
{{PROJECT_NAME}}-dev-postgres:   โœ… Up 3 hours (healthy) โ†’ port 5432
{{PROJECT_NAME}}-dev-redis:      โœ… Up 3 hours (healthy) โ†’ port 6379

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Summary
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

โœ… Local environment fully synced and validated
โœ… Ready for development

Next Steps:
โ€ข Start dev server: yarn dev
โ€ข View local app: http://localhost:3000
โ€ข Check health: /local-health

Error Handling

Git Pull Fails (Merge Conflicts)

If pull fails due to conflicts:

โš ๏ธ  MERGE CONFLICT DETECTED

Files with conflicts:
โ€ข app/example/page.tsx
โ€ข lib/helper.ts

Resolution:
1. Resolve conflicts manually
2. Stage resolved files: git add .
3. Complete merge: git commit
4. Re-run /local-sync

Yarn Install Fails

If dependency installation fails:

# Clear cache and retry
yarn cache clean
rm -rf node_modules
yarn install

Prisma Generate Fails

If Prisma cl

Read more
Ships withsafe-agentic-workflow

SAW โ€” SAFe Agentic Workflow AI Agent Harness for Multi-Agent Team Workflows Built on SAFe methodology (Scaled Agile Framework), adapted for AI agent teams (Now With AI-DLC!) Works for any team with repeatable processes: Software, Marketing, Research, Legal, Operations.

Get the whole plugin