skills/worktree-env/SKILL.md
Linked git worktree: symlink .env and .env.local from main checkout (bash/ln only)
npx skillsauth add roborew/opencode worktree-envInstall 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.
Load when the parent (orchestrate) delegates worktree env setup before preflight. Follow the worktree-env agent Hard Rules first.
When the workspace is a linked git worktree, ensure repo-root env files (default .env, .env.local) are symlinks to the main checkout so secrets stay in one place. Use bash + ln only (no edit/write tools for secret contents).
Override the file list with space-separated WORKTREE_ENV_FILES (e.g. WORKTREE_ENV_FILES=".env .env.local .env.development").
Run from repository root (git rev-parse --show-toplevel); cd there first if needed.
git rev-parse --is-inside-work-tree → must be true; else worktree_env: skipped_not_git.git_dir=$(git rev-parse --path-format=absolute --git-dir). If git_dir matches */.git/worktrees/*, treat as linked. Otherwise skip with worktree_env: skipped_not_linked_worktree (primary checkout or unusual layout).PREFLIGHT_MAIN_REPO_ROOT is set and non-empty: main_root="${PREFLIGHT_MAIN_REPO_ROOT%/}".common=$(git rev-parse --path-format=absolute --git-common-dir); main_root=$(dirname "$common")". (Assumes common dir is <repo>/.git; document in report if separate-git-dir breaks this.)wt_root=$(git rev-parse --show-toplevel).${WORKTREE_ENV_FILES:-.env .env.local} (space-separated basenames only).For each basename f in the file list:
source="${main_root}/${f}"; target="${wt_root}/${f}".source is not a readable path: skip this file (skipped_missing_source for f); continue other files.target exists and is not a symlink: Blocked — recommended_env_fix: move or remove the real file at target in the worktree (after backing up secrets), then re-run this task.target is missing, or is a symlink with the wrong target: run ln -sfn "$source" "$target" via bash (absolute source avoids fragile relative links).target already symlink and resolves to source: pass for this file (no ln needed).Verify each linked file with: test -L "$target" and compare readlink / canonical paths to source as appropriate for the OS (macOS: readlink; GNU readlink -f if available).
Overall status: ok if no file is Blocked; any Blocked file → worktree_env: blocked_regular_file or failed_ln and stop.
ln via bash only (no edit tool on .env). Global opencode.json may deny edits to .env; many stacks still allow symlink creation through bash—try that first.ln is denied by the sandbox, add under agents/worktree-env.md permission.edit with "*": deny and ".env": allow at repo root (mirror scribe patterns), then retry—or run the same ln command manually in a terminal.Return to parent:
worktree_env: ok | skipped_not_git | skipped_not_linked_worktree | blocked_regular_file | failed_lnfiles: per-file { name, status: ok | skipped_missing_source | blocked_regular_file | failed_ln, source, target } (paths only, not contents)commands_run: brief listrecommended_env_fix: one line if Blocked or failedfailed_ln, include blocker_code: ENV_BLOCKED only when the user cannot proceed to preflight without fixing this (orchestrate may still run preflight verification after manual fix)Status ready for developer preflight: worktree .env symlink is in place or not required.
tools
AI-powered code review using CodeRabbit CLI. Use only on explicit user request or when parent passes execution_mode orchestrate_coderabbit_gate. Do not run during orchestrated stage/issue work.
tools
Cross-repo companion to to-prd: after PRD frontmatter is filled, run bin/fanout <slug> from this spec repo to create child GitHub issues (one per ticket or legacy slice).
tools
Issue state machine — transition GitHub issue labels per docs/agents/triage-labels.md. Batch helpers via lib/triage.sh.
documentation
Synthesise a PRD from grill-me / research context, write docs/prd/<slug>.md, publish a GitHub issue with prd + state:ready-for-agent + feature:<slug>. Halt after publish — do not invoke fanout.