Agent skill

Protheus MVC Generator

by totvs in totvs/engpro-advpl-tlpp-skills

Generates Protheus MVC screens in ADVPL/TLPP, with ModelDef, ViewDef, MenuDef and Browse functions for single-entity and master-detail layouts.

MITAuto-check passedDevelopment

Install Protheus MVC Generator

skills CLI
$ npx skills add totvs/engpro-advpl-tlpp-skills --skill mvc-generator -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install totvs/engpro-advpl-tlpp-skills mvc-generator --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/advpl-tlpp/mvc-generator .claude/skills/mvc-generator && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mvc-generator
GitHub stars
143
Token cost
~2.2k tokens
SKILL.md length
785 words
Files
3 (incl. references)
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

Generates Protheus MVC screens in ADVPL/TLPP, with ModelDef, ViewDef, MenuDef and Browse functions for single-entity and master-detail layouts.

  • Works in 3 steps: Gather Requirements → Generate Code → Validate Against Checklist
  • Creating a CRUD screen for a Protheus table
  • SKILL.md covers Overview, When to Use, MVC Architecture in Protheus and Bundled Reference Files, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

This skill generates complete Protheus MVC screen implementations that follow the TOTVS framework. It produces the three required functions, ModelDef, ViewDef and MenuDef, plus the main function that creates an FWFormBrowse and activates the screen, built on FWFormModel and FWFormView. It supports the single-entity pattern (Modelo 1) and the master-detail pattern (Modelo 3), with validations, triggers and entry point hooks.

The uses it names are new CRUD screens for a Protheus table, master-detail forms such as an invoice header with its items, boilerplate generated from a table alias, and migrating legacy AxCadastro or Mbrowse screens to MVC. The SKILL.md holds the architecture, workflow, checklist and troubleshooting, while code templates and API details sit in two reference files, mvc-code-templates.md and mvc-api-reference.md, which the agent reads on demand.

When your agent uses it

  • Creating a CRUD screen for a Protheus table
  • Building a master-detail form such as an invoice header with items
  • Migrating a legacy AxCadastro or Mbrowse screen to MVC
  • Adding validations, triggers or entry point hooks to an MVC screen

Example prompts

  • “Generate a Modelo 3 master-detail screen for invoice headers and items.”
  • “Migrate this AxCadastro screen to Protheus MVC.”
  • “Add a field validation and a trigger to the ModelDef of my MVC screen.”

Requirements

  • A Protheus table alias to build the screen on

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Gather Requirements
  2. Generate Code
  3. Validate Against Checklist

What it can do on your machine

Read from SKILL.md and the folder at commit 3908e4e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Protheus MVC Generator loads about 2.2k tokens when it runs, and up to ~5.5k if it reads all its reference files. Until then it costs about 100 tokens; SKILL.md has 785 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~100
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from totvs/engpro-advpl-tlpp-skills at commit 3908e4e, republished under its MIT licence (© totvs). 785 words, ~2,152 tokens.

Download SKILL.mdSave it as .claude/skills/mvc-generator/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
mvc-generator
description
Generate Protheus MVC (Model-View-Controller) screen structures including ModelDef, ViewDef, MenuDef, and BrowseDef functions. Supports single-entity (Modelo 1) and master-detail (Modelo 3) patterns with FWFormModel, FWFormView, FWFormBrowse, validations, triggers, and entry point hooks. Use when user says 'create MVC screen', 'ModelDef ViewDef', 'FWFormModel', 'master-detail screen'.
license
MIT
metadata.domain
Protheus
metadata.maintainer
Customizações ADVPL/TLPP
metadata.author
Thalion Starforge
metadata.version
4.1.0
metadata.category
Code Generation

Protheus MVC Generator

Overview

Generate complete Protheus MVC screen implementations following the TOTVS framework patterns. Protheus MVC separates business rules (Model), visual presentation (View), and navigation/actions (Controller/Browse) using the FWFormModel, FWFormView, and FWFormBrowse framework classes. This skill generates the three mandatory functions (ModelDef, ViewDef, MenuDef) plus the Browse function that composes them.

When to Use

Use this skill when:

  • Creating a new CRUD screen for a Protheus table
  • Building a master-detail form (e.g., invoice header + items)
  • Generating MVC boilerplate from a table alias
  • Adding validations, triggers, and entry point hooks to MVC screens
  • Migrating legacy AxCadastro/Mbrowse screens to MVC

