agentleFS
otavioserraotavioserra/conn2flow/.cursor/skills/c2f-environment-configuration/SKILL.md

c2f-environment-configuration

Skill5 starsChanged 2 months agoMITView on GitHub

LEIA ANTES de adicionar ou manipular credenciais, variáveis de ambiente (.env) e configurações centrais em config.php. Se não ler: segredos vazam no repositório git público, variáveis não propagam para produção ou geram erros fatais.

  • Reads credentials

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Remove comentários HTML (<!-- ...

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Configuração de Ambiente e Variáveis Sensíveis do Conn2Flow

⚡ Gatilho Obrigatório

  • TRIGGER: Declarar, ler ou alterar variáveis de ambiente ($_ENV), constantes em gestor/config.php ou templates em autenticacoes.exemplo/.
  • SKIP APENAS SE: Valores de apresentação/UI que devem residir obrigatoriamente no sistema de variáveis (variables.json).
  • CONSEQUÊNCIA DE IGNORAR: Vazamento de credenciais privadas em repositórios públicos, erros fatais de configuração indefinida em produção ou mistura indevida de dados de apresentação no .env.

[!CAUTION] PROTOCOLO OBRIGATÓRIO PARA CREDENCIAIS E SEGREDOS: NUNCA insira credenciais, API keys, tokens ou senhas diretamente no código-fonte PHP! Todo dado sensível DEVE seguir o fluxo: .env -> config.php -> $_CONFIG ou $_GESTOR.

1. Fluxo Obrigatório para Novas Variáveis Sensíveis

Passo 1: Registrar no Template .env

Arquivo: gestor/autenticacoes.exemplo/dominio/.env

# === Minha Nova Integração ===
MINHA_API_KEY=
MINHA_API_SECRET=
MINHA_WEBHOOK_URL=

[!IMPORTANT] O arquivo autenticacoes.exemplo/ é o template de referência versionado no Git. A instalação real fica em gestor/autenticacoes/<dominio>/.env (que é gitignored). Ao registrar no template, você garante que novos deploys e desenvolvedores saibam quais variáveis configurar.

Passo 2: Mapear em gestor/config.php

// Em gestor/config.php, dentro do bloco de carregamento de configurações:
$_CONFIG['minha_api_key']    = $_ENV['MINHA_API_KEY'] ?? '';
$_CONFIG['minha_api_secret'] = $_ENV['MINHA_API_SECRET'] ?? '';
$_CONFIG['minha_webhook_url'] = $_ENV['MINHA_WEBHOOK_URL'] ?? '';

Passo 3: Consumir no Código

// Em qualquer módulo PHP:
$apiKey = $_CONFIG['minha_api_key'];
$secret = $_CONFIG['minha_api_secret'];

// Verificação antes de uso:
if (empty($_CONFIG['minha_api_key'])) {
    // Log de erro ou fallback seguro
}

2. Governança da Variável HTML_SANITIZE

O Conn2Flow utiliza a flag HTML_SANITIZE no .env para controlar a minificação e limpeza do HTML entregue:

# Habilita a higienização e minificação de HTML para visitantes públicos (padrão: true)
HTML_SANITIZE=true
  • HTML_SANITIZE=true (Padrão em Produção):
    • Remove comentários HTML (<!-- ... -->), CSS (/* ... */) e JS (// ...), compactando espaços em branco para visitantes anônimos.
    • Bypass Automático: Usuários autenticados no Gestor ou com Live Editor ativo (gestor_dashboard_toolbar_ativo() === true) têm a sanitização 100% desligada para preservar marcadores de widgets (<!-- widgets#... -->) e notas de layout.
  • HTML_SANITIZE=false (Debug Global):
    • Desativa a sanitização incondicionalmente para todos os visitantes durante depurações profundas de layout.

3. Categorias de Configuração em $_CONFIG

CategoriaExemplos de ChavesOrigem
Banco de DadosVia $_BANCO['host'], $_BANCO['nome'].env
Sessões/Cookiessession_lifetime, cookie_secure, cookie_httponly.env / hardcoded
Segurança CSP/CORScsp_policy, cors_originsconfig.php
Performance HTMLhtml_sanitize.env
OAuthoauth_google_client_id, oauth_google_secret.env
Email/SMTPsmtp_host, smtp_port, smtp_user, smtp_pass.env
Pagamentospaypal_client_id, stripe_key.env
APIs Externasopenai_api_key, anthropic_api_key.env

4. Estrutura de Diretórios

gestor/
  autenticacoes.exemplo/    <-- Template (versionado no Git)
    dominio/
      .env                  <-- Exemplo com todas as chaves documentadas
  autenticacoes/            <-- Instalação real (GITIGNORED)
    meusite.com/
      .env                  <-- Valores reais e secretos
  config.php                <-- Bootstrap: carrega .env e popula $_CONFIG, $_BANCO, $_GESTOR

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.