Skip to content
Development
Command

/sxgen

Generate Protheus SX data dictionary configuration scripts - SX2 tables, SX3 fields, SIX indexes, SXG groups, SXA folders, SX1 questions, SX5 generic tables, SXB lookups, SX7 triggers

From plugin
advpl-specialist
17613 skills10 agents13 commands2 hooks
Install
> /plugin marketplace add thalysjuvenal/advpl-specialist
> /plugin install advpl-specialist@advpl-specialist-marketplace

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/sxgen

Context preview

What this command does when you run it.

Generate Protheus SX data dictionary configuration scripts - SX2 tables, SX3 fields, SIX indexes, SXG groups, SXA folders, SX1 questions, SX5 generic tables, SXB lookups, SX7 triggers

Command definition

sxgen.md
description: Generate Protheus SX data dictionary configuration scripts - SX2 tables, SX3 fields, SIX indexes, SXG groups, SXA folders, SX1 questions, SX5 generic tables, SXB lookups, SX7 triggers
allowed-tools: Read, Write, Glob, Grep, Bash, Agent
argument-hint: "[--type sx2|sx3|six|sxg|sxa|sx1|sx5|sxb|sx7] [--output path]"

**IMPORTANT:** Always respond in the same language the user is writing in. If the user writes in Portuguese, respond in Portuguese. If in English, respond in English.

/advpl-specialist:sxgen

Generate Protheus data dictionary configuration scripts for SX tables.

Usage

/advpl-specialist:sxgen [options]

Describe what you need in natural language after the command. The agent will parse your description and generate the configuration.

Options

| Flag | Description | Default | |------|------------|---------| | `--type` | SX type: `sx2`, `sx3`, `six`, `sxg`, `sxa`, `sx1`, `sx5`, `sxb`, `sx7` | Auto-detect from description | | `--output` | Save script to file path | Display in chat |

Configuration Types

| Type | What it generates | |------|-------------------| | `sx2` | Table header (X2_CHAVE, X2_ARQUIVO, X2_NOME, X2_MODO) — required before SX3 for new custom tables | | `sx3` | Field definitions (X3_ARQUIVO, X3_CAMPO, X3_TIPO, etc.) + SX7 triggers | | `six` | Index definitions (INDICE, ORDEM, CHAVE, NICKNAME) | | `sxg` | Field group (XG_GRUPO, XG_TAMANHO, XG_TIPO) — shared size contract across tables | | `sxa` | Form folder/tab (XA_ALIAS, XA_ORDEM, XA_DESCRIC) for MVC views | | `sx1` | Report question definitions (X1_GRUPO, X1_PERGUNT, X1_TIPO) | | `sx5` | Generic table entries (X5_TABELA, X5_CHAVE, X5_DESCRI) | | `sxb` | F3 standard query / lookup (XB_ALIAS, XB_TIPO 1-4, XB_CONTEM) | | `sx7` | Field triggers (X7_CAMPO, X7_REGRA, X7_CDOMIN) — usually auto-generated by `sx3` when F3 is set |

Auto-Validations

The command automatically:

  • Validates field types and sizes
  • Generates pictures based on type (currency, date, code)
  • Adds NaoVazio() for required fields
  • Adds ExistCpo() for fields with F3 lookup
  • Adds Pertence() for fields with combo options
  • Generates SX7 triggers for F3 lookup fields
  • Includes 3-language support (pt-BR, es, en)
  • Ensures FILIAL is first in indexes

Process

1. **Parse input** — Identify type and field specifications from natural language 2. **Load SX configuration reference** — Read `skills/sx-configuration/reference.md` 3. **Delegate to sx-configurator agent** — Pass parsed requirements 4. **Validate** — Check types, sizes, pictures, validations 5. **Generate script** — Formatted key-value blocks with all fields 6. **Deliver** — Display or save to output file

Examples

# Generate SX3 field definitions from description
/advpl-specialist:sxgen --type sx3
Criar campos para tabela ZA1 - Ordens de Servico:
- ZA1_CODIGO: codigo da OS, char 6, obrigatorio
- ZA1_DESCRI: descricao do servico, char 40, obrigatorio
- ZA1_CLIENT: codigo do cliente, char 6, valida na SA1
- ZA1_STATUS: status, char 1, combo 1=Aberta;2=Em Andamento;3=Concluida;4=Cancelada

# Generate SIX index definitions
/advpl-specialist:sxgen --type six
Indices para ZA1:
- Indice 1: filial + codigo (unico)
- Indice 2: filial + cliente + data abertura

# Generate SX1 report questions
/advpl-specialist:sxgen --type sx1
Perguntas para relatorio de OS (grupo ZA1):
- Data abertura de/ate
- Status de/ate
- Cliente de/ate

# Generate SX5 generic table
/advpl-specialist:sxgen --type sx5
Tabela generica ZZ para tipos de servico:
01=Preventiva, 02=Corretiva, 03=Instalacao

# Save to file
/advpl-specialist:sxgen --type sx3 --output config/ZA1-campos.txt

Output

Formatted configuration script with:

  • Header with table name, date, and generator info
  • Complete field definitions with all required attributes
  • Auto-generated validations and pictures
  • SX7 triggers (for SX3 with F3 lookups)
  • Ready for manual input in Configurador or reference for APSDU/UPDDISTR import
Read more
Ships withadvpl-specialist

Plugin para Claude Code especializado em ADVPL e TLPP para desenvolvimento no ecossistema TOTVS Protheus — para desenvolvedores e consultores funcionais. Documentacao completa:

Get the whole plugin