secrets-management

Implements secure credential storage for VS Code extensions using the SecretStorage API.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/fabioc-aloha/BrainBenchmark --skill secrets-management-fabioc-aloha
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: secrets-management
Source: https://github.com/fabioc-aloha/BrainBenchmark/tree/main/.github/skills/secrets-management
Command: npx skills add https://github.com/fabioc-aloha/BrainBenchmark --skill secrets-management-fabioc-aloha

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Storing API keys and tokens in plaintext .env files or hardcoding them in source code exposes credentials to leaks and accidental commits. This Skill provides patterns for securely storing, migrating, and managing credentials in VS Code extensions using the OS-encrypted SecretStorage API. ## Core Features & Use Cases - SecretStorage Implementation: Store, retrieve, and delete tokens using VS Code's encrypted storage backed by Windows Credential Manager, macOS Keychain, or Linux Secret Service. - Environment Variable Migration: Detect secrets in .env files and migrate them non-destructively to SecretStorage with fallback compatibility. - Bidirectional Secrets Flow: Export SecretStorage tokens back to .env files so PowerShell scripts, CLI tools, and CI/CD pipelines can access them. - Use Case: You are building a VS Code extension that calls an external API. Use this Skill to implement a token manager with quick pick UI, password-masked input, validation, and automatic migration of existing environment variables. ## Quick Start Ask the AI to implement a secrets manager service for your VS Code extension that stores API tokens in SecretStorage and migrates existing .env credentials.

Frequently Asked Questions about secrets-management

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

FAQPage Schema
How do I store API keys securely in a VS Code extension?▼

Use the VS Code SecretStorage API via context.secrets to store credentials with OS-level encryption. Call secrets.store(key, value) to save and secrets.get(key) to retrieve, with storage backed by Windows Credential Manager, macOS Keychain, or Linux Secret Service.

How to migrate environment variables to VS Code SecretStorage?▼

Scan workspace .env files for secret patterns like API_KEY or TOKEN, then copy matching values into SecretStorage using secrets.store. Keep the original env vars as a non-destructive fallback so existing workflows continue working during migration.

Can PowerShell scripts access VS Code SecretStorage?▼

No, SecretStorage is only accessible within the VS Code extension host. Export secrets to a .env file so PowerShell scripts can source the values as environment variables, and add the .env file to .gitignore since it contains plaintext.

Why is my SecretStorage token not available synchronously?▼

SecretStorage methods are asynchronous, but many VS Code APIs require synchronous access. Pre-load all tokens into an in-memory Map cache during extension activation, then read from the cache for synchronous getters.

What are the limitations of exporting secrets to .env files?▼

Exported .env files contain plaintext secrets and must be added to .gitignore to prevent accidental commits. The export is a snapshot, so you must re-export whenever tokens change in SecretStorage.