skills/ballee/dev-environment-manager/SKILL.md
Manage local development environment, database resets, health checks, deployment validation, production data sync, and Vercel environment variables; use when setting up dev environment, resetting databases, running pre-deployment checks, syncing production data to staging/local, or fixing Vercel env vars with trailing newlines
npx skillsauth add javeedishaq/ai-workflow-orchestrator dev-environment-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when:
The easiest way to reset and sync your local database:
# Reset local DB + sync from STAGING (default)
pnpm supabase:web:reset
# Reset local DB + sync from PRODUCTION
pnpm supabase:web:reset --prod
# Reset local DB only (no data sync)
pnpm supabase:reset:no-sync
These commands:
Login locally with any synced user email + password password
For a complete refresh of all environments:
# Step 1: Sync production data to staging
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-staging.sh --confirm --yes
# Step 2: Reset local and sync from staging
pnpm supabase:web:reset
This ensures staging mirrors production, then local mirrors staging.
Location: .claude/skills/dev-environment-manager/scripts/
| Script | Description |
|--------|-------------|
| sync-prod-to-staging.sh | Copy production data to staging (READ-only from prod) |
| sync-prod-to-local.sh | Copy production data to local (READ-only from prod) |
| sync-remote-to-local.sh | Unified sync script (staging or prod to local) |
| reset-local-dev.sh | Complete local database reset with optional production sync |
| health-check.sh | Database health verification |
| pre-deployment-checks.sh | Pre-deployment validation |
| fix-production-env-vars.sh | Fix production environment variables |
| verify-production-env-vars.sh | Verify production env vars are set |
All sync scripts have multiple safety layers to prevent accidental production writes:
--confirm flag AND type confirmation text# Preview what will happen (safe, no changes)
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-staging.sh
# Execute the sync (requires confirmation)
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-staging.sh --confirm
# Skip interactive prompt
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-staging.sh --confirm --yes
What it does:
Production is NEVER modified.
# Sync from STAGING (default)
pnpm supabase:web:reset
# Sync from PRODUCTION
pnpm supabase:web:reset --prod
# Or use scripts directly:
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-local.sh --confirm --yes
What it does:
Scripts automatically load credentials from:
.env.local (preferred)Required environment variables:
SUPABASE_DB_PASSWORD_PROD - Production database passwordSUPABASE_DB_PASSWORD_STAGING - Staging database password# Start local Supabase + reset with staging data
pnpm supabase:web:start
pnpm supabase:web:reset
# Full sync: prod → staging → local
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-staging.sh --confirm --yes
pnpm supabase:web:reset
# Fresh migrations, no external data
pnpm supabase:reset:no-sync
# Run all checks before deploying
./.claude/skills/dev-environment-manager/scripts/pre-deployment-checks.sh
| Environment | Project Ref | Host | Port |
|-------------|-------------|------|------|
| Production | csjruhqyqzzqxnfeyiaf | aws-1-eu-central-1.pooler.supabase.com | 5432 |
| Staging | hxpcknyqswetsqmqmeep | aws-1-eu-central-1.pooler.supabase.com | 5432 |
| Local | N/A | 127.0.0.1 | 54322 |
cd apps/web && pnpm supabase start
# Authenticate with 1Password
op signin
# Or set credentials manually in apps/web/.env.local:
SUPABASE_DB_PASSWORD_PROD="your-password"
SUPABASE_DB_PASSWORD_STAGING="your-password"
aws-1-eu-central-1.pooler.supabase.com (not aws-0)WARNING: supabase db reset has --local=true by default!
# WRONG - This resets BOTH local AND staging!
supabase db reset --db-url "postgresql://staging..."
# CORRECT - Only reset staging
supabase db reset --db-url "postgresql://staging..." --local=false
For staging schema reset, prefer using the sync script which handles this correctly:
./.claude/skills/dev-environment-manager/scripts/sync-prod-to-staging.sh --confirm --yes
Vercel env vars sometimes get trailing \n characters that break API connections.
# Fix production only (interactive)
./.claude/skills/dev-environment-manager/scripts/fix-production-env-vars.sh
# Fix production only (non-interactive)
./.claude/skills/dev-environment-manager/scripts/fix-production-env-vars.sh --yes
# Fix preview/staging only
./.claude/skills/dev-environment-manager/scripts/fix-production-env-vars.sh --env preview --yes
# Fix ALL environments (preview + production)
./.claude/skills/dev-environment-manager/scripts/fix-production-env-vars.sh --env all --yes
What it does:
\n charactersecho -n (no trailing newline)./.claude/skills/dev-environment-manager/scripts/verify-production-env-vars.sh
production-database-query - Query production/staging databasesdatabase-migration-manager - Create and apply migrationstools
# Test Patterns Testing patterns for reliable, maintainable, and fast tests. > **Template Usage:** Customize for your test framework (Vitest, Jest, Playwright, etc.) and assertion library. ## Test Structure ```typescript // user.test.ts import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { userService } from '@/services/user.service'; import { createTestUser, cleanupTestData } from '@/tests/helpers'; describe('UserService', () => { let testUserId: string; befor
tools
# State Management Patterns Client-side state management patterns for modern applications. > **Template Usage:** Customize for your state library (React Query, Zustand, Jotai, Redux, etc.). ## State Categories | Type | Description | Solution | |------|-------------|----------| | **Server State** | Data from API/database | React Query, SWR | | **Client State** | UI state, user preferences | Zustand, Jotai, useState | | **Form State** | Form inputs, validation | React Hook Form, Formik | | **U
development
# Service Patterns Service layer patterns for clean architecture with proper error handling, logging, and type safety. > **Template Usage:** Customize for your ORM (Prisma, Drizzle, TypeORM, etc.) and logging solution. ## Result Type Pattern Never throw exceptions from services. Always return a Result type. ```typescript // lib/result.ts export type Result<T, E = Error> = | { success: true; data: T } | { success: false; error: E }; export function ok<T>(data: T): Result<T, never> { r
testing
# Row-Level Security Patterns Database security patterns for multi-tenant and user-scoped data. > **Template Usage:** Customize for your database (PostgreSQL, Supabase, etc.) and auth system. ## RLS Fundamentals ### Enable RLS on Tables ```sql -- Enable RLS (required before policies take effect) ALTER TABLE users ENABLE ROW LEVEL SECURITY; ALTER TABLE posts ENABLE ROW LEVEL SECURITY; ALTER TABLE comments ENABLE ROW LEVEL SECURITY; -- Force RLS for table owners too (recommended) ALTER TABLE