Secure credentials

From jsath/claude-skills · View interactive version

Secure credentials is an AI agent skill from the GitHub repository jsath/claude-skills. Handles API keys, passwords, tokens and one-time secret links with Claude without the secret ever showing up in chat, logs, tool output or git. You put the value straight into a locked-down .env file, the OS keychain or a password manager; Claude reads it by name, checks it with one read-only call,

How to use this skill

Skill file

Secure Credentials

Anything pasted into a chat with Claude, or printed by a command, ends up in the conversation history. This skill keeps secret values out of both. Claude works with the secret's name (OPENAI_API_KEY), never its value. You enter the value yourself, in your own terminal, into a store only your user account can read.

Copy-paste shell snippets for every step are in references/shell-snippets.md. The leak checklist is in templates/ROTATION-CHECKLIST.md.

Rules

  1. Never paste a secret into chat. If one gets pasted anyway, treat it as leaked: stop, do not repeat it, and start the rotation checklist.
  2. Never print a secret. No echo $KEY, cat .env, env, printenv, set -x, or debug dumps of request headers. To prove a key exists, print its length and last 4 characters only.
  3. Never put a secret on a command line. Arguments can show up in ps, shell history and Claude's tool log. Read from a file, the keychain or stdin instead.
  4. One store per secret, locked down. A .env file with mode 600 that git ignores, the OS keychain, or a password or secrets manager (1Password, Bitwarden, Vault, AWS or GCP Secret Manager). No secrets in source files, READMEs, screenshots, tickets or chat apps.
  5. Validate read-only. Check a key with the smallest read-only call the provider has (who am I, list models, read balance). Never test a key by creating, sending, charging or deleting anything.
  6. Least privilege. Ask for the narrowest key that does the job: scoped, read-only where possible, one project or repo, an expiry date. A working key is not permission to do everything it can do.
  7. A leaked key gets rotated, not just deleted. Deleting a file or a chat message does not erase copies in logs, backups, git history or the provider's records.

Steps

1. Decide the name and the store

Before anyone touches the value, Claude confirms: which service, which environment (dev or production), the variable name (for example STRIPE_SECRET_KEY), and where it will live. Default is a .env file in the project root.

2. Lock the destination before the secret exists

3. You enter the value, outside the chat

Run the set_secret helper from the snippets file in your own terminal window, not through Claude. It reads the value with hidden input (or from the clipboard), writes or replaces just that one line in .env, keeps the mode at 600, and prints nothing but the variable name. Then tell Claude "saved".

Prefer a keychain or password manager? Store it there and have the project load it at run time (security, secret-tool or op read in the snippets).

4. Claude validates without seeing it

Claude loads the file into the environment of a single command and calls one read-only endpoint. The only output is something like:

OPENAI_API_KEY: set, length 51, ends ...a1b2, HTTP 200

How to read the status:

5. Keep it out of git

6. Redact anything that might echo it

Logs, error messages, crash reports and API responses can contain the key (some APIs echo credentials, and URLs like https://user:token@host hide one in plain sight). Pipe risky output through the redact filter from the snippets, and keep curl -v, verbose SDK logging and set -x off while keys are loaded.

7. Clean up

One-time secret links

Links from services like onetimesecret.com or a password manager's share feature show the value once, then die. Opening the link to "take a look" spends it.

  1. Do steps 1 and 2 first, so the destination is ready.
  2. Open the link yourself, once, in your own browser. Claude does not open it unless you ask, and even then only with a script that writes the value straight to the store without printing it.
  3. Copy the value, run set_secret with the clipboard option, then clear the clipboard.
  4. Claude validates (step 4).
  5. Tell the sender it was received and stored, so they know the link is spent. If the link was already opened by someone else, or the value fails validation, ask for a new secret. Never ask them to paste it into chat instead.

Output

When Claude finishes, the report contains only:

Never a prefix, a full value, a hash meant to identify the key, or a response body that might contain it.

Honest limits

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.