MVC Architecture in Protheus

Core Components
┌─────────────────────────────────────────┐
│  Main Function (e.g., MYMOD01)          │
│  ├── MenuDef()  → Menu actions          │
│  └── FWFormBrowse → Browse grid         │
│       ├── ModelDef() → Business rules   │
│       │    ├── FWFormStruct → Schema    │
│       │    ├── FWFormFieldsModel (Form) │
│       │    ├── FWFormGridModel (Grid)   │
│       │    └── Validations / Triggers   │
│       └── ViewDef()  → Visual layout    │
│            ├── FWFormStruct → Schema    │
│            ├── Form panels              │
│            └── Grid panels              │
└─────────────────────────────────────────┘
User Function Responsibilities
FunctionPurposeReturns
ModelDef()Defines the data model: fields, validations, relationships, triggersFWFormModel object
ViewDef()Defines the visual layout: panels, grids, field arrangementFWFormView object
MenuDef()Defines available actions: Include, Edit, Delete, View, CopyArray of menu items
Main FunctionCreates FWFormBrowse and activates the screen—

Bundled Reference Files

This skill uses progressive disclosure. The SKILL.md body covers the architecture, generation workflow, the checklist, and troubleshooting. Detailed code templates and API references are in the references/ directory — read them on demand based on the scenario:

Reference FileWhen to ReadContent
references/mvc-code-templates.mdGenerating MVC code — Single Entity (Modelo 1) or Master-Detail (Modelo 3) templates, event handlers, validation/commit patternsFull code templates for both MVC patterns, ModelDef/ViewDef/MenuDef boilerplate, validation handlers, commit handlers
references/mvc-api-reference.mdCustomizing FWFormStruct, adjusting View layout (boxes, tabs), configuring MenuDef actions, or adding custom menu buttonsFWFormStruct parameters, structure customization (RemoveField, SetProperty, FWBuildFeature), HBox/VBox/Folder layout, action codes table, custom actions

Also refer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference shared across skills.


Generation Workflow

Step 1: Gather Requirements

Determine the generation pattern from the user's request:

ScenarioMVC PatternKey Characteristic
Simple CRUD (single table)Single Entity (Modelo 1)AddFields only, no grid
Master-detail (header + items)Master-Detail (Modelo 3)AddFields + AddGrid + SetRelation
Legacy migration (AxCadastro/Mbrowse)Depends on current structureAnalyze existing code to choose pattern

Read the appropriate reference files based on the pattern identified:

Step 2: Generate Code

Using the selected template from the reference files, adapt it to the user's specific requirements:

  • Replace table aliases (ZZ1, ZZ2, ZZ3) with actual table aliases
  • Replace function/model IDs (MYMOD01, MYMOD01M) with actual routine names
  • Add/remove fields, validations, and triggers as needed
  • Adjust View layout proportions and structure
Step 3: Validate Against Checklist

Run through the MVC Generation Checklist below to verify completeness.


MVC Generation Checklist

Model (ModelDef)
  • FWFormStruct(1, "XXX") loaded for each table
  • Fields removed/customized as needed
  • Model created with MPFormModel():New("UNIQUE_ID")
  • AddFields called for form sections
  • AddGrid called for grid sections (master-detail)
  • Relationship defined with SetRelation for grids
  • Model and sub-model descriptions set
  • SetPrimaryKey({}) called
  • Validation handlers registered (SetVldActive, SetCommit)
  • Grid line validation registered (SetVldLine)
Show full SKILL.md (321 more words)Show less
View (ViewDef)
  • Model loaded with FWLoadModel("ROUTINE_NAME")
  • FWFormStruct(2, "XXX") loaded for each table
  • FWFormView():New() created
  • Model set with SetModel(oModel)
  • AddField and/or AddGrid called for each visual section
  • Layout boxes created (CreateHorizontalBox, CreateVerticalBox)
  • Views assigned to boxes with SetOwnerView
  • Screen proportions make sense (header vs. detail)
MenuDef
  • Standard CRUD operations included (1-5)
  • Custom actions added if needed
  • Menu item names match VIEWDEF.ROUTINE_NAME
