/ccxp-skills:1password-env-setup [path]from ccxp-skills
Use when the user explicitly asks to bootstrap or refresh a repo's 1Password-backed .env — installs the refresh-env helper, generates a hash-checking .envrc, and materializes .env from .env.tpl via op inject
Ships in ccxp-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
<skills-root>= this skill's "Base directory" minus its last component; substitute the literal path (skill-conventions§9).
Bootstraps a repo's local secrets flow on top of .env.tpl (an op://
reference file your repo defines against your own 1Password vault):
materializes .env via op inject, and writes a .envrc (direnv) that
re-materializes it automatically on every cd into the repo — but skips the
1Password round-trip (and any interactive unlock prompt it can trigger) when
.env is fresh by content: the sha256 of .env.tpl and of the generated
.env still match the hashes recorded at the last refresh. mtime is not used.
This skill owns the bootstrap mechanism only — the op:// reference
list inside .env.tpl is repo-specific and out of scope here. An adopting
team designs that part itself: a vault layout for where each secret lives,
the op://<vault>/<item>/<field> references written into .env.tpl, a
CI/GHA secrets-sync approach if the pipeline also needs these values, and a
rotation cadence for the underlying 1Password items.
[path] is optional — the target repo directory. Defaults to the current
directory.
<path> (default .). Verify it exists.<path>/.env.tpl exists. If not, stop and report — this skill
bootstraps .env/.envrc from an existing .env.tpl; the op://
reference list itself must already be written (design your own vault
layout and reference format — see "Cross-references" below).<path>/refresh-env (executable copy of
scripts/refresh-env.sh; idempotent), then write <path>/.envrc calling it
(below). Idempotent — a no-op if the content is already identical.<path>/.env through refresh-env (content-hash check, then
op inject only if stale). If the op CLI isn't installed, skip with
install guidance rather than failing. A failed op inject (wrong account,
network, etc.) is reported as a failure and stops the workflow
(T20260918-214522). Set OP_ACCOUNT (e.g. OP_ACCOUNT=my.1password.com)
to pass --account through to op inject.
refresh-env removes its .env.tmp.*/.env.err.* on every exit path
(success, failure, signal, EXIT) and sweeps leftovers older than
REFRESH_ENV_SWEEP_MINS (default 10) that no process holds open. A repo
whose .envrc is an old inline-mktemp template (no ./refresh-env)
leaks one temp file per killed direnv run; re-run this skill to replace it.direnv allow in <path> so the new .envrc takes effect
immediately. If direnv isn't installed, skip with install guidance.Run directly:
bash <skills-root>/1password-env-setup/scripts/1password-env-setup.sh [path]
.envrc templateif ./refresh-env .; then
dotenv .env
else
log_error "refresh-env failed -- .env NOT loaded (see message above); then run ./refresh-env"
fi
refresh-env helperCallable by any process (direnv, launchd, a Claude Code hook, a script):
<path>/refresh-env [--check|--force] [dir] (the installed copy defaults to
its own directory).
.env.tpl.sha256 (template hash at last refresh)
and .env.sha256 (hash of the .env the generator wrote), both mode 0600,
hashes only, never values. Stale reasons: missing, no-state,
tpl-changed, env-edited-outside-generator (a hand edit, even one newer
than the template, is caught).--check — no op call; prints fresh (exit 0) or stale: <reason>
(exit 3) plus drift: <KEY> lines: keys .env.tpl defines as op://
references whose .env line is missing or still an unresolved op://.
Key names only.--force — refresh regardless of hashes (a vault value rotated while the
template did not change cannot be seen by hashes).op inject runs with a bounded wait (REFRESH_ENV_OP_TIMEOUT,
default 60s). Timeout or an auth/sign-in failure prints a clear "1Password
needs your unlock" message naming the command to run, exits 75, leaves the old
cache and hashes untouched, and callers must not load the stale cache.mkdir lock with stale-lock recovery, mktemp temp file under
umask 077 moved into place only on success, hashes written before the move..env.tpl,
3 stale (--check), 10 op missing, 75 unlock needed, timed out or lock held..envrc deployed before this change keeps
its old mtime logic until the skill is re-run..envrc silently — it only skips
rewriting when the existing content is byte-identical to the generated
template; any other existing .envrc is replaced (this skill assumes it
owns .envrc, matching the one-.envrc-per-repo convention). If a repo
needs additional .envrc logic beyond this template, add it by hand after
running this skill, not before.pes-envrc-content, pes-check-env-tpl,
pes-install-helper, pes-write-envrc, pes-materialize-env, pes-direnv-allow) are
function-wrapped and BASH_SOURCE-guarded (see
quality-probe/scripts/probe.sh for the same pattern), so
BATS can source the script and unit-test each step without invoking op
or direnv for real.op or direnv — it detects their absence and prints
install guidance instead of failing, since a missing CLI on one box
shouldn't block the .envrc/.env.tpl bootstrap from being written.op://<vault>/<item>/<field> syntax this skill's op inject
step resolves; use it as the starting point for writing your own
.env.tpl.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub synx-data-labs/ccxp-skills --plugin ccxp-skills57 skills in this plugin
/address-prUse when the user explicitly asks to address, verify, or merge a specific open PR (CI, Claude Code review, test plan, tiered merge)/agent-pairingUse when the user explicitly asks to toggle the ccxp-agent main-session agent on/off for this Claude Code profile or check its status/agents-sdkBuild AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, chat applications, voice agents, or browser automation. Covers Agent class, state management, callable RPC, Workflows, durable execution, queues, retries, observability, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.