ADVPL Embedded SQL Expert
Optimizes and generates embedded SQL for ADVPL/TLPP environments with native Protheus macro support and performance linting.
This skill provides comprehensive guidance for writing, refactoring, and auditing SQL within ADVPL and TLPP source code for the Totvs Protheus ERP. It specializes in implementing the modern BeginSql/EndSql syntax, ensuring multi-company and multi-branch compatibility through mandatory macros like %notDel% and %xfilial%. By enforcing Protheus-specific performance and security standards, such as rules PERF-001 through PERF-003 and SQL-001, it helps developers transition legacy TCQuery concatenations into modern, safe, and performant database operations while avoiding common pitfalls like unclosed cursors or cross-branch data leaks.