Agent skill
varlock
Gerenciamento de secrets e .env
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/varlock-brunoccteixeira-ta-na-mao
SKILL.md
Gerenciamento seguro de variaveis de ambiente e secrets.
Arquivos de Configuracao
backend/
├── .env # Valores reais (NAO COMMITAR)
├── .env.example # Template (commitar)
└── .env.test # Valores para testes (opcional)
Estrutura do .env.example
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
REDIS_URL=redis://localhost:6379/0
# APIs Externas
GOOGLE_MAPS_API_KEY=
BRASIL_API_KEY=
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
# Agente IA
GEMINI_API_KEY=
OPENAI_API_KEY=
# Aplicacao
SECRET_KEY=
DEBUG=false
LOG_LEVEL=INFO
Regras de Seguranca
1. Nunca Commitar Secrets
# .gitignore deve conter:
.env
.env.local
*.key
*.pem
credentials.json
2. Verificar Antes de Commit
# Verificar se .env esta sendo tracked
git status | grep .env
# Se aparecer, remover do tracking
git rm --cached .env
3. Rotacionar Secrets Expostos
Se um secret foi commitado:
- Revogar imediatamente (gerar novo)
- Atualizar em todos os ambientes
- Verificar logs de uso suspeito
Carregar Variaveis
Python (backend)
from dotenv import load_dotenv
import os
load_dotenv()
DATABASE_URL = os.getenv("DATABASE_URL")
API_KEY = os.getenv("API_KEY")
Docker Compose
services:
backend:
env_file:
- .env
Linha de Comando
# Carregar e executar
source .env && python script.py
# Ou com export
export $(cat .env | xargs) && python script.py
Validacao de Variaveis
# backend/app/config.py
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
DATABASE_URL: str
REDIS_URL: str
GEMINI_API_KEY: str
DEBUG: bool = False
class Config:
env_file = ".env"
settings = Settings() # Valida na inicializacao
Checklist de Seguranca
-
.envesta no.gitignore? -
.env.exampletem todas as variaveis (sem valores)? - Secrets de producao diferentes de dev?
- API keys tem escopo minimo necessario?
- Secrets rotacionados periodicamente?
Secrets por Ambiente
| Variavel | Dev | Prod |
|---|---|---|
| DEBUG | true | false |
| DATABASE_URL | localhost | RDS/Cloud |
| LOG_LEVEL | DEBUG | INFO |
| API_KEY | Key de dev | Key de prod |
Comandos Uteis
# Verificar variaveis carregadas
env | grep -E "DATABASE|REDIS|API"
# Validar .env existe
test -f .env && echo "OK" || echo "FALTA .env"
# Copiar template
cp .env.example .env
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?