activate-worktree-env
Use after a git worktree has been created and needs its isolated environment activated. Runs the project's setup-env.sh, then verifies the environment with smoke-test.sh before starting development.
What this skill does
# Activate Worktree Environment ## Overview **PER-WORKTREE SKILL** - Runs the project's pre-generated setup-env.sh to provision an isolated environment for a new git worktree, then verifies readiness with smoke-test.sh. **Core principle**: Always verify before developing. **PREREQUISITE**: Project must already have setup scripts generated by `setup-isolated-env:generate-env-scripts`. If scripts don't exist, run that skill first. **Announce at start:** "i'm using activate-worktree-env skill to set up and verify this worktree environment" ## When to Use **Use when**: - A new git worktree has been created for a feature branch - Starting work in an existing worktree that has no `.env.local` yet - Re-provisioning a worktree whose environment was lost or corrupted **Don't use for**: - Creating the setup scripts themselves (use `setup-isolated-env:generate-env-scripts`) - Projects without isolation scripts (run generate-env-scripts first) ## Quick Reference | Step | Command | Run From | |------|---------|----------| | 1. Run setup-env.sh | `<worktree_scripts>/setup-env.sh` | Project root | | 2. Navigate to worktree | `cd .worktrees/<env-name>` | Project root | | 3. Run smoke test | `../../<worktree_scripts>/smoke-test.sh` | Inside worktree | | 4. Start dev | `bun run dev` (or project command) | Inside worktree | ## Implementation ### Step 1: Find Script Location **Check CLAUDE.md** for the worktree scripts location: - Look for `## Isolated Development Environments` section - The location is listed under `### Creating a New Environment` **Common locations**: - `.worktrees_scripts/` (default) - `scripts/` ```bash # Verify scripts exist ls <worktree_scripts>/setup-env.sh ``` **If scripts don't exist**: Stop. Run `setup-isolated-env:generate-env-scripts` first. ### Step 2: Run setup-env.sh **Run from project root** (NOT from inside the worktree): ```bash # From project root <worktree_scripts>/setup-env.sh ``` The script will: 1. Prompt for environment name (or detect from git branch) 2. Allocate unique ports and database identifiers 3. Create git worktree at `.worktrees/<env-name>` 4. Copy `.env.example` → `.env.local` with unique values 5. Create isolated database 6. Run migrations 7. Display environment summary **If script fails**: Read the error output. Common causes: - Infrastructure not running (start Docker/Supabase first) - Environment name conflict (choose a different name) - Database creation permission issue (see Troubleshooting) ### Step 3: Navigate to Worktree ```bash cd .worktrees/<env-name> ``` ### Step 4: Run Smoke Test **CRITICAL**: Smoke test MUST run from WITHIN the worktree (not project root). ```bash # Already inside .worktrees/<env-name> ../../<worktree_scripts>/smoke-test.sh ``` **Smoke test checks**: - Environment variables are set (PORT, DATABASE_URL, etc.) - Port is available (not in use by another process) - Database connectivity - Infrastructure services are running **If smoke test passes**: Environment is ready. Start development. **If smoke test fails**: Do NOT start development. See Troubleshooting. ### Step 5: Start Development Only after smoke test passes: ```bash # Inside .worktrees/<env-name> bun run dev # or: npm run dev / yarn dev / pnpm dev ``` ## Troubleshooting **setup-env.sh fails - infrastructure not running**: - Start Docker: `docker compose up -d` - Start Supabase: `supabase start` - Re-run setup-env.sh **setup-env.sh fails - environment name conflict**: - Choose a different environment name - Or clean up old environment: `<worktree_scripts>/cleanup-env.sh <old-name>` **Database creation fails (Supabase MCP projects)**: - Check if CLAUDE.md has SQL execution restrictions - May need to create database manually via Claude Code MCP - See WORKTREE.md for project-specific database strategy **Smoke test fails - wrong directory**: - Must run from INSIDE the worktree: `cd .worktrees/<env-name>` first - Path to smoke test is relative: `../../<worktree_scripts>/smoke-test.sh` - Do NOT run from project root **Smoke test fails - PORT not set**: - Check `.env.local` exists in worktree - Verify setup-env.sh completed successfully (no errors) - Re-run setup-env.sh if .env.local is missing or empty **Smoke test fails - database connectivity**: - Verify infrastructure is running: `supabase status` or `docker compose ps` - Check DATABASE_URL in `.env.local` points to correct host/port - Test connection manually: `psql "$DATABASE_URL" -c "SELECT 1"` **Smoke test fails - port in use**: - Another process is using the allocated port - Check: `lsof -i :<PORT>` - Either stop conflicting process or adjust port in `.env.local` and re-run smoke test ## Cleanup When Done When finished with the worktree: ```bash # From project root <worktree_scripts>/cleanup-env.sh <env-name> ``` This removes the worktree, drops the database, and frees allocated ports.
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.