Skill: get-env-var
Fetch a secret from the team's Infisical workspace into the current shell so the next command can use it.
When to use
- A command or script needs an env var that is not set, such as
BLOB_READ_WRITE_TOKEN.
- A token, API key, or other secret is missing from the environment.
- The user asks to load secrets from Infisical.
Setup (once per machine)
- Install the CLI on macOS:
brew install infisical/get-cli/infisical.
- Check auth with
infisical user get; if it fails, run infisical login and complete the browser flow.
- For CI or other non-interactive runs, set
INFISICAL_TOKEN from a machine identity; the CLI skips login when it is present.
- This repo is already project-linked via tracked
.infisical.json (workspaceId: "e9f4542a-8714-46c3-a8fd-99d8cb370aeb", empty defaultEnvironment). From the repo root, infisical defaults to the dev environment slug when --env is omitted.
Fetch one secret into the environment
Run from the repo root:
export NAME="$(infisical secrets get NAME --plain --silent)"
- Replace
NAME with the secret name.
- Add
--env <slug> for a non-default environment; this repo defaults to dev.
- Add
--path /some/folder when secrets are organized in folders.
Inject everything into a command
Run the command through Infisical so all project secrets are available only to that process:
infisical run -- <command>
Discover, check, and forward without ever seeing a value
Always run from the repo root; outside it infisical errors and emits an empty stdout, which a downstream gh secret set will silently store.
# Which secrets exist? Names only, via structured output. Never list with
# --plain or the default table: both print values, and multi-line values
# (private keys) defeat any line-based filter such as cut or awk.
infisical secrets --env dev --output json --silent 2>/dev/null | jq -r '.[].secretKey'
# Does NAME exist and is it non-empty? Prints a byte count, never the value.
infisical secrets get NAME --plain --silent 2>/dev/null | wc -c
# Forward NAME to a consumer in one pipe (e.g. a GitHub Actions secret).
infisical secrets get NAME --plain --silent 2>/dev/null | gh secret set NAME --repo <owner>/<repo>
Rules
- Never echo, print, or otherwise log secret values.
- Never write secrets to files, logs, commit messages, PR bodies, or comments.
- Only use
--plain with secrets get NAME inside command substitution, as in export NAME="$(...)", or piped straight into a single consumer as above. Never use --plain to list.
- Never pass a secret-bearing stream through
grep, rg, awk, sed, cut, head, or any line-based filter: multi-line values and one mismatched pattern both land values in the tool output. Listing is --output json | jq -r '.[].secretKey' only.
- Treat every
infisical secrets ... command as printing values unless it is the JSON name listing above, piped into wc -c, or piped into a consumer.
- If a secret does not exist, STOP and tell the user exactly which secret name and environment to add in Infisical; do not invent values.
1---2name: get-env-var3description: get an env var, fetch a secret, missing env var, missing token/API key, load secrets from Infisical, infisical. Fetch secrets from the team's Infisical workspace into the shell environment so subsequent commands can use them.4---56# Skill: get-env-var78Fetch a secret from the team's Infisical workspace into the current shell so the next command can use it.910## When to use1112- A command or script needs an env var that is not set, such as `BLOB_READ_WRITE_TOKEN`.13- A token, API key, or other secret is missing from the environment.14- The user asks to load secrets from Infisical.1516## Setup (once per machine)1718- Install the CLI on macOS: `brew install infisical/get-cli/infisical`.19- Check auth with `infisical user get`; if it fails, run `infisical login` and complete the browser flow.20- For CI or other non-interactive runs, set `INFISICAL_TOKEN` from a machine identity; the CLI skips login when it is present.21- This repo is already project-linked via tracked `.infisical.json` (`workspaceId: "e9f4542a-8714-46c3-a8fd-99d8cb370aeb"`, empty `defaultEnvironment`). From the repo root, `infisical` defaults to the `dev` environment slug when `--env` is omitted.2223## Fetch one secret into the environment2425Run from the repo root:2627```bash28export NAME="$(infisical secrets get NAME --plain --silent)"29```3031- Replace `NAME` with the secret name.32- Add `--env <slug>` for a non-default environment; this repo defaults to `dev`.33- Add `--path /some/folder` when secrets are organized in folders.3435## Inject everything into a command3637Run the command through Infisical so all project secrets are available only to that process:3839```bash40infisical run -- <command>41```4243## Discover, check, and forward without ever seeing a value4445Always run from the repo root; outside it `infisical` errors and emits an empty stdout, which a downstream `gh secret set` will silently store.4647```bash48# Which secrets exist? Names only, via structured output. Never list with49# --plain or the default table: both print values, and multi-line values50# (private keys) defeat any line-based filter such as cut or awk.51infisical secrets --env dev --output json --silent 2>/dev/null | jq -r '.[].secretKey'5253# Does NAME exist and is it non-empty? Prints a byte count, never the value.54infisical secrets get NAME --plain --silent 2>/dev/null | wc -c5556# Forward NAME to a consumer in one pipe (e.g. a GitHub Actions secret).57infisical secrets get NAME --plain --silent 2>/dev/null | gh secret set NAME --repo <owner>/<repo>58```5960## Rules6162- Never echo, print, or otherwise log secret values.63- Never write secrets to files, logs, commit messages, PR bodies, or comments.64- Only use `--plain` with `secrets get NAME` inside command substitution, as in `export NAME="$(...)"`, or piped straight into a single consumer as above. Never use `--plain` to list.65- Never pass a secret-bearing stream through `grep`, `rg`, `awk`, `sed`, `cut`, `head`, or any line-based filter: multi-line values and one mismatched pattern both land values in the tool output. Listing is `--output json | jq -r '.[].secretKey'` only.66- Treat every `infisical secrets ...` command as printing values unless it is the JSON name listing above, piped into `wc -c`, or piped into a consumer.67- If a secret does not exist, STOP and tell the user exactly which secret name and environment to add in Infisical; do not invent values.