Loading...
Loading...
SOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.
npx skill4agent add forcedotcom/sf-skills platform-soql-queryplatform-soql-query.soql| Need | Default pattern |
|---|---|
| parent data from child | child-to-parent traversal |
| child rows from parent | subquery |
| counts / rollups | aggregate query |
| records with / without related rows | semi-join / anti-join |
| text search across objects | SOSL |
SELECT *references/soql-syntax-reference.mdQuery goal: <summary>
Query: <soql or sosl>
Design: <relationship / aggregate / filter choices>
Notes: <selectivity, limits, security, governor awareness>
Next step: <run in platform-data-manage or embed in Apex>| Need | Delegate to | Reason |
|---|---|---|
| run the query against an org | platform-data-manage | execution and export |
| embed the query in services/selectors | platform-apex-generate | implementation context |
| analyze slow-query symptoms from logs | platform-apex-logs-debug | runtime evidence |
| wire query-backed UI | experience-lwc-generate | frontend integration |
| Score | Meaning |
|---|---|
| 90+ | production-optimized query |
| 80–89 | good query with minor improvements possible |
| 70–79 | functional but performance concerns remain |
| < 70 | needs revision before production use |
| File | When to read |
|---|---|
| Syntax, operators, date literals, relationship query patterns |
| Selectivity rules, indexing strategy, governor limits, security patterns |
| Quick reference — operators, date functions, aggregate functions, WITH clauses |
| Common SOQL mistakes and their fixes — read before finalizing any query |
| Apex selector layer patterns — read when embedding queries in Apex classes |
| Field coverage validation — read when generating SOQL used inside Apex code |
| sf CLI query execution, bulk export, query plan commands |
| Starter query examples for common objects |
| Parent-to-child and child-to-parent relationship query patterns |
| COUNT, SUM, GROUP BY, ROLLUP query patterns |
| Selective filter and index-aware query patterns |
| Apex Map-based bulk query pattern for trigger contexts |
| Full selector class implementation template |
| Post-write hook — runs static SOQL validation and live query plan analysis after |