mcpField
Q
query-builder

query-builder

github.com/thalysjuvenalData & databases19248 installsUpdated 7w ago
Repository

About query-builder

A skill for building safe, efficient SQL queries against Protheus ERP tables. It helps developers select an access pattern, apply required filters, align queries with indexes, and parameterize dynamic values.

Key features

  1. 01Protheus database conventions and filters
  2. 02Workarea and SQL pattern selection
  3. 03Parameterized queries with FWPreparedStatement
  4. 04SIX index alignment guidance
  5. 05Cross-database query guidance

Use cases

  1. 01Building queries for standard or custom tables
  2. 02Choosing between DbSeek and Embedded SQL
  3. 03Reviewing queries for required filters
  4. 04Diagnosing slow queries from index mismatch

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/thalysjuvenal/advpl-specialist --skill query-builder

After installing, type/query-builderin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

cross-database.md
index-awareness.md
patterns-fwpreparedstatement.md
patterns-workarea.md
reference.md

Details

From the project README

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 fileRead when
reference.mdAlways -- database conventions, table/field naming, mandatory filters, pattern-choice overview
patterns-workarea.mdGenerating record-by-record code with DbSelectArea + DbSeek + RecLock
patterns-fwpreparedstatement.mdBuilding parameterized TCQuery/TCSqlExec, LIKE clauses, INSERT/UPDATE/DELETE
index-awareness.mdChoosing/validating an index, ordering WHERE clauses, common SIX key expressions
cross-database.mdUsing ChangeQuery(), TCGetDB(), DBAccess macros, MSSQL/PostgreSQL/Oracle equivalents

Comments

Markdown supported