/embedded-sql
Use when the user needs to write, review, or migrate SQL queries in ADVPL/TLPP using BeginSQL/EndSQL blocks and macro expressions (%table%, %xfilial%, %notDel%, %exp%, %Order%) instead of raw TCQuery string concatenation -- covering INNER/LEFT JOIN patterns, aggregations
$ npx -y skills add thalysjuvenal/advpl-specialist --skill embedded-sql --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/embedded-sql
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when the user needs to write, review, or migrate SQL queries in ADVPL/TLPP using BeginSQL/EndSQL blocks and macro expressions (%table%, %xfilial%, %notDel%, %exp%, %Order%) instead of raw TCQuery string concatenation -- covering INNER/LEFT JOIN patterns, aggregations
SKILL.md
embedded-sql.SKILL.mdname: embedded-sql
description: Use when the user needs to write, review, or migrate SQL queries in ADVPL/TLPP using BeginSQL/EndSQL blocks and macro expressions (%table%, %xfilial%, %notDel%, %exp%, %Order%) instead of raw TCQuery string concatenation -- covering INNER/LEFT JOIN patterns, aggregations (SUM/COUNT/GROUP BY/HAVING), subqueries, column type declarations, DML via TCSqlExec, and SQL-injection prevention. Also triggers on Portuguese phrasing like "consulta SQL", "query embutida", "migrar TCQuery para BeginSQL", "escrever SELECT com filial e notDel", or "montar JOIN em ADVPL".
Embedded SQL in ADVPL/TLPP
This skill covers writing SQL inside ADVPL/TLPP using `BeginSQL ... EndSQL` blocks and their special macro expressions -- `%table:TABLE%` for physical table resolution, `%xfilial:TABLE%` for branch filtering, `%notDel%` for logical-deletion filtering, `%exp:EXPRESSION%` for safe variable binding, and `%Order:TABLE%` for primary-key ordering. It also covers `column` type declarations, JOIN and aggregation patterns, subqueries, and migrating legacy `TCQuery` string-concatenation code to Embedded SQL.
Activate this skill whenever the user is writing a new query, reviewing an existing one for correctness/safety, or converting old concatenated-string SQL to the modern BeginSQL syntax. It also covers the restrictions and gotchas of BeginSQL (no `*` at line start, always include `%notDel%` and filial filtering, use `GetNextAlias()`, close aliases) and when to use `TCSqlExec` instead for INSERT/UPDATE/DELETE.
It does not cover general native function lookups unrelated to SQL (see `protheus-reference`), business-process context for which tables/fields to query (see `protheus-business`), or generating documentation for a routine that happens to contain SQL (see `documentation-patterns`).
| Reference file | Read when | |---|---| | reference.md | Always -- BeginSQL syntax, macro expressions, JOIN/aggregation/subquery patterns, DML via TCSqlExec, performance tips, and TCQuery migration |
Read more
name: embedded-sql description: Use when the user needs to write, review, or migrate SQL queries in ADVPL/TLPP using BeginSQL/EndSQL blocks and macro expressions (%table%, %xfilial%, %notDel%, %exp%, %Order%) instead of raw TCQuery string concatenation -- covering INNER/LEFT JOIN patterns, aggregations (SUM/COUNT/GROUP BY/HAVING), subqueries, column type declarations, DML via TCSqlExec, and SQL-injection prevention. Also triggers on Portuguese phrasing like "consulta SQL", "query embutida", "migrar TCQuery para BeginSQL", "escrever SELECT com filial e notDel", or "montar JOIN em ADVPL".
Embedded SQL in ADVPL/TLPP
This skill covers writing SQL inside ADVPL/TLPP using `BeginSQL ... EndSQL` blocks and their special macro expressions -- `%table:TABLE%` for physical table resolution, `%xfilial:TABLE%` for branch filtering, `%notDel%` for logical-deletion filtering, `%exp:EXPRESSION%` for safe variable binding, and `%Order:TABLE%` for primary-key ordering. It also covers `column` type declarations, JOIN and aggregation patterns, subqueries, and migrating legacy `TCQuery` string-concatenation code to Embedded SQL.
Activate this skill whenever the user is writing a new query, reviewing an existing one for correctness/safety, or converting old concatenated-string SQL to the modern BeginSQL syntax. It also covers the restrictions and gotchas of BeginSQL (no `*` at line start, always include `%notDel%` and filial filtering, use `GetNextAlias()`, close aliases) and when to use `TCSqlExec` instead for INSERT/UPDATE/DELETE.
It does not cover general native function lookups unrelated to SQL (see `protheus-reference`), business-process context for which tables/fields to query (see `protheus-business`), or generating documentation for a routine that happens to contain SQL (see `documentation-patterns`).
| Reference file | Read when | |---|---| | reference.md | Always -- BeginSQL syntax, macro expressions, JOIN/aggregation/subquery patterns, DML via TCSqlExec, performance tips, and TCQuery migration |
Plugin para Claude Code especializado em ADVPL e TLPP para desenvolvimento no ecossistema TOTVS Protheus — para desenvolvedores e consultores funcionais. Documentacao completa:
Other skills on advpl-specialist.
- /advpl-code-generation
Use when the user asks to generate, create, or scaffold ADVPL/TLPP code for TOTVS Protheus -- User Functions, Static Functions, TLPP classes, MVC (Model/View/Controller), REST APIs, SOAP web services, entry points (pontos de entrada), TReport/FWMsPrinter reports, jobs, or
Open skill - /advpl-code-review
Use when the user asks to review, audit, or check the quality of ADVPL/TLPP code for TOTVS Protheus before merge or deploy -- covering best practices (RecLock/MsUnlock pairing, variable scope, area management, error handling), performance bottlenecks, security vulnerabilities
Open skill - /advpl-debugging
Use when the user asks to debug, diagnose, or fix an ADVPL/TLPP error on TOTVS Protheus -- compilation errors (syntax, missing includes, undeclared variables), runtime failures (NIL access, type mismatch, array bounds), performance issues (slow queries, memory leaks), database
Open skill - /advpl-refactoring
Use when the user asks to refactor, clean up, or restructure existing ADVPL/TLPP code on TOTVS Protheus without changing its behavior -- extracting long functions (>100 lines), simplifying deeply nested conditionals, removing dead code, improving variable naming (Hungarian
Open skill - /advpl-to-tlpp-migration
Use when the user asks to migrate, convert, compatibilize, or modernize legacy ADVPL procedural code to TLPP object-oriented classes on TOTVS Protheus -- turning User Functions/Static Functions into namespaced classes with methods and data properties, replacing Private/Public
Open skill - /advpr-test-automation
Use when the user wants to write, run, or troubleshoot automated regression tests for Protheus routines with ADVPR (Advanced Protheus Robot) -- covering FWTestHelper API, TestSuite/GPS de Testes setup, headless execution via FwExecSuite, and per-pattern scripting (MVC,
Open skill