General
  • #include "fwmvcdef.ch" present
  • #include "totvs.ch" present
  • Browse function creates FWFormBrowse and sets alias
  • Legends added to browse if the table has status fields
  • Validation messages use Help() function
  • FWFormCommit(oModel) called in commit handler for standard persistence
  • Custom tables registered in SX2/SX3 data dictionary before use
SonarQube Compliance
  • FWFormCommit(oModel) is used for persistence — never override the FormCommit method directly; use FWModelEvent to intercept commit behavior
  • No UI calls (MsgAlert, MsgYesNo, Aviso, Help, Pergunte, ParamBox) inside commit/validation handlers that execute within a transaction
  • Error handling uses Try-Catch, not ErrorBlock
  • Logging via FWLogMsg(), not ConOut()
  • No IIF() in expressions — use If/Else/EndIf
  • Includes in lowercase (e.g., #include "totvs.ch")
  • GetMV() / ExistBlock() results cached before loops (especially in grid validations)
  • No direct access to SX3 via DbSelectArea — use FWFormStruct() or FWSX3Util()

Refer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference.


Troubleshooting

  • "Field not found in SX3": The field referenced in FWFormStruct must exist in the data dictionary (SX3). Run CFGX023() or use SIGACFG to register missing fields.
  • ModelDef/ViewDef mismatch: Every field ID added to FWFormModel must have a corresponding entry in FWFormView. Verify that model and view structures reference the same field set.
  • Grid rows not saving: Ensure FWFormCommit(oModel) is called in the commit block. For master-detail, the grid model must be added with AddGrid() and linked via SetOwner().
  • Browse shows no records: Verify FWFormBrowse():SetAlias() points to the correct table alias and that the table is accessible from the current branch/company.
  • Validation not triggering: Field-level validators must be registered in SX3 (X3_VALID) or via SetFieldAction() on the model. Check that the trigger field ID matches exactly.

© totvs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/advpl-tlpp/mvc-generator of totvs/engpro-advpl-tlpp-skills.

  • SKILL.md
  • references/mvc-api-reference.md
  • references/mvc-code-templates.md

Open the folder on GitHubat commit 3908e4e

Compare with similar skills

Protheus MVC Generator next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Protheus MVC Generator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Protheus MVC Generator this skilltotvs/engpro-advpl-tlpp-skills143—~2.2kAutomated safety check: PassMIT
Nx Generatenomcopter/react-mosaic4.8k7 repos~1.9kAutomated safety check: PassCustom licence
PonytailDavidObando/gsharp5658 repos~1.7kAutomated safety check: PassMIT
Run Nx Generatornrwl/nx29k2 repos~592Automated safety check: NotesMIT
Code Refactoring Workflowluongnv89/claude-howto42k—~3.1kAutomated safety check: PassMIT
Convert Internal Package to TypeScriptTryGhost/Ghost55k—~1.2kAutomated safety check: PassMIT

Similar skills

  • Nx Generate

    nomcopter/react-mosaic

    Generate code using nx generators. An agent skill from nomcopter/react-mosaic.

    4.8k GitHub starsUsed in 7 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    565 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-check passed
  • Run Nx generators with prioritization for workspace-plugin generators.

    29k GitHub starsUsed in 2 repos~592 tokens
    DevelopmentAuto-check: notes
  • Code Refactoring Workflow

    luongnv89/claude-howto

    Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.

    42k GitHub stars~3.1k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Moves a legacy internal Ghost package from JavaScript and CommonJS to TypeScript and ESM in three focused commits that keep git file history intact.

    55k GitHub stars~1.2k tokensUpdated today
    DevelopmentAuto-check passed
  • Conductor Setup

    gemini-cli-extensions/conductor

    Scaffolds the project and sets up the Conductor environment.

    3.8k GitHub stars~4.2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed

More from totvs/engpro-advpl-tlpp-skills

All 19 skills in this repo
  • AdvPL UTF-8 to CP1252 Converter

    totvs/engpro-advpl-tlpp-skills

    Converts AdvPL and TLPP source files from UTF-8 to Windows-1252 in place after code generation, because the Protheus compiler accepts only CP1252 files.

    143 GitHub stars~2.6k tokensUpdated 3 days ago
    Auto-check passed
  • AdvPL/TLPP Compile in VS Code

    totvs/engpro-advpl-tlpp-skills

    Compiles AdvPL and TLPP sources from VS Code with the TOTVS Developer Studio extension, handling server setup, connection and compile result reporting.

    143 GitHub stars~3.7k tokensUpdated 3 days ago
    Auto-check passed
  • Protheus Spec-Driven Development

    totvs/engpro-advpl-tlpp-skills

    Plans and builds Protheus AdvPL/TLPP features through Specify, Design, Tasks and Execute phases whose depth scales with the size of the change.

    143 GitHub stars~3.6k tokensUpdated 3 days ago
    Auto-check passed
  • AdvPL and TLPP Code Review

    totvs/engpro-advpl-tlpp-skills

    Reviews AdvPL and TLPP source against SonarQube rules, ProtheusDOC requirements, security, performance and Protheus conventions, and reports findings by severity.

    143 GitHub stars~2.5k tokensUpdated 3 days ago
    Auto-check passed
  • Protheus Data Dictionary Lookup

    totvs/engpro-advpl-tlpp-skills

    Queries the TOTVS Protheus ERP data dictionary for tables, fields, indexes, parameters, triggers and lookups, including impact checks during refactoring.

    143 GitHub stars~1.5k tokensUpdated 3 days ago
    Auto-check passed
  • Query Builder

    totvs/engpro-advpl-tlpp-skills

    Build optimized and safe SQL queries for Protheus tables. An agent skill from totvs/engpro-advpl-tlpp-skills.

    143 GitHub stars~4.7k tokensUpdated 3 days ago
    Auto-check passed

Categories

Questions about Protheus MVC Generator

What does Protheus MVC Generator do?

Generates Protheus MVC screens in ADVPL/TLPP, with ModelDef, ViewDef, MenuDef and Browse functions for single-entity and master-detail layouts. This skill generates complete Protheus MVC screen implementations that follow the TOTVS framework. It produces the three required functions, ModelDef, ViewDef and MenuDef, plus the main function that creates an FWFormBrowse and activates the screen, built on FWFormModel and FWFormView.

When should I use Protheus MVC Generator?

Protheus MVC Generator fits situations like: creating a CRUD screen for a Protheus table; building a master-detail form such as an invoice header with items; migrating a legacy AxCadastro or Mbrowse screen to MVC; adding validations, triggers or entry point hooks to an MVC screen.

How do I install Protheus MVC Generator in Claude Code?

Run `npx skills add totvs/engpro-advpl-tlpp-skills --skill mvc-generator -a claude-code`. Or copy the skill folder (skills/advpl-tlpp/mvc-generator in totvs/engpro-advpl-tlpp-skills) into .claude/skills/mvc-generator in your project. Claude Code loads it when a task matches its description.

How do I install Protheus MVC Generator in Codex?

Run `npx skills add totvs/engpro-advpl-tlpp-skills --skill mvc-generator -a codex`. Or copy the skill folder (skills/advpl-tlpp/mvc-generator in totvs/engpro-advpl-tlpp-skills) into .agents/skills/mvc-generator in your project. Codex loads it when a task matches its description.

Can I use Protheus MVC Generator in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add totvs/engpro-advpl-tlpp-skills --skill mvc-generator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mvc-generator, .gemini/skills/mvc-generator, .github/skills/mvc-generator and .opencode/skills/mvc-generator in your project.

What does Protheus MVC Generator need to run?

SKILL.md names no scripts, command-line tools or credentials: Protheus MVC Generator is instructions for the agent only. Our summary lists: A Protheus table alias to build the screen on.

Does Protheus MVC Generator access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Protheus MVC Generator safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Protheus MVC Generator use?

Protheus MVC Generator is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Protheus MVC Generator use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.4k tokens, read only when the agent opens those files.

What are the alternatives to Protheus MVC Generator?

Skills that share tags, products or a category with Protheus MVC Generator: Nx Generate (nomcopter/react-mosaic, 4.8k stars), Ponytail (DavidObando/gsharp, 565 stars), Run Nx Generator (nrwl/nx, 29k stars) and Code Refactoring Workflow (luongnv89/claude-howto, 42k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Protheus MVC Generator?

totvs (a GitHub organization) maintains it in totvs/engpro-advpl-tlpp-skills, which has 143 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 5, 2026.

Source: totvs/engpro-advpl-tlpp-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.