Varlock Skill
Varlock Skill for Claude Code
A Claude Code skill that keeps .env secrets out of the agent's context: validation and runs through Varlock with masked values
Install
mkdir -p ~/.claude/skills/varlock && curl -sSL https://raw.githubusercontent.com/wrsmith108/varlock-claude-skill/main/skills/varlock/SKILL.md -o ~/.claude/skills/varlock/SKILL.mdInstalls only the skill file.
This is third-party code. Review the repository files before installing.
What it does
The skill gives the agent rules for handling environment variables via the Varlock CLI. The agent does not read .env or print secrets with echo or printenv; it reads the value-free .env.schema instead. It validates keys with varlock load, which masks sensitive values, and runs commands needing secrets through varlock run. Requests to change a secret are declined, and the user is asked to do it by hand.
Who it is for. For developers using Claude Code on projects with API keys and passwords in .env.
Good fit when
- You want the agent to check key setup without seeing values
- You need to run the app with secrets from an agent session without leaking them to logs
- You want to describe project variables in a schema with types and sensitivity
Not a fit when
- Secrets already live in a secrets manager and never reach project files
- You will not install Varlock or maintain .env.schema
Example request
Check whether the Stripe keys are set in this project without showing their valuesLimitations
The skill is instructions only and does not technically block reading .env; protection depends on the agent following the rules. It requires the Varlock CLI and a .env.schema file in the project. Per the README, Varlock installs by downloading and running a script from varlock.dev.
How to disable. Delete the ~/.claude/skills/varlock folder.
Security check
- The skill consists of instructions that restrict how the agent handles secrets
README in short
The README explains how secrets leak into terminal output, model context, logs and commits, and how the skill prevents it. Install with a single curl command or by copying from a clone; the Varlock CLI installs separately. It includes a table of safe replacements for risky commands, an annotated .env.schema example and responses to secret-related requests. MIT licensed.
SKILL.md
--- name: varlock description: Secure environment variable management with Varlock. Use when handling secrets, API keys, credentials, or any sensitive configuration. Ensures secrets are never exposed in terminals, logs, traces, or Claude's context. Trigger phrases include "environment variables", "secrets", ".env", "API key", "credentials", "sensitive", "Varlock". version: 1.0.0 --- # Varlock Security Skill Secure-by-default environment variable management for Claude Code sessions. > **Repository**: https://github.com/dmno-dev/varlock > **Documentation**: https://varlock.dev ## Core Principle: Secrets Never Exposed When working with Claude, secrets must NEVER appear in: - Terminal output - Claude's input/output context - Log files or traces - Git commits or diffs - Error messages This skill ensures all sensitive data is properly protected. --- ## CRITICAL: Security Rules for Claude ### Rule 1: Never Echo Secrets ```bash # ❌ NEVER DO THIS - exposes secret to Claude's context echo $CLERK_SECRET_KEY cat .env | grep SECRET printenv | grep API # ✅ DO THIS - validates without exposing varlock load --quiet && echo "✓ Secrets validated" ``` ### Rule 2: Never Read .env Directly ```bash # ❌ NEVER DO THIS - exposes secret to Claude's context cat .env less .env Read tool on .env file # ✅ DO THIS - read schema (safe) not values cat .env.schema varlock load # Shows masked values ``` ### Rule 3: Use Varlock for Validation ```bash # ❌ NEVER DO THIS - exposes secret in error test -n "$API_KEY" && echo "Key: $API_KEY"
FAQ
What is .env.schema?
A file with variable names and annotations such as @sensitive, @required and @type, but no values. It is safe for the agent to read.
Does the skill guarantee secrets never leak?
No, these are rules for the agent. They reduce risk but do not technically block file reads.
Related
NVIDIA's open stack for running OpenClaw, Hermes and LangChain Deep Agents in OpenShell sandboxes with network policy and managed inference
Static code analysis with rules that look like source code, plus a built-in MCP server for AI agents
Trail of Bits skills
Trail of Bits Skills Marketplace
Trail of Bits plugin marketplace for security work: smart contracts, C/C++ and Rust review, Semgrep, CodeQL and fuzzing
Nine skills that let an agent run Strix pentests, fix validated findings and add security scanning to CI