What problem does it solve?
This Skill prevents incorrect or unsafe SQL for Protheus by enforcing mandatory filters, branch scoping, and parameter binding while helping you choose the best access pattern for performance.
Core Features & Use Cases
- Mandatory Protheus Conventions: Always includes
D_E_L_E_T_ = ' ' and the required XX_FILIAL branch filter, and uses RetSQLName() for physical table correctness.
- Optimized Query Patterns: Produces Workarea (
DbSelectArea/DbSeek) or Embedded SQL (FWExecStatement with prepared bind parameters) versions and supports JOINs, DML, and COUNT.
- Safety Guardrails: Guides parameterized query construction to reduce SQL injection risk and avoids common Protheus pitfalls (missing soft-delete, hardcoded filial,
SELECT *, missing index-aligned WHERE ordering).
Quick Start
Tell the AI: Build a parameterized FWExecStatement query for the Protheus table SA1 that returns customer code and name for the current branch while excluding deleted records, and include the recommended index-aware WHERE clause.