agentleFS
sammasaksammasak/claude-code-skills/skills/credentials/SKILL.md

credentials

Skill1 starsChanged 28 days agoMITView on GitHub

Use when running build, push, or deploy commands that need credentials (registry auth, API keys, tokens) in this homelab.

  • Reads credentials

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before running any command that requires credentials, load them from the correct source.

    line 9
  2. Very specific:

    Always source ~/.env before running build or deploy commands if credentials might be needed:

    line 22

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Credentials

Before running any command that requires credentials, load them from the correct source.

Credential Sources (priority order)

SourceLocationUse for
Environment varsAlready set in shellHighest priority — use if present
~/.env~/.envAPI keys, OAuth tokens, misc secrets (list non-exhaustive — read the file)
Container registry auth~/.config/containers/auth.jsonskopeo, podman, buildah, registry pushes
SOPS secrets~/homelab-gitops/ or ~/nixos-config/secrets/Kubernetes secrets, NixOS service secrets

Loading ~/.env

Always source ~/.env before running build or deploy commands if credentials might be needed:

set -a && source ~/.env && set +a

Contains: CLAUDE_CODE_OAUTH_TOKEN (local override; sops-nix also provides it at /run/secrets/claude_oauth_token), GEMINI_API_KEY, CLOUDFLARE_API_TOKEN, TAILSCALE_AUTH_KEY, ACME_EMAIL.

Container Registry (zot)

Registry: registry.sammasak.dev (zot, robot-account auth — Harbor is retired).

Credentials are stored in ~/.config/containers/auth.json. Extract them when needed:

auth_encoded=$(jq -r '.auths["registry.sammasak.dev"].auth' ~/.config/containers/auth.json)
robot_user=$(echo "$auth_encoded" | base64 -d | cut -d: -f1)
robot_pass=$(echo "$auth_encoded" | base64 -d | cut -d: -f2-)

Or pass the authfile directly to skopeo:

skopeo copy --authfile ~/.config/containers/auth.json oci:./dir docker://registry.sammasak.dev/lab/<app>:<tag>

skopeo and buildah also read this file by default, so plain skopeo copy ... docker://registry.sammasak.dev/... pushes work without flags.

SOPS Secrets

Decrypt a SOPS file to read a secret:

sops -d ~/homelab-gitops/apps/<app>/secrets/some.secret.yaml

Flux's kustomize-controller decrypts the same files in-cluster via each Kustomization's spec.decryption (secretRef: sops-age) — the age private key never leaves the cluster or your local age identity. Never write plaintext secrets to /tmp — always decrypt in place or to the correct repo path (see secrets-management skill for the full lifecycle).

Checklist Before Running Build/Push Commands

  • Does the command need registry auth? → skopeo/buildah read ~/.config/containers/auth.json by default; pass --authfile if a tool doesn't
  • Does the command need API keys? → set -a && source ~/.env && set +a
  • Does the command need a SOPS secret? → sops -d <file> and use the value directly
  • Are env vars already set? → Check with env | grep -i registry or similar before loading

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.