Help us improve
Share bugs, ideas, or general feedback.
From sf-skills
Generates, optimizes, and analyzes Salesforce SOQL/SOSL queries from natural language. Automatically activates when working with .soql files, relationship queries, aggregates, or query performance.
npx claudepluginhub ccmalcom/sf-skills-plugin --plugin sf-skillsHow this skill is triggered — by the user, by Claude, or both
Slash command
/sf-skills:querying-soqlThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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/safety improvements for Salesforce queries.
CREDITS.mdREADME.mdassets/aggregate-queries.soqlassets/basic-queries.soqlassets/bulkified-query-pattern.clsassets/optimization-patterns.soqlassets/relationship-queries.soqlassets/selector-class.clsreferences/anti-patterns.mdreferences/cli-commands.mdreferences/field-coverage-rules.mdreferences/query-optimization.mdreferences/selector-patterns.mdreferences/soql-reference.mdreferences/soql-syntax-reference.mdscripts/post-tool-validate.pyGenerates production-ready SOQL queries from natural-language requirements with selectivity analysis and governor-limit guidance. Does not execute queries.
Optimizes Salesforce API performance via SOQL tuning, Composite/Collections batching, relationship queries, and caching using jsforce in JS/TS.
Writes and debugs Apex, builds Lightning Web Components, optimizes SOQL, and sets up Salesforce DX/CI/CD pipelines for CRM customization and integration.
Share bugs, ideas, or general feedback.
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/safety improvements for Salesforce queries.
Use querying-soql when the work involves:
.soql filesDelegate elsewhere when the user is:
Ask for or infer:
Prefer:
| 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 |
Check:
If the user wants runtime verification, hand off execution to:
SELECT * style thinking; query only required fieldsWhen finishing, report in this order:
Suggested shape — use references/soql-syntax-reference.md for exact syntax:
Query goal: <summary>
Query: <soql or sosl>
Design: <relationship / aggregate / filter choices>
Notes: <selectivity, limits, security, governor awareness>
Next step: <run in handling-sf-data or embed in Apex>
| Need | Delegate to | Reason |
|---|---|---|
| run the query against an org | handling-sf-data | execution and export |
| embed the query in services/selectors | generating-apex | implementation context |
| analyze slow-query symptoms from logs | debugging-apex-logs | runtime evidence |
| wire query-backed UI | generating-lwc-components | 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 |
|---|---|
references/soql-syntax-reference.md | Syntax, operators, date literals, relationship query patterns |
references/query-optimization.md | Selectivity rules, indexing strategy, governor limits, security patterns |
references/soql-reference.md | Quick reference — operators, date functions, aggregate functions, WITH clauses |
references/anti-patterns.md | Common SOQL mistakes and their fixes — read before finalizing any query |
references/selector-patterns.md | Apex selector layer patterns — read when embedding queries in Apex classes |
references/field-coverage-rules.md | Field coverage validation — read when generating SOQL used inside Apex code |
references/cli-commands.md | sf CLI query execution, bulk export, query plan commands |
assets/basic-queries.soql | Starter query examples for common objects |
assets/relationship-queries.soql | Parent-to-child and child-to-parent relationship query patterns |
assets/aggregate-queries.soql | COUNT, SUM, GROUP BY, ROLLUP query patterns |
assets/optimization-patterns.soql | Selective filter and index-aware query patterns |
assets/bulkified-query-pattern.cls | Apex Map-based bulk query pattern for trigger contexts |
assets/selector-class.cls | Full selector class implementation template |
scripts/post-tool-validate.py | Post-write hook — runs static SOQL validation and live query plan analysis after .soql file edits |