Agent skill
sops-add-key
Add a new machine's age public key to .sops.yaml and re-encrypt all files. Use for multi-machine setups. Use when user mentions "add key", "add machine", "sops add key", "new machine", "authorize machine", "share key", "add public key", "multi machine sops".
Install this agent skill to your Project
npx add-skill https://github.com/joaquimscosta/arkhe-claude-plugins/tree/main/plugins/devtools/skills/sops-add-key
SKILL.md
SOPS Add Key
Add a new machine's age public key to the project and re-encrypt all files so the new machine can decrypt them.
Workflow
-
Detect current state:
bashpython3 ${CLAUDE_SKILL_DIR}/../sops-setup/scripts/detect_sops.py <project-root> -
Verify prerequisites:
project.sops_yaml.existsmust be true — if not, tell user to run/devtools:sops-setupfirstproject.encrypted_filesshould be non-empty — warn if there are no.enc.yamlfiles to re-encrypt- If
project.tmp_filesis non-empty, warn about stale temporary files (leftover from a failed decrypt/re-encrypt) and suggest the user delete them
-
Audit key propagation (if encrypted files exist): For each encrypted file, read its YAML and check the
sops.agerecipients list againstproject.sops_yaml.authorized_keys. If any authorized key is missing from any file's recipients:WARNING: Key age1xxx...yyy is in .sops.yaml but NOT a recipient in: - apps/web/.env.local.enc.yaml - apps/api/.env.local.enc.yaml These files need re-encryption before the corresponding machine can decrypt them.Offer to run
sops updatekeys -y <file>for each affected file before proceeding with the new key addition. -
Show current authorized keys from
project.sops_yaml.authorized_keys:Currently authorized keys (N): 1. age1abc...def (truncated) 2. age1ghi...jkl (truncated) -
Use
AskUserQuestion— ask user to paste the new machine's age public key. Validate it starts withage1. -
Read
.sops.yamland add the new key to theage:field increation_rules. Use theEdittool to append the key to the comma-separated list or multi-line block. -
Re-encrypt all files using
sops updatekeys:bashsops updatekeys -y <file>.enc.yamlFor each encrypted file. The
-yflag auto-confirms. This re-wraps only the data encryption key for the new recipient list — values and MAC are unchanged, producing a minimal diff.If
sops updatekeysis not available (older sops version), fall back to decrypt + re-encrypt:bashsops --decrypt <file>.enc.yaml > <file>.tmp.yaml sops --encrypt <file>.tmp.yaml > <file>.enc.yaml rm <file>.tmp.yamlVerify: After re-encrypting, read each file's
sops.agerecipients block and confirm all keys from.sops.yaml(including the newly added key) appear as recipients. If any key is missing, warn the user that re-encryption may have failed. -
Summary:
| Action | Detail | |--------|--------| | Key added | age1xyz... (new machine) | | .sops.yaml | Updated (now N+1 authorized keys) | | Re-encrypted | .env.local.enc.yaml | | Re-encrypted | .env.production.enc.yaml |Remind user to commit both
.sops.yamland the updated.enc.yamlfiles.
Key Rotation vs Key Addition
- Adding a key (
sops updatekeys): Re-wraps the DEK for the new recipient list. Safe, minimal diff. Use for onboarding machines. - Rotating keys (
sops rotate -i): Generates a new DEK and re-encrypts every value. Use when a key is compromised or for periodic security hygiene. - If the user mentions a compromised key, recommend
sops rotate -iafter removing the compromised key from.sops.yaml.
Key Rules
- Validate the public key format (must start with
age1) before modifying.sops.yaml - Always show the current keys before adding a new one
- Re-encrypt ALL
.enc.yamlfiles — missing any would lock out the new machine for those files - Use
sops updatekeys(not full decrypt/re-encrypt) for routine key additions - After re-encryption, the new machine can clone and decrypt immediately
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
Skill Name
What this skill does. Use when user mentions "keyword1", "keyword2", or "keyword3". Keep under 1,024 characters and include specific trigger keywords.
plugin-release-checker
skill-validator
Validate skills against Anthropic best practices for frontmatter, structure, content, file organization, hooks, MCP, and security (62 rules in 8 categories). Use when creating new skills, updating existing skills, before publishing skills, reviewing skill quality, or when user mentions "validate skill", "check skill", "skill best practices", "skill review", or "lint skill".
sync-docs
Sync official Anthropic documentation and analyze impact on project components. Runs docs/reference/update-claude-docs.sh, computes diffs, and reports impacts on the skill validator, plugins, and project documentation. Use when user mentions "sync docs", "update reference docs", "refresh docs", or "check doc changes".
research-frontmatter
Enforce standard YAML frontmatter on research documents in docs/research/. Use when creating, editing, or promoting research files, when user mentions "research metadata", "research frontmatter", or "research staleness".
deep-research
Deep research on technical topics using EXA tools with intelligent two-tier caching. Use when user asks to research a topic, investigate best practices, look up information, find patterns, or explore architectures. Also invoked by /research command. Triggers: "research", "look up", "investigate", "deep dive", "find information about", "what are best practices for", "how do others implement".
Didn't find tool you were looking for?