varlock

Manage environment variables and secrets using .env.schema files and the varlock CLI.

Updated Sep 5, 2023
One-click install
npx skills add https://github.com/eyenalxai/dotfiles --skill varlock-eyenalxai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: varlock
Source: https://github.com/eyenalxai/dotfiles/tree/main/.agents/skills/varlock
Command: npx skills add https://github.com/eyenalxai/dotfiles --skill varlock-eyenalxai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing environment variables and secrets across projects often leads to leaked credentials in logs, terminals, or AI agent context, plus drift between .env files and actual code usage. This Skill guides secure env var management with varlock so secrets stay masked and schemas stay the single source of truth. ## Core Features & Use Cases - Schema-driven config: Create and edit .env.schema files with @decorator syntax for types, validation, sensitivity, and documentation, replacing fragile .env.example files. - Secret-safe workflows: Load and validate env vars with sensitive values redacted, encrypt local secrets with hardware-backed encryption, and reference external providers like 1Password, AWS, or Vault via plugins. - Framework integration and migration: Wire varlock into Next.js, Vite, Astro, and other frameworks, or migrate existing projects away from dotenv. - Use Case: A developer asks the AI to add a new API key to their project. The Skill ensures the key is declared in .env.schema as @sensitive, the actual value is set by the user locally or via a secret provider, and validation runs with varlock load --agent without ever exposing the secret. ## Quick Start Ask the AI to set up varlock in your project by running varlock init --agent and generating a .env.schema from your existing .env files.

Frequently Asked Questions about varlock

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

FAQPage Schema
How do I manage environment variables securely with varlock?

Define all env vars in a committed .env.schema file using @decorator comments for types, sensitivity, and defaults. Set actual secret values in gitignored .env.local files or external providers, then validate with varlock load --agent, which redacts sensitive values.

How do I migrate from dotenv to varlock?

Run varlock init --agent to auto-generate a .env.schema from your existing .env and .env.example files, then review the generated schema since heuristics are a draft. Replace dotenv/config or dotenvx run with the varlock framework integration or varlock run.

Can varlock load secrets from 1Password or AWS Secrets Manager?

Yes, varlock plugins let you reference secrets from 1Password, AWS Secrets Manager, Vault, Azure Key Vault, and other providers directly in .env.schema. Add @plugin(@varlock/1password-plugin) in the schema header and use resolver functions like op() to fetch values at load time.

Is it safe for an AI agent to read my .env file?

No, reading .env or .env.local directly can expose plaintext secrets to the agent context. Instead run varlock load for masked output or read .env.schema, which contains only schema definitions and no secret values.

How do I encrypt secrets in .env.local with varlock?

Set the value to varlock(prompt) and run varlock load to be prompted securely, or run varlock encrypt --file .env.local to encrypt all sensitive values in place. Encryption is hardware-backed via Secure Enclave on macOS, DPAPI on Windows, and TPM2 on Linux.

Does varlock work with Next.js, Vite, and other frameworks?

Yes, varlock provides official integrations for Next.js, Vite, Astro, SvelteKit, Bun, Cloudflare, Expo, and others. When an integration is active it handles env loading automatically, so varlock run is only needed for scripts the integration does not cover.