/sap-dev-core:sap-sql-query "<natural-language question>" | --sql "SELECT ..." [--max-rows N] [--dry-run] [--low-fidelity] | install | statusfrom sap-dev-core
Runs governed read-only SQL queries against SAP via RFC, with natural language support and whitelist validation. Returns TSV with provenance. For querying SAP tables without manual exports.
Ships in sap-dev-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You answer a data question with ONE governed, read-only SELECT — validated by a deny-first whitelist, decomposed into clause slots, executed under caps + per-table auth, and returned as a TSV with the SQL and its provenance. You never run a raw statement and never write.
Task: $ARGUMENTS
| File | Token / call | Purpose |
|---|---|---|
<SKILL_DIR>/references/sap_sql_query_parse.ps1 | -SqlFile | Whitelist validator + clause decomposition (Layer 1) |
<SKILL_DIR>/references/sap_sql_query_parse.tests.ps1 | offline | 26-case injection/acceptance corpus |
<SKILL_DIR>/references/sap_sql_query_exec.ps1 | -Action status|exec | Engine A caller (deployed helper) + preflight |
<SKILL_DIR>/references/sap_sql_query_lowfi.ps1 | -Table -Fields -Where | Engine B (LOW-FIDELITY, no deploy) |
<SKILL_DIR>/references/Z_SQL_QUERY_RO.abap | source of record | Engine A FM (deployed by install) |
<SKILL_DIR>/references/ZSQLQ_CHUNK.tsv · ZSQLQ_CHUNK_TT.tsv | SE11 defs | The RFC-safe chunk structure + table type |
/sap-se37 · /sap-se11 | sub-skills | install (they resolve the TR — this skill never touches TRs) |
/sap-login | sub-skill | Session / pinned profile |
Resolve work_dir + {RUN_TEMP} (canonical one-liner — sap_connection_lib.ps1 is dot-sourced
there — with Write-Output ('RUN_TEMP=' + (Get-SapRunTemp)) appended). {RUN_TEMP} = the
per-run scratch dir holding the log state file; mint it once here and reuse (re-minting breaks
the -Action end state-file lookup). Start logging (sap_log_helper.ps1,
state {RUN_TEMP}\sap_sql_query_run.json). Pure RFC — no GUI.
"<NL question>" (default) | --sql "<SELECT>" | install | status. Clamp --max-rows
(default 1000, hard cap 10000) + --timeout. Pinned profile via /sap-login.
... sap_sql_query_exec.ps1 -Action status
SQLQ_HELPER_MISSING → offer install (Step 3) or --low-fidelity (Engine B). Present +
remote → Engine A available.
Typed confirm: "Deploy 3 objects (Z_SQL_QUERY_RO, ZSQLQ_CHUNK, ZSQLQ_CHUNK_TT) to
<SID>/<client>? Type the SID to proceed." Then deploy ZSQLQ_CHUNK + ZSQLQ_CHUNK_TT via
/sap-se11, Z_SQL_QUERY_RO.abap via /sap-se37 (+ change-attributes REMOTE); authoritative
re-read TFDIR.FMODE='R' + version ping. Install is its own run. Production: surface that
security review may veto — Engine B exists for exactly that.
Resolve NL → tables/fields via DD02T (table texts) + DD03/DD04T (field + data-element texts) RFC reads; draft the SQL; show it with the name→description provenance table.
Write the SELECT to {RUN_TEMP}\query.sql (a file — a -Sql CLI string loses inner "), then:
... sap_sql_query_parse.ps1 -SqlFile "{RUN_TEMP}\query.sql" -OutJson "{RUN_TEMP}\decomp.json"
verdict=REJECT → report the exact reason/token (SQLQ_PARSE_REJECTED); STOP. --dry-run
stops here showing the SQL + decomposition.
sap_sql_query_exec.ps1 -Action exec with the decomposition
clause slots (-Fields -From -Where -GroupBy -Having -OrderBy -PrimaryTable=<tables[0]> -MaxRows). E_STATUS A → SQLQ_AUTH_REFUSED, E → SQLQ_EXEC_FAILED; reassembles chunks → TSV.--low-fidelity / helper absent + install declined): sap_sql_query_lowfi.ps1 -Table <tables[0]> -Fields <fields> -Where <where>. Single-table only — a join/aggregate
refuses loud (SQLQ_LOWFI_UNSUPPORTED) pointing at install. Banner ENGINE=LOW_FIDELITY.Write the TSV (UTF-8 BOM, # provenance header: SQL, SID/client, engine, rowcount, TRUNCATED,
elapsed, caps, helper version) + (NL mode) a .provenance.md. Register
(Register-SapArtifact -Kind query_result, coverage CHECKED / COULD_NOT_CHECK when Engine B
truncated). Preview table + the caveat banner.
Log end (SUCCESS/FAILED/SKIPPED + error_class): SQLQ_PARSE_REJECTED / SQLQ_NAME_UNKNOWN
/ SQLQ_AUTH_REFUSED / SQLQ_HELPER_MISSING / SQLQ_EXEC_FAILED / SQLQ_LOWFI_UNSUPPORTED /
RFC_LOGON_FAILED.
"-comment,
unbalanced quote, ROLLBACK). SQL is passed via -SqlFile (a -Sql CLI string silently loses
inner "). Engine B is live-verified (single-table MARA SELECT with fields + WHERE + cap
returned rows; join/aggregate refuse loud). Engine A status preflight is verified
(helper-absent detection + install offer).install time (via /sap-se37 / /sap-check-abap) —
it is not compiled in this build. Its containment (server-side forbidden-token re-scan,
DD02L + VIEW_AUTHORITY_CHECK per table, ≤10000 clamp, clause-slot-only interface, no write
statement anywhere) is defense-in-depth BEHIND the parser. It types the result itab by the
primary FROM table (RTTS + INTO CORRESPONDING FIELDS): single-table SELECTs return every
requested field; a JOIN returns the primary table's columns — for a full join projection use
the helper's own join support once its per-field RTTS build lands (v1.5) or Engine B per table.VIEW_AUTHORITY_CHECK +
DD02L present on both per the plan's probe. Security: the helper targets dev/QA — it must
never be transported to PRD without the customer's security sign-off (README); Engine B is the
PRD answer. Reads run without confirmation (house precedent), but NL mode always shows the
generated SQL first; install is typed-confirm-gated.remove
(delete the 3 helper objects). v2: saved query library, cross-system compare.README.md (opens in a new tab)references/ZSQLQ_CHUNK.tsv (opens in a new tab)references/ZSQLQ_CHUNK_TT.tsv (opens in a new tab)references/Z_SQL_QUERY_RO.abap (opens in a new tab)references/sap_sql_query_exec.ps1 (opens in a new tab)references/sap_sql_query_lowfi.ps1 (opens in a new tab)references/sap_sql_query_parse.ps1 (opens in a new tab)references/sap_sql_query_parse.tests.ps1 (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sapdev-ai/sap-dev --plugin sap-dev-core61 skills in this plugin
/sap-activate-objectActivates an inactive SAP repository object via SAP GUI Scripting. Routes to
the correct transaction by object type: SE38 for reports/programs/function-
group main programs, SE37 for function modules, SE24 for classes/interfaces
/methods, SE11 for DDIC objects (table, view, dataelement, structure,
tabletype, typegroup, domain, searchhelp, lockobject). Handles the
"inactive objects worklist" popup that SAP shows when there are multiple
inactive objects of the same locality (transportable vs. local — SAP filters
the popup by package locality of the triggering object). Verifies activation
via PROGDIR (programs/FMs include) and DWINACTIV.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-api-advisorNatural-language SAP API discovery over RFC (no GUI): turn a goal like "create
a sales order" or "post a goods movement" into a ranked, trap-annotated,
paste-ready shortlist of BAPIs / function modules / classes — with released
state (S/4), interface + documentation for the top candidates, the team's known
traps inlined, and a ready-to-paste CALL FUNCTION snippet. Reads the BAPI
catalog (BAPI_MONITOR_GETLIST), TFDIR/TFTIT name+text, SEOCLASS, ARS_W_API_STATE
(S/4 released state), FUPARAREF/FUNCT + DOCU_GET. HARD rule: it never test-calls
a candidate — snippets are text only. Read-only; deploys nothing.
Use for: "which BAPI/FM for X", find an API, is this BAPI released, API to
create/read/post <object>, discover function module, released API S/4.
`successor` (released→sanctioned replacement) is phase 2; `scan` is phase 3.
Prerequisites: an RFC-capable connection profile (/sap-login). No dev-init, no GUI.
/sap-atcRuns the SAP ABAP Test Cockpit (ATC) end-to-end as a quality gate:
builds an SCI Object Set scoped to the target object(s), creates an
ATC Run Series bound to that set, polls the ATC Run Monitor until the
run completes, then reads the Priority 1 / Priority 2 / Priority 3
finding counts from the Manage Results screen and (best-effort)
downloads the result text file. Applies the customer brief's
MAX_PRIORITY threshold to decide pass / fail.
Replaces the legacy SCI-results-tree implementation that lacked a
Priority column. Per-stage VBS references are recorded against the
S/4HANA 1909 ATC layout — re-record on first failure with
/sap-gui-probe --record if your release uses different tree node IDs / grid
column IDs.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-call-bdcExecutes BDC (Batch Data Communication) sessions in SAP via RFC.
Reads SHDB recording files from the bdc/ folder, connects via
SAP NCo 3.1, calls ABAP4_CALL_TRANSACTION, and outputs
full BDCMSGCOLL messages to a result file.
Connection parameters resolved from the AI session's pinned profile in
connections.json (saved via /sap-login).
Prerequisites: SAP profile saved via /sap-login (RFC password required).
SAP NCo 3.1 (32-bit, .NET 4.0) in GAC.
/sap-change-packageChanges the package (TADIR-DEVCLASS) assignment of an SAP repository object
via the "Object Directory Entry" dialog (Goto > Object Directory Entry).
Routes by object type to SE38 / SE37 / SE24 / SE11 / SE91 / CMOD (the last
for enhancement projects — used by /sap-cmod). Handles three
flows automatically based on current vs new package locality:
(a) $TMP → transportable (Z*/Y*): resolves a modifiable TR via
/sap-transport-request, then enters the new package + TR.
(b) transportable A → transportable B: pre-checks E071/E070 to ensure
the object is NOT linked to a modifiable TR (would block the move).
(c) transportable → $TMP: confirms the move and presses "Local object".
Verifies via TADIR re-query.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-check-abapValidates ABAP source (report / program / FM / class / include) before
deployment — one skill, dimension-dispatched: naming (variable conventions),
type (DDIC type validity), unused (dead variables), sql (SELECT/UPDATE/DELETE
fields vs table defs), contract (offline generation rules), spec (offline: code
covers every dependency / message / text / selection field in the design spec),
fm (CALL FUNCTION params / sections / types vs the live FM over RFC — absorbed
from the former sap-check-fm), syntax (compiler-level EDITOR_SYNTAX_CHECK via
RFC, catching real errors offline before any GUI upload). Writes tab-delimited
result files with fix advice; feed findings to /sap-fix-abap. SAP connection
optional — offline skips type/sql/fm/syntax; live dimensions that can't run
report COULD_NOT_CHECK, never a silent pass.
Prerequisites: SAP GUI (SAP.Functions COM); SAP NCo 3.1 (32-bit) + the dev-init
wrapper Z_GENERIC_RFC_WRAPPER_TBL for the syntax dimension.
Other plugins' skills for the same job