/local-sync
Full local development sync after git pull
$ npx -y skills add bybren-llc/safe-agentic-workflow --agent claude-codeHow 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.mddescription: 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-healthError 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
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-healthError 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
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.
Other commands on safe-agentic-workflow.
- /audit-deps
Run comprehensive dependency audit
Open command - /check-docker-status
Check if {{DEV_MACHINE}} Docker environment needs updating
Open command - /check-workflow
Quick status check of current workflow state
Open command - /deploy-dev
Deploy latest Docker image to {{DEV_MACHINE}} dev environment
Open command - /dev-health
Check {{DEV_MACHINE}} dev environment health dashboard
Open command - /dev-logs
View {{DEV_MACHINE}} dev container logs
Open command

