agents-config/skills/codex-environment/SKILL.md
Create, inspect, or repair Codex app Local Environment configuration for worktrees, including .codex/environments/environment.toml, setup and cleanup scripts, worktree up/down scripts, copied env files, isolated databases, and reusable app actions.
npx skillsauth add melvynx/aiblueprint codex-environmentInstall 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 user asks about Codex Local Environments, worktree setup scripts, cleanup scripts, Codex actions, .codex/environments/environment.toml, CODEX_WORKTREE_PATH, CODEX_SOURCE_TREE_PATH, or making a worktree ready to run.
.codex/environments/environment.toml at the project root..env must be copied or recreated by setup.scripts/, for example scripts/worktree-up and scripts/worktree-down..codex focused on Codex config; keep operational logic in scripts/..env to point to it.CODEX_SOURCE_TREE_PATH for the original project checkout and CODEX_WORKTREE_PATH for the new worktree when available.Create or update:
.codex/
└── environments/
└── environment.toml
scripts/
├── worktree-up
├── worktree-down
├── codex-dev.sh
└── project-specific helpers...
Use this environment.toml pattern:
# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY
version = 1
name = "Project Worktree"
[setup]
script = "cd \"$CODEX_WORKTREE_PATH\"\nscripts/worktree-up"
[cleanup]
script = "cd \"$CODEX_WORKTREE_PATH\"\nscripts/worktree-down"
[[actions]]
name = "Dev"
icon = "tool"
command = "scripts/codex-dev.sh"
[[actions]]
name = "Typecheck"
icon = "tool"
command = "pnpm ts"
[[actions]]
name = "Unit tests"
icon = "tool"
command = "pnpm test:ci"
[[actions]]
name = "Lint"
icon = "tool"
command = "pnpm lint:ci"
Keep setup script content small:
#!/usr/bin/env bash
set -euo pipefail
cd "${CODEX_WORKTREE_PATH:-$(pwd)}"
scripts/make-worktree-ready.sh
Keep cleanup script content small:
#!/usr/bin/env bash
set -euo pipefail
cd "${CODEX_WORKTREE_PATH:-$(pwd)}"
scripts/worktree-db-down.sh
When writing scripts/worktree-up or its helper:
set -euo pipefail.cd "${CODEX_WORKTREE_PATH:-$(pwd)}" before touching files.CODEX_SOURCE_TREE_PATH, then a project-specific fallback like $HOME/Developer/saas/<repo>..env, .env.local, and .env.development.local.pnpm install, never npm install in a pnpm repo./ with -..env.pnpm prisma:generate.LUMAIL_RESET_DB=1.When writing scripts/worktree-down or its helper:
.env, not from guessed branch names.dropdb --if-exists and a maintenance database.Use actions for commands the user will run often:
Dev: start the app, ideally via a script that finds a free port.Typecheck: pnpm ts, npm run typecheck, or equivalent.Unit tests: the project unit test command.Lint: the CI lint command.E2E: optional, only if it is not too expensive/noisy for a quick action.For dev servers, prefer a script like:
#!/usr/bin/env bash
set -euo pipefail
cd "${CODEX_WORKTREE_PATH:-$(pwd)}"
port="${CODEX_DEV_PORT_START:-3910}"
while lsof -nP -iTCP:"$port" -sTCP:LISTEN >/dev/null 2>&1; do
port=$((port + 1))
done
echo "Starting app on http://localhost:$port"
exec pnpm dev -p "$port"
After editing a Codex environment:
bash -n scripts/worktree-up scripts/worktree-down
sed -n '1,220p' .codex/environments/environment.toml
git status --short
If Python 3.11+ is available, validate TOML:
python3 - <<'PY'
import tomllib
with open(".codex/environments/environment.toml", "rb") as f:
tomllib.load(f)
PY
.conductor directories..codex/environments/environment.toml.PORT..codex config and scripts are present in the source checkout/main branch, not only the current Codex worktree.CODEX_SOURCE_TREE_PATH / CODEX_WORKTREE_PATH community note: https://zenn.dev/route06/articles/c1f686b4479957development
Create or edit Claude, Codex, and Cursor skills/rules. Use for SKILL.md, .cursor/rules, AGENTS.md, skill prompts, frontmatter, references, scripts, and discovery rules.
data-ai
Create and maintain agent rules in AGENTS.md and .agents/rules/. Use for project rules, conventions, constraints, rule indexes, or requests to add or optimize agent rules.
development
Set up per-worktree environments for Claude Code, Cursor, or Codex. Use for worktree-ready repos, IDE environment config, worktree-up/down scripts, or dev.sh wiring.
testing
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".