onepassword-cli

Access and inject 1Password CLI secrets into commands and environment files.

2|Updated Jun 2, 2024
One-click install
npx skills add https://github.com/magnusrodseth/dotfiles --skill onepassword-cli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: onepassword-cli
Source: https://github.com/magnusrodseth/dotfiles/tree/main/.claude/skills/onepassword-cli
Command: npx skills add https://github.com/magnusrodseth/dotfiles --skill onepassword-cli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill simplifies managing 1Password secrets like API keys, tokens, and credentials, allowing users to securely inject them into commands and environment files without exposing sensitive information.

Core Features & Use Cases

  • Secrets Management: Access and inject secrets from 1Password vaults directly into commands.
  • Environmental Configuration: Populate .env files or set environment variables from templates.
  • Item Creation & Editing: Create, edit, and view 1Password items using the CLI, without revealing sensitive values.
  • SSH & Git Integration: Automate SSH key operations and Git commit signing through the 1Password agent.
  • Use Case: A developer needing to run a Git commit with an SSH key that is secured within 1Password.

Quick Start

Use the 'op' command within any script or application by first setting the appropriate account context. For example, to access a specific item:

export OP_ACCOUNT=my.1password.eu
op read "op://Private/Cargo API Token/token" -o /tmp/tok && chmod 600 /tmp/tok

Frequently Asked Questions about onepassword-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inject secrets from 1Password into environment variables for CI/CD pipelines?

You inject 1Password secrets into environment variables by using the CLI to read vault items and populate `.env` files or set environment variables directly. This allows automated workflows to access credentials without exposing sensitive values.

Can I use 1Password CLI to automate SSH key operations and Git commit signing?

Yes, 1Password CLI automates SSH key operations and Git commit signing through the 1Password SSH agent. Developers can execute Git commits using SSH keys secured within their 1Password vault.

What is the best way to manage API keys and tokens in development environments without exposing them?

The best way to manage API keys and tokens securely is using 1Password CLI to access vault items directly within scripts. It allows you to retrieve credentials and write them to secured temporary files with restricted permissions.

Does 1Password CLI support creating and editing vault items without revealing sensitive values?

Yes, 1Password CLI supports creating, editing, and viewing items within your vaults without revealing sensitive values. This ensures credentials and tokens remain secure during command-line configuration management.

How do I configure my 1Password account context before accessing secrets in a script?

You configure your account context by setting the `OP_ACCOUNT` environment variable to your 1Password domain. Once set, you can seamlessly execute CLI commands to read and inject specific secrets into your scripts.

Are there limitations when managing environment configuration files with 1Password CLI?

When managing environment configuration, you must ensure your account context is properly set before executing commands. The CLI requires network access to your 1Password vault to retrieve and inject secrets into environment files.