/query-builder
Use when the user needs to build, choose the pattern for, or optimize a SQL query against Protheus ERP tables -- covering Workarea (DbSelectArea/DbSeek) vs Embedded SQL vs TCSqlExec pattern choice, mandatory D_E_L_E_T_/xFilial filters, SIX index-aligned WHERE ordering,
$ npx -y skills add thalysjuvenal/advpl-specialist --skill query-builder --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
/query-builder
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when the user needs to build, choose the pattern for, or optimize a SQL query against Protheus ERP tables -- covering Workarea (DbSelectArea/DbSeek) vs Embedded SQL vs TCSqlExec pattern choice, mandatory D_E_L_E_T_/xFilial filters, SIX index-aligned WHERE ordering,
SKILL.md
query-builder.SKILL.mdname: query-builder
description: Use when the user needs to build, choose the pattern for, or optimize a SQL query against Protheus ERP tables -- covering Workarea (DbSelectArea/DbSeek) vs Embedded SQL vs TCSqlExec pattern choice, mandatory D_E_L_E_T_/xFilial filters, SIX index-aligned WHERE ordering, FWPreparedStatement parameterization to prevent SQL injection, and cross-database (PostgreSQL/MSSQL/Oracle) portability. Also triggers on Portuguese phrasing like "consulta SQL", "montar query", "otimizar consulta", "qual indice usar", "escolher entre DbSeek ou SQL", or "prevenir SQL injection no Protheus".
Protheus Query Builder
This skill helps build correct, safe, and optimized SQL against Protheus ERP tables, respecting the platform's database conventions: mandatory soft-delete (`D_E_L_E_T_`) and multi-branch (`xFilial`) filters, Hungarian-notation field names, dictionary-driven physical schemas (`RetSqlName()`), and SIX index alignment. It guides the agent to choose the right access pattern -- Workarea navigation vs Embedded SQL vs raw `TCSqlExec` -- enforce mandatory filters, order `WHERE` clauses to match available indexes, and parameterize every dynamic value with `FWPreparedStatement` to eliminate injection risk.
Activate this skill when building any query against Protheus tables (standard `SA*`/`SE*`/`SF*` or custom `Z*`), deciding between `DbSelectArea`/`DbSeek` and Embedded SQL, reviewing code for missing mandatory filters, adding parameterized queries, diagnosing slow queries via index misalignment, or writing cross-database code. It does not cover `BeginSQL`/`EndSQL` macro syntax itself (see `embedded-sql`, its companion skill for macro details), nor record locking semantics during writes (see `protheus-locks-deadlocks`).
| Reference file | Read when | |---|---| | reference.md | Always -- database conventions, table/field naming, mandatory filters, pattern-choice overview | | patterns-workarea.md | Generating record-by-record code with `DbSelectArea` + `DbSeek` + `RecLock` | | patterns-fwpreparedstatement.md | Building parameterized `TCQuery`/`TCSqlExec`, LIKE clauses, INSERT/UPDATE/DELETE | | index-awareness.md | Choosing/validating an index, ordering WHERE clauses, common SIX key expressions | | cross-database.md | Using `ChangeQuery()`, `TCGetDB()`, DBAccess macros, MSSQL/PostgreSQL/Oracle equivalents |
Read more
name: query-builder description: Use when the user needs to build, choose the pattern for, or optimize a SQL query against Protheus ERP tables -- covering Workarea (DbSelectArea/DbSeek) vs Embedded SQL vs TCSqlExec pattern choice, mandatory D_E_L_E_T_/xFilial filters, SIX index-aligned WHERE ordering, FWPreparedStatement parameterization to prevent SQL injection, and cross-database (PostgreSQL/MSSQL/Oracle) portability. Also triggers on Portuguese phrasing like "consulta SQL", "montar query", "otimizar consulta", "qual indice usar", "escolher entre DbSeek ou SQL", or "prevenir SQL injection no Protheus".
Protheus Query Builder
This skill helps build correct, safe, and optimized SQL against Protheus ERP tables, respecting the platform's database conventions: mandatory soft-delete (`D_E_L_E_T_`) and multi-branch (`xFilial`) filters, Hungarian-notation field names, dictionary-driven physical schemas (`RetSqlName()`), and SIX index alignment. It guides the agent to choose the right access pattern -- Workarea navigation vs Embedded SQL vs raw `TCSqlExec` -- enforce mandatory filters, order `WHERE` clauses to match available indexes, and parameterize every dynamic value with `FWPreparedStatement` to eliminate injection risk.
Activate this skill when building any query against Protheus tables (standard `SA*`/`SE*`/`SF*` or custom `Z*`), deciding between `DbSelectArea`/`DbSeek` and Embedded SQL, reviewing code for missing mandatory filters, adding parameterized queries, diagnosing slow queries via index misalignment, or writing cross-database code. It does not cover `BeginSQL`/`EndSQL` macro syntax itself (see `embedded-sql`, its companion skill for macro details), nor record locking semantics during writes (see `protheus-locks-deadlocks`).
| Reference file | Read when | |---|---| | reference.md | Always -- database conventions, table/field naming, mandatory filters, pattern-choice overview | | patterns-workarea.md | Generating record-by-record code with `DbSelectArea` + `DbSeek` + `RecLock` | | patterns-fwpreparedstatement.md | Building parameterized `TCQuery`/`TCSqlExec`, LIKE clauses, INSERT/UPDATE/DELETE | | index-awareness.md | Choosing/validating an index, ordering WHERE clauses, common SIX key expressions | | cross-database.md | Using `ChangeQuery()`, `TCGetDB()`, DBAccess macros, MSSQL/PostgreSQL/Oracle equivalents |
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

