advpl-to-tlpp-migration
Skill166 starsChanged 5 months agoMITView on GitHub
Guide the migration of legacy AdvPL (Advanced Programming Language) code to modern TLPP (TOTVS Language Plus Plus). Covers feature comparison, syntax transformation, include/namespace adoption, typing, Try-Catch, REST migration, long identifiers, JSON inline, named parameters, access modifiers, and StaticCall removal. Use when user says 'migrate to TLPP', 'convert AdvPL', 'modernize .prw to .tlpp', 'add typing'.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Use this skill when:
- Very specific: line 130
High value: Add Namespace + type annotations (catches bugs at compile time)
- Very specific: line 132
SonarQube compliance: Remove IIF, ConOut → FWLogMsg, ISAM → FWTemporaryTable, FormCommit → FWModelEvent
- Very specific: line 143
Namespace resolution errors: Ensure the Namespace declaration matches the directory structure and that callers use the fully qualified name …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AdvPL-to-TLPP Migration
Overview
Migrate legacy AdvPL source files (.prw, .prx) to modern TLPP (.tlpp) incrementally and safely. TLPP is an evolution of AdvPL that introduces modern language features while maintaining full backward compatibility with existing AdvPL constructs. This skill provides a structured migration path that can be applied gradually — no forced rewrite is required.
When to Use
Use this skill when:
- Modernizing legacy AdvPL code to TLPP
- Converting
.prwfiles to.tlpp - Adopting TLPP-exclusive features (typing, try-catch, namespace, etc.)
- Replacing prohibited constructs (e.g.,
StaticCall) in TLPP sources - Preparing code for TLPP REST migration from WsRESTful
- Onboarding developers transitioning from AdvPL to TLPP
Feature Comparison: AdvPL vs. TLPP
For the complete feature-by-feature comparison table (19 features covering scoping, control structures, typing, namespaces, Try-Catch, JSON inline, class modifiers, REST, and StaticCall status), see advpl-tlpp-feature-comparison.md.
Migration Process
MANDATORY RULE — File Extension: Any source file that includes
#include "tlpp-core.th"or uses TLPP-exclusive features must use the.tlppextension. If a.prwor.prxfile is being migrated or modified to adopt TLPP constructs, rename it to.tlppas part of the same change. The AdvPL compiler silently ignores TLPP directives in.prw/.prxfiles, which leads to hard-to-diagnose failures. Always change the extension first.
The migration involves 15 steps, each addressing a specific AdvPL → TLPP transformation:
- File Extension and Includes —
.prw→.tlpp, add#include "tlpp-core.th" - Add Namespace — Organize code with
Namespace company.module.feature - Add Type Annotations — Variables, parameters, return values (
as Type) - Replace ErrorBlock with Try-Catch — Modern exception handling
- Replace StaticCall — Use
FWLoadMenuDef,FWLoadModel, namespace calls - Use Long Identifier Names — TLPP removes the 10-char limit
- Use Named Parameters — Improve readability at call sites
- Use JSON Inline — Replace
JsonObject():New()chains - Add Class Access Modifiers —
Private,Protected,Public - Migrate WsRESTful to TLPP REST — Annotation-based
@Get,@Post, etc. - Fix Incorrect Inheritance —
LongNameClass(notLongClassName) - Remove ISAM Driver Usage — Migrate to
FWTemporaryTable - Migrate Console APIs to FWLogMsg — Replace
ConOut,OutErr,? - Remove IIF Usage — Replace with
If/Else/EndIf - Migrate FormCommit Override to FWModelEvent — Use
FWFormCommit(oModel)
For complete before/after diff examples for all 15 steps, see tlpp-migration-patterns.md.
Migration Checklist
Pre-Migration
- Source file is under version control with a clean commit
- Existing tests pass (or tests exist for the code)
- Dependencies on the file are identified (callers, includes)
- Team is aware of the migration (naming changes affect callers)
File Transformation
- File extension changed from
.prwto.tlpp #include "tlpp-core.th"added as the first includeNamespacedeclaration added- All
StaticCall()replaced with direct calls orFWLoad*functions - User Function return types added (
as Type) - Parameter types added (
as Type) - Variable types added (
as Type)
Modernization (Incremental)
ErrorBlockpatterns replaced withTry-Catchwhere appropriate- Short identifier names expanded to descriptive names
Privatevariable scope replaced withLocalwhere possible- Class access modifiers added (
Private,Protected,Public) - Named parameters used for functions with 3+ parameters
- JSON inline syntax used for JSON object construction
- WsRESTful services migrated to TLPP REST annotations
LongNameClassused for inheritance (notLongClassName)- ISAM drivers (
MSCREATE,DBCREATE,CRIATRAB) replaced withFWTemporaryTable ConOut()/OutErr()/?replaced withFWLogMsg()IIF()replaced withIf/Else/EndIfblocksFormCommitoverrides migrated toFWModelEvent/FWFormCommit(oModel)pattern
Refer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference.
Post-Migration
- Source compiles without errors
- All unit/integration tests pass
- Callers updated if function signatures changed
- RPO recompiled and tested in development environment
- No regression in existing functionality
Common Migration Pitfalls
| Pitfall | Symptom | Resolution |
Using #include "tlpp-core.th" in a .prw/.prx file | TLPP features silently ignored; unexpected runtime behavior | Rename the file to .tlpp before adding TLPP includes or features |
Using long identifiers in .prw files | Silent truncation, wrong function calls | Only use long names in .tlpp files |
StaticCall in .tlpp file | Compilation error | Replace with FWLoadMenuDef, FWLoadModel, or namespace call |
Missing #include "tlpp-core.th" | TLPP features not recognized | Add as the first include |
| Default access modifier changed | Class members inaccessible from outside | Explicitly add Public to members that need external access |
Try-Catch around non-TLPP calls | ErrorBlock still needed for pure AdvPL error flows | Use Try-Catch regardless — it captures AdvPL throws too |
| JSON inline without line continuations | Compilation error | Use ; at end of each line in JSON inline blocks |
Access modifiers or static in method implementation | Compilation error or unexpected behavior | Method implementations use bare method — NEVER public method, static method, etc. Modifiers are ONLY in the class declaration |
Incremental Migration Strategy
Migration does not need to be all-or-nothing. Follow this priority order:
- Mandatory for TLPP: File extension +
tlpp-core.thinclude + removeStaticCall - High value: Add
Namespace+ type annotations (catches bugs at compile time) - Medium value: Replace
ErrorBlockwithTry-Catch, add class access modifiers, fixLongNameClassinheritance - SonarQube compliance: Remove
IIF,ConOut→FWLogMsg, ISAM →FWTemporaryTable,FormCommit→FWModelEvent - Nice to have: Long identifiers, named parameters, JSON inline
AdvPL and TLPP coexist. A
.tlppfile can call AdvPL functions and vice versa. You don't need to migrate everything at once.
Troubleshooting
StaticCallnot compiling in TLPP:StaticCallis prohibited in TLPP. ReplaceStaticCall(TClass, Method, params)withTClass():Method(params).- Include conflicts after renaming to
.tlpp: Replace#include "protheus.ch"with#include "tlpp-core.th". Add#include "totvs.ch"if the source uses Protheus framework functions. Do not keepprotheus.ch— usetotvs.chinstead. - Namespace resolution errors: Ensure the
Namespacedeclaration matches the directory structure and that callers use the fully qualified name or aUsingdirective. - Functions not found after migration: AdvPL and TLPP can coexist. If a
.tlppfile calls an AdvPL function, the AdvPL source must still be compiled in the RPO. - Type mismatch at compile time: TLPP type annotations are strict. Ensure parameter types and return types match exactly — implicit conversions allowed in AdvPL may fail in TLPP.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- thalysjuvenal/advpl-specialist★ 183same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- instructions/AGENTS.mdAGENTS.md
- instructions/CLAUDE.mdCLAUDE.md
- advpl-tlpp-compileSkill
- advpl-tlpp-sddSkill
- code-reviewSkill
- context-mapSkill
- create-implementation-planSkill
- data-dictionary-lookupSkill
- documentation-writerSkill
- entry-point-designerSkill
- fwmsexcelxlsx-generatorSkill
- fwrest-client-generatorSkill
- mvc-generatorSkill
- query-builderSkill
- refactor-method-complexity-reduceSkill
- refactorSkill
- sql-code-reviewSkill
- sql-optimizationSkill
- tir-test-generatorSkill
- tlpp-rest-endpoint-generatorSkill
- utf8-to-cp1252-conversionSkill
- brainstormingSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

