Claude Code
Claude Code is Anthropic’s CLI for AI-assisted coding. Use varlock to inject ANTHROPIC_API_KEY at runtime so the key never sits in a plain text .env or shell history.
For install, schema setup, and shared patterns, see the AI Tools overview.
Environment variable: ANTHROPIC_API_KEY (see supported env variables). Use the API key, not CLAUDE_CODE_OAUTH_TOKEN: that (from claude setup-token) only works for headless claude -p requests, not the interactive TUI.
In a project
Section titled “In a project”Add to .env.schema:
# @sensitive @requiredANTHROPIC_API_KEY=op(op://api-local/anthropic/api-key)varlock run -- claudeFrom any directory
Section titled “From any directory”Personal schema at ~/.env.claude:
# @sensitive @requiredANTHROPIC_API_KEY=op(op://api-local/anthropic/api-key)varlock run -p ~/.env.claude -- claudeShell alias (optional)
Section titled “Shell alias (optional)”alias vclaude='varlock run -p ~/.env.claude --no-redact-stdout -- claude'--no-redact-stdout keeps Claude’s own terminal output unredacted while secrets stay out of your shell history.