SOQL Queries
Write database queries for Salesforce. AI generates optimized, secure SOQL — no more Googling field names or relationship paths.
Skill Details
Install this skill
Works with
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.
When This Skill Owns the TaskWorkflow
Use sf-soql when the work involves:
.soqlfiles- query generation from natural language
- relationship queries and aggregate queries
- query optimization and selectivity analysis
- SOQL/SOSL syntax and governor-aware design
Delegate elsewhere when the user is:
Required Context to Gather FirstWorkflow
Ask for or infer:
- target object(s)
- fields needed
- filter criteria
- sort / limit requirements
- whether the query is for display, automation, reporting-like analysis, or Apex usage
- whether performance / selectivity is already a concern
Recommended Workflow
1. Generate the simplest correct query
Prefer:
- only needed fields
- clear WHERE criteria
- reasonable LIMIT when appropriate
- relationship depth only as deep as necessary
2. Choose the right query shape
| 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 | |
| Need | Delegate to | Reason |
| run the query against an org | sf-data | execution and export |
| embed the query in services/selectors | sf-apex | implementation context |
| analyze slow-query symptoms from logs | sf-debug | runtime evidence |
| wire query-backed UI | sf-lwc | 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 |
More in Apex & Flow
Apex Code
Write custom Apex classes, triggers, and batch jobs. Describe what you need in plain English and AI builds production-ready Salesforce code.
Debug Logs
Read and analyze Salesforce debug logs. Paste the error, AI finds the root cause and tells you exactly what to fix.
Deployments
Deploy metadata between Salesforce orgs. AI handles the CLI commands, validation, and flags the things that could go wrong.
Navigate Apex & Flow