---
name: ADVPL Code Generation
slug: advpl-code-generation
category: AI Engineering
description: ADVPL Code Generation generates new ADVPL and TLPP code for TOTVS Protheus, including functions, classes, MVC screens, REST/SOAP services, reports, jobs, and workflows. Use it when creating new .prw or .tlpp files with required naming and structure rules.
github: "https://github.com/thalysjuvenal/advpl-specialist/tree/main/skills/advpl-code-generation"
language: Shell
stars: 186
forks: 37
install: "npx degit https://github.com/thalysjuvenal/advpl-specialist/tree/main/skills/advpl-code-generation ~/.claude/skills/advpl-code-generation"
installs_to: ~/.claude/skills/advpl-code-generation
source_path: skills/advpl-code-generation/SKILL.md
collection_size: 18
category_size: 3278
collection_url: "https://dirskills.com/collections/thalysjuvenal/advpl-specialist"
added: 2026-09-06T05:20:26.769Z
last_synced: 2026-09-06T05:20:26.769Z
canonical_url: "https://dirskills.com/skills/advpl-code-generation"
---

# ADVPL Code Generation

ADVPL Code Generation generates new ADVPL and TLPP code for TOTVS Protheus, including functions, classes, MVC screens, REST/SOAP services, reports, jobs, and workflows. Use it when creating new .prw or .tlpp files with required naming and structure rules.

**Install:**

```bash
npx degit https://github.com/thalysjuvenal/advpl-specialist/tree/main/skills/advpl-code-generation ~/.claude/skills/advpl-code-generation
```

## README

# ADVPL/TLPP Code Generation

This skill provides patterns, templates, and mandatory structural rules for generating new ADVPL (`.prw`) and TLPP (`.tlpp`) code for TOTVS Protheus. It covers naming conventions (module prefixes, Hungarian notation), the mandatory User Function skeleton with Protheus.doc headers and error handling, variable scope rules, TLPP namespace conventions (`custom.<agrupador>.<servico>`), and the 8/10/255-character identifier length limits per construct type.

Activate this skill whenever the user requests new code creation: a new function, a TLPP class, an MVC screen, a REST endpoint, a SOAP web service, an entry point, a report, a batch job, or any new `.prw`/`.tlpp` file. It does not cover reviewing existing code (see `advpl-code-review`), fixing errors in existing code (see `advpl-debugging`), improving existing code structure without adding features (see `advpl-refactoring`), or converting legacy `.prw` to `.tlpp` (see `advpl-to-tlpp-migration`).

The reference and pattern files below hold the concrete templates -- read the specific pattern file that matches the type of code being generated instead of relying on memory.

| Reference file | Read when |
|---|---|
| reference.md | Always -- overview, naming conventions, mandatory User Function structure, namespace rules, identifier length limits, common mistakes |
| templates-classes.md | Generating a TLPP class (data, methods, constructor) |
| patterns-mvc.md | Generating an MVC screen (ModelDef/ViewDef/MenuDef) |
| patterns-rest.md | Generating a REST API endpoint (WsRestFul or TLPP `@Get/@Post` annotations) |
| patterns-soap.md | Generating a SOAP Web Service |
| patterns-treport.md | Generating a TReport-based report with embedded SQL |
| patterns-pontos-entrada.md | Generating a legacy (non-MVC) entry point (ponto de entrada) |
| patterns-pontos-entrada-mvc.md | Generating an MVC-based entry point |
| patterns-workflow.md | Generating a Protheus workflow routine |
| patterns-jobs.md | Generating a scheduled/background job |
| patterns-fwmsprinter.md | Generating a coordinate-based PDF report with FWMsPrinter |
| patterns-fwformbrowse.md | Generating a browse screen with FWFormBrowse |
| catalogo-top-50-pes.md | Looking up existing well-known entry points before creating a duplicate |
