$npx -y skills add forcedotcom/sf-skills --skill data360-querySalesforce Data Cloud Retrieve phase. Use this skill when the user runs Data Cloud SQL, async queries, vector search, search-index workflows, or metadata introspection for Data Cloud objects. TRIGGER when: user runs Data Cloud SQL, describe, async queries, vector search, search-i
| 1 | # data360-query: Data Cloud Retrieve Phase |
| 2 | |
| 3 | Use this skill when the user needs **query, search, and metadata introspection** for Data Cloud: sync SQL, paginated SQL, async query workflows, table describe, vector search, hybrid search, or search index operations. |
| 4 | |
| 5 | ## When This Skill Owns the Task |
| 6 | |
| 7 | Use `data360-query` when the work involves: |
| 8 | - `sf data360 query *` |
| 9 | - `sf data360 search-index *` |
| 10 | - `sf data360 metadata *` |
| 11 | - `sf data360 profile *` or `sf data360 insight *` inspection |
| 12 | - understanding Data Cloud SQL results or query shape |
| 13 | |
| 14 | Delegate elsewhere when the user is: |
| 15 | - writing standard CRM SOQL only → [platform-soql-query](../platform-soql-query/SKILL.md) |
| 16 | - designing segment or calculated insight assets → [data360-segment](../data360-segment/SKILL.md) |
| 17 | - analyzing STDM/session tracing/parquet telemetry → [agentforce-observe](../agentforce-observe/SKILL.md) |
| 18 | |
| 19 | --- |
| 20 | |
| 21 | ## Required Context to Gather First |
| 22 | |
| 23 | Ask for or infer: |
| 24 | - target org alias |
| 25 | - whether the user needs quick count, medium result set, large export, schema inspection, or semantic search |
| 26 | - table/index name if known |
| 27 | - whether the task is read-only SQL or search-index lifecycle management |
| 28 | |
| 29 | --- |
| 30 | |
| 31 | ## Core Operating Rules |
| 32 | |
| 33 | - Treat Data Cloud SQL as its own query language, not SOQL. |
| 34 | - Run the shared readiness classifier before relying on query/search surfaces: `node ../data360-orchestrate/scripts/diagnose-org.mjs -o <org> --phase retrieve --json`. |
| 35 | - Use describe before guessing columns. |
| 36 | - Prefer `sqlv2` or async query flows for larger result sets. |
| 37 | - Use vector search or hybrid search only when the search index lifecycle is healthy. |
| 38 | - Keep STDM/parquet/session-tracing workflows out of this skill family. |
| 39 | |
| 40 | --- |
| 41 | |
| 42 | ## Recommended Workflow |
| 43 | |
| 44 | ### 1. Classify readiness for retrieve work |
| 45 | ```bash |
| 46 | node ../data360-orchestrate/scripts/diagnose-org.mjs -o <org> --phase retrieve --json |
| 47 | # optional query-plane probe, only with a real table name |
| 48 | node ../data360-orchestrate/scripts/diagnose-org.mjs -o <org> --phase retrieve --describe-table MyDMO__dlm --json |
| 49 | ``` |
| 50 | |
| 51 | ### 2. Choose the smallest correct query shape |
| 52 | ```bash |
| 53 | sf data360 query sql -o <org> --sql 'SELECT COUNT(*) FROM "ssot__Individual__dlm"' 2>/dev/null |
| 54 | sf data360 query sqlv2 -o <org> --sql 'SELECT * FROM "ssot__Individual__dlm"' 2>/dev/null |
| 55 | sf data360 query async-create -o <org> --sql 'SELECT * FROM "ssot__Individual__dlm"' 2>/dev/null |
| 56 | ``` |
| 57 | |
| 58 | ### 3. Use describe before guessing fields |
| 59 | ```bash |
| 60 | sf data360 query describe -o <org> --table ssot__Individual__dlm 2>/dev/null |
| 61 | ``` |
| 62 | |
| 63 | ### 4. Use vector or hybrid search only when an index exists |
| 64 | ```bash |
| 65 | sf data360 search-index list -o <org> 2>/dev/null |
| 66 | sf data360 query vector -o <org> --index Knowledge_Index --query "reset password" --limit 5 2>/dev/null |
| 67 | sf data360 query hybrid -o <org> --index Knowledge_Index --query "reset password" --limit 5 2>/dev/null |
| 68 | sf data360 query hybrid -o <org> --index Insurance_Index --query "weather damage coverage" --prefilter "Type_of_Insurance__c='Home'" --limit 10 2>/dev/null |
| 69 | ``` |
| 70 | |
| 71 | ### 5. Reuse curated search-index examples when creating indexes |
| 72 | Use the phase-owned examples instead of inventing JSON from scratch: |
| 73 | - `examples/search-indexes/vector-knowledge.json` |
| 74 | - `examples/search-indexes/hybrid-structured.json` |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## High-Signal Gotchas |
| 79 | |
| 80 | - Data Cloud SQL is not SOQL. |
| 81 | - Table names should be double-quoted in SQL. |
| 82 | - `sqlv2` is better than ad hoc OFFSET paging for medium result sets. |
| 83 | - async query is preferable for large results. |
| 84 | - search-index operations and vector/hybrid queries depend on the index lifecycle being healthy. |
| 85 | - Hybrid search can use `--prefilter`, but only on fields configured as prefilter-capable when the search index was created. |
| 86 | - HNSW index parameters are typically read-only on create; leave `userValues: []` unless the platform explicitly documents otherwise. |
| 87 | - `query describe` is not a universal tenant probe; only run it with a known DMO or DLO table after broader readiness has been confirmed. |
| 88 | |
| 89 | --- |
| 90 | |
| 91 | ## Output Format |
| 92 | |
| 93 | ```text |
| 94 | Retrieve task: <sql / sqlv2 / async / describe / vector / search-index> |
| 95 | Target org: <alias> |
| 96 | Target object: <table or index> |
| 97 | Commands: <key commands run> |
| 98 | Verification: <query rows / schema / status> |
| 99 | Next step: <segment / harmonize / follow-up> |
| 100 | ``` |
| 101 | |
| 102 | --- |
| 103 | |
| 104 | ## References |
| 105 | |
| 106 | - [examples/search-indexes/vect |