advpr
Gera scripts de automação de testes ADVPR (Advanced Protheus Robot) - TestSuite, TestGroup, TestCase para rotinas MVC, ExecAuto, relatórios, processamento,…
Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus
> /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.
/generateContext preview
What this command does when you run it.
Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus
description: Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, WebSearch, WebFetch argument-hint: "<type> [name] [--module module]"
**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. Adapt all explanations and suggestions to the user's language. Code comments may remain in English or match the user's language.
Generate new ADVPL or TLPP code following Protheus conventions and best practices.
/advpl-specialist:generate <type> [name] [--module <module>]
| Type | Description | Output | |------|------------|--------| | `function` | User Function | .prw file | | `class` | TLPP class | .tlpp file | | `mvc` | MVC structure (MenuDef, ModelDef, ViewDef) | .prw file | | `rest` | REST API endpoint | .prw or .tlpp file | | `ponto-entrada` | Entry point | .prw file | | `webservice` | SOAP Web Service | .prw file | | `treport` | TReport report | .prw file | | `fwformbrowse` | FWFormBrowse/FWExecView screen | .prw file | | `job` | Batch job / scheduled process | .prw or .tlpp file | | `workflow` | Approval workflow process | .prw file |
| Flag | Description | Default | |------|------------|---------| | `--module` | Module prefix (COM, FAT, FIN, etc.). For TLPP output, also used as the namespace agrupador: `custom.<module>.<servico>` | Ask user | | `--lang` | Language: advpl or tlpp | advpl for function/mvc/pe, tlpp for class | | `--output` | Output file path | Current directory + name + extension. **Do NOT scan the project to infer a path** — if the user wants a specific location, they must pass `--output` explicitly or answer a question about it. |
> **TLPP namespace (mandatory for `.tlpp` files):** every generated `.tlpp` file declares a `namespace custom.<agrupador>.<servico>` line right after the includes. The generator derives the namespace from `--module` (as agrupador) plus the service/class name (as servico), all lowercase with no underscores. If `--module` is not provided, the generator asks the user for the agrupador during the Planning Phase. See [advpl-code-generation — TLPP Namespace Rules](../skills/advpl-code-generation/reference.md) for the complete rule.
**MANDATORY: Always enter planning mode before generating code. Never skip planning.**
**Do NOT scan the customer's project source files.** The plugin is template-driven — all code is generated from the plugin's own templates and skills. Reading existing `.prw` / `.tlpp` / `.prx` files from the customer's project is **not required** for any `/generate` scenario and must be avoided because:
**Allowed uses of `Read` / `Glob` / `Grep`:**
**Forbidden uses:**
**Output path rule:** Save the generated file to the **current working directory** using `<name>.<ext>` (or the path passed via `--output`). Never `Glob` to discover module folders, never "guess" the right location by scanning. If the user has a preferred location, either they pass `--output` or the generator asks a direct question.
**Only exception:** The user explicitly references an existing file in their request (e.g., *"gere um REST similar ao que está em `src/fontes/FATA001.prw`"*). In that case, `Read` is allowed **only** on the exact path the user provided — never expanded into a full-project scan.
1. **Parse arguments** - Extract type, name, and flags 2. **Ask missing details** - If name or module not provided, ask the user. **For TLPP generation (`.tlpp` output), also collect the namespace agrupador: if `--module <agrupador>` is provided, infer `namespace custom.<agrupador>.<servico>` automatically; if `--module` is missing, ask the user explicitly for the agrupador before entering plan mode. Never silently omit the namespace and never invent a default.** 2a. **Validate identifier length (BLOCKING)** - Compute `len(name)` and compare against the effective limit for the chosen language/construct: `User Function` in `.prw` must be ≤ 8 chars, `Static Function` in `.prw` must be ≤ 10 chars, TLPP with `namespace` accepts up to 255 chars. If the name exceeds the limit, **do NOT enter plan mode**. Present the user with two explicit options and wait for their choice:
Plugin para Claude Code especializado em ADVPL e TLPP para desenvolvimento no ecossistema TOTVS Protheus — para desenvolvedores e consultores funcionais. Documentacao completa:
Gera scripts de automação de testes ADVPR (Advanced Protheus Robot) - TestSuite, TestGroup, TestCase para rotinas MVC, ExecAuto, relatórios, processamento,…
Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis
Look up Protheus documentation - native functions, SX data dictionary, REST APIs, MV parameters, and framework reference
Generate technical documentation from ADVPL/TLPP source code - Protheus.doc headers, routine docs, API docs
Explain ADVPL/TLPP code in plain language for developers and functional consultants
Migrate ADVPL procedural code to TLPP object-oriented code with classes, namespaces, and modern patterns