Skip to content
Back to skills

C2f Variables System

ASecurity

READ BEFORE adding user-facing text, labels, titles, tooltips, errors or alerts in code. Uses the variables system for localization and tenant customization.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmentjavascriptjavaphpsqlapi

Works with

  • api

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add otavioserra/conn2flow-ai-workspace --skill c2f-variables-system --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of C2f Variables System?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for C2f Variables System
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/otavioserra-c2f-variables-system-conn2flow-ai-workspace/badge)](https://www.skillsdirectory.com/skills/otavioserra-c2f-variables-system-conn2flow-ai-workspace)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: c2f-variables-system
description: "READ BEFORE adding user-facing text, labels, titles, tooltips, errors or alerts in code. Uses the variables system for localization and tenant customization."
user-invocable: false
---

# ⚡ MANDATORY TRIGGER
- **TRIGGER**: Write, change or add any visible text, label, validation message, title or alert in PHP, HTML or JavaScript files.
- **SKIP ONLY IF**: Strict technical identifiers (names of SQL columns, array keys, CSS classes or internal slugs).
- **CONSEQUENCE OF IGNORING**: Summary rejection of the PR by inclusion of hardcoded text, breach of internationalization (i18n) and impossibility of text alteration via variable panel.

---

---
name: c2f-variables-system
description: "Always use to write text, error messages, alerts, labels or any interface string. See BEFORE you use literal text in PHP, HTML or JS."
user-invocable: false
---

# Conn2Flow Multilingual Message and Variable System

> [!CAUTION]
> **WRITER PROGRAMME FIXED LITERAL TEXT PROHIBITED**:
> It is strictly prohibited to insert fixed literal texts (hardcoded strings) into PHP, HTML or JavaScript code for:
> - Error or success messages
> - Interface Alerts and Warnings
> - Labels of forms and buttons
> - Titles, descriptions and placeholders
> - Any text visible to the final user
>
> ALL texts MUST be declared in the **Variable System** and consumed via the API.

## 1. Declaration of Variables

### 1.1. Global Variables
File: `gestor/resources/<lang>/variables.json`

```json
{
  "minha-variavel": {
    "valor": "Texto visível ao usuário",
    "descricao": "Descrição interna para o administrador"
  },
  "erro-permissao": {
    "valor": "Você não tem permissão para acessar este recurso.",
    "descricao": "Mensagem de erro de permissão"
  }
}
```

### 1.2. Modulu Variables
File: `modulos/<modulo-id>/<modulo-id>.json`, inside `resources.<lang>.variables` key:

```json
{
  "resources": {
    "pt-br": {
      "variables": {
        "titulo-listagem": {
          "valor": "Lista de Registros",
          "descricao": "Título da página de listagem"
        }
      }
    }
  }
}
```

---

## 2. Variable Consumption

### 2.1. PHP
```php
// Variável global
$texto = gestor_variaveis(['id' => 'minha-variavel']);

// Variável de módulo
$texto = gestor_variaveis(['modulo' => 'meu-modulo', 'id' => 'titulo-listagem']);
```

### 2.2. HTML / Resource Templates
```html
<!-- Substituição direta no template engine -->
<h1>@[[titulo-listagem]]@</h1>
<p>[[descricao-pagina]]</p>

<!-- Alternativa: substituição via modelo_var_troca() no PHP que renderiza o template -->
```

### 2.3. In JavaScript (via date attributes or PHP variables injected)
```html
<div data-msg-erro="@[[erro-permissao]]@"></div>
```
```javascript
const msg = element.dataset.msgErro;
```

---

## 3. Compilation Flow

1. Edit `variables.json` (global) or `<modulo>.json` (module)
2. `atualizacao-dados-recursos.php` compiles for `VariaveisData.json`
3. `atualizacoes-banco-de-dados.php` applies Upsert in the `variaveis` table
4. Runtime consumes via `gestor_variaveis()` or template replacement

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.