Chuyển đến nội dung
Skillpedia
Bảo mật48k · #6094

varlock

Skill này làm gì

Varlock là công cụ giúp quản lý thông tin nhạy cảm (như mật khẩu và khóa API) trong các dự án lập trình của bạn. Nó đảm bảo các thông tin này không vô tình hiện trong nhật ký hoặc lịch sử lệnh, giúp mã của bạn an toàn hơn.

Khi nào nên dùng

  • ✓Khi bạn cần dùng mật khẩu hoặc khóa API trong một dự án.
  • ✓Khi bạn chia sẻ mã hoặc lịch sử lệnh với người khác.
  • ✓Khi bạn muốn đảm bảo thông tin bí mật không bị lộ trong nhật ký lỗi.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/varlock/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/varlock/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để kiểm tra khóa API của tôi đã được thiết lập đúng mà không để lộ nó?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Varlock hoạt động bằng cách đặt quy tắc cho cách xử lý thông tin nhạy cảm. Nó có thể kiểm tra xem thông tin cần thiết đã có chưa và che giá trị thực trong mọi kết quả đầu ra, để chúng không bị nhìn thấy.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Varlock Security Skill

Secure-by-default environment variable management for Claude Code sessions.

Repository: https://github.com/dmno-dev/varlock Documentation: https://varlock.dev

When to Use

  • You need to work with environment variables or secrets in a Claude Code session without exposing their values.
  • The task involves validating, loading, or auditing secrets while keeping them out of logs, diffs, and assistant context.
  • You want a secure-by-default workflow built around Varlock instead of direct .env inspection.

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

# ❌ 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

# ❌ NEVER DO THIS - exposes all secrets
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

# ❌ NEVER DO THIS - exposes secret in error
test -n "$API_KEY" && echo "Key: $API_KEY"

# ✅ DO THIS - Varlock validates and masks
varlock load
# Output shows: API_KEY 🔐sensitive └ ▒▒▒▒▒

Rule 4: Never Include Secrets in Commands

# ❌ NEVER DO THIS - secret in command history
curl -H "Authorization: Bearer sk_live_xxx" https://api.example.com

# ✅ DO THIS - use environment variable
curl -H "Authorization: Bearer $API_KEY" https://api.example.com
# Or better: varlock run -- curl ...

Quick Start

Installation

# Install Varlock CLI
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -sSfL https://varlock.dev/install.sh -o "$tmpdir/varlock-install.sh"
cat "$tmpdir/varlock-install.sh"  # review the full installer before executing
sh "$tmpdir/varlock-install.sh" --force-no-brew

# Add to PATH (add to ~/.zshrc or ~/.bashrc)
export PATH="$HOME/.varlock/bin:$PATH"

# Verify
varlock --version

Initialize Project

# Create .env.schema from existing .env
varlock init

# Or create manually
touch .env.schema

Schema File: .env.schema

The schema defines types, validation, and sensitivity for each variable.

Basic Structure

# Global defaults
# @defaultSensitive=true @defaultRequired=infer

# Application
# @type=enum(development,staging,production) @sensitive=false
NODE_ENV=development

# @type=port @sensitive=false
PORT=3000

# Database - SENSITIVE
# @type=url @required
DATABASE_URL=

# @type=string @required @sensitive
DATABASE_PASSWORD=

# API Keys - SENSITIVE
# @type=string(startsWith=sk_) @required @sensitive
STRIPE_SECRET_KEY=

# @type=string(startsWith=pk_) @sensitive=false
STRIPE_PUBLISHABLE_KEY=

Security Annotations

Annotation Effect Use For
@sensitive Redacted in all output API keys, passwords, tokens
@sensitive=false Shown in logs Public keys, non-secret config
@defaultSensitive=true All vars sensitive by default High-security projects

Type Annotations

Type Validates Example
string Any string @type=string
string(startsWith=X) Prefix validation @type=string(startsWith=sk_)
string(contains=X) Substring validation @type=string(contains=+clerk_test)
url Valid URL @type=url
port 1-65535 @type=port
boolean true/false @type=boolean
enum(a,b,c) One of values @type=enum(dev,prod)

Safe Commands for Claude

Validating Environment

# Check all variables (safe - masks sensitive values)
varlock load

# Quiet mode (no output on success)
varlock load --quiet

# Check specific environment
varlock load --env=production

Running Commands with Secrets

# Inject validated env into command
varlock run -- npm start
varlock run -- node script.js
varlock run -- pytest

# Secrets are available to the command but never printed

Checking Schema (Safe)

# Schema is safe to read - contains no values
cat .env.schema


…
Câu hỏi thường gặp

‘Biến môi trường’ là gì?

Chúng giống như những tờ ghi chú dán cho chương trình, nơi bạn lưu thông tin như mật khẩu hoặc khóa API, thay vì viết trực tiếp vào mã. Varlock giúp quản lý các ghi chú này an toàn.

Vì sao tôi không nên để lộ mật khẩu hoặc khóa API?

Việc để lộ có thể cho phép kẻ xấu đánh cắp quyền truy cập vào tài khoản hoặc dữ liệu của bạn. Giống như để chìa khóa nhà ở chỗ ai cũng thấy.

Tệp `.env.schema` là gì?

Đó là tệp mô tả thông tin nhạy cảm mà dự án cần và chúng nên có dạng như thế nào (ví dụ: là mật khẩu hay địa chỉ URL). Tệp không chứa giá trị thật, chỉ có các quy tắc, nên xem được an toàn.

Chi tiết

Mô tả gốc của tác giả

Secure-by-default environment variable management for Claude Code sessions.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#6094
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự