
Sf Soql
Write correct Salesforce SOQL and SOSL queries with date literals, filters, and relationship patterns while building CRM-backed features.
Overview
Sf-soql is an agent skill for the Build phase that provides a comprehensive SOQL and SOSL reference with date literals and example queries for Salesforce objects.
Install
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-soqlWhat is this skill?
- Comprehensive SOQL/SOSL reference oriented to real SELECT examples.
- Standard date literals table (YESTERDAY, TODAY, TOMORROW) with boundary semantics.
- Week, month, and quarter literal families (THIS_WEEK, LAST_MONTH, THIS_QUARTER, etc.).
- Copy-pasteable filter patterns on Opportunity, Lead, Case, Task, and Event objects.
- Supports aggregate queries such as SUM(Amount) with date literal WHERE clauses.
- Standard, week, month, and quarter date literal tables with example SELECT statements
Adoption & trust: 1 installs on skills.sh; 7 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You are building against Salesforce but keep rewriting date filters and object queries from scattered docs.
Who is it for?
Indie builders and small teams adding Salesforce CRM reads, reports, or agent queries during feature integration.
Skip if: Teams that need only non-Salesforce SQL or who already centralize queries in a governed internal style guide.
When should I use this skill?
Authoring or reviewing Salesforce SOQL/SOSL queries that use date literals or standard object filters.
What do I get? / Deliverables
After using the reference, you produce valid SOQL with correct date literals and object-specific WHERE clauses ready for Apex, APIs, or agent-generated data jobs.
- Validated SOQL/SOSL query strings
- Date-literal filters aligned to Salesforce calendar rules
Recommended Skills
Journey fit
Canonical shelf is Build because SOQL is applied while implementing Salesforce data access, reports, and automation—not during initial idea research. Integrations is the right subphase for querying standard and custom objects against the Salesforce platform API.
How it compares
Reference procedural skill for SOQL literals, not a live MCP connector to your org.
Common Questions / FAQ
Who is sf-soql for?
Sf-soql is for developers and agent users implementing Salesforce integrations who need authoritative SOQL date literal and query patterns at coding time.
When should I use sf-soql?
Use sf-soql in Build integrations whenever you filter Leads, Opportunities, Cases, Tasks, or Events by CreatedDate, CloseDate, or ActivityDate using THIS_MONTH, LAST_WEEK, or related literals.
Is sf-soql safe to install?
The skill is documentation-style query reference; confirm vendor trust via the Security Audits panel on this page before installing third-party Salesforce skills in your agent.
SKILL.md
READMESKILL.md - Sf Soql
# SOQL/SOSL Comprehensive Reference ## 1. Complete Date Literals Table ### Standard Date Literals | Literal | Description | Example | |---|---|---| | `YESTERDAY` | Starts 00:00:00 yesterday, ends 00:00:00 today | `SELECT Id FROM Task WHERE ActivityDate = YESTERDAY` | | `TODAY` | Starts 00:00:00 today, ends 00:00:00 tomorrow | `SELECT Id FROM Lead WHERE CreatedDate = TODAY` | | `TOMORROW` | Starts 00:00:00 tomorrow, ends 00:00:00 day after | `SELECT Id FROM Event WHERE ActivityDate = TOMORROW` | ### Week Literals | Literal | Description | Example | |---|---|---| | `THIS_WEEK` | Current week (Sunday–Saturday) | `SELECT Id FROM Opportunity WHERE CloseDate = THIS_WEEK` | | `LAST_WEEK` | Previous week | `SELECT Id FROM Case WHERE CreatedDate = LAST_WEEK` | | `NEXT_WEEK` | Following week | `SELECT Id FROM Event WHERE ActivityDate = NEXT_WEEK` | ### Month Literals | Literal | Description | Example | |---|---|---| | `THIS_MONTH` | Current calendar month | `SELECT Id FROM Opportunity WHERE CloseDate = THIS_MONTH` | | `LAST_MONTH` | Previous calendar month | `SELECT SUM(Amount) FROM Opportunity WHERE CloseDate = LAST_MONTH` | | `NEXT_MONTH` | Following calendar month | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_MONTH` | ### Quarter Literals | Literal | Description | Example | |---|---|---| | `THIS_QUARTER` | Current quarter (Jan–Mar, Apr–Jun, Jul–Sep, Oct–Dec) | `SELECT Id, Amount FROM Opportunity WHERE CloseDate = THIS_QUARTER` | | `LAST_QUARTER` | Previous quarter | `SELECT COUNT() FROM Opportunity WHERE CloseDate = LAST_QUARTER AND IsWon = true` | | `NEXT_QUARTER` | Following quarter | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_QUARTER` | ### Year Literals | Literal | Description | Example | |---|---|---| | `THIS_YEAR` | Current calendar year | `SELECT Id, Amount FROM Opportunity WHERE CloseDate = THIS_YEAR` | | `LAST_YEAR` | Previous calendar year | `SELECT SUM(Amount) FROM Opportunity WHERE CloseDate = LAST_YEAR AND IsWon = true` | | `NEXT_YEAR` | Following calendar year | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_YEAR` | ### Relative N-Day Literals | Literal | Description | Example | |---|---|---| | `LAST_N_DAYS:n` | Last n days (not including today) | `SELECT Id FROM Lead WHERE CreatedDate = LAST_N_DAYS:30` | | `NEXT_N_DAYS:n` | Next n days (not including today) | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_N_DAYS:60` | | `LAST_90_DAYS` | Last 90 days | `SELECT Id FROM Account WHERE LastActivityDate = LAST_90_DAYS` | | `NEXT_90_DAYS` | Next 90 days | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_90_DAYS` | | `N_DAYS_AGO:n` | Exactly n days ago | `SELECT Id FROM Task WHERE ActivityDate = N_DAYS_AGO:7` | ### Relative N-Week Literals | Literal | Description | Example | |---|---|---| | `LAST_N_WEEKS:n` | Last n weeks | `SELECT Id FROM Case WHERE CreatedDate = LAST_N_WEEKS:4` | | `NEXT_N_WEEKS:n` | Next n weeks | `SELECT Id FROM Event WHERE ActivityDate = NEXT_N_WEEKS:2` | | `N_WEEKS_AGO:n` | Exactly n weeks ago | `SELECT Id FROM Task WHERE CreatedDate > N_WEEKS_AGO:4` | ### Relative N-Month Literals | Literal | Description | Example | |---|---|---| | `LAST_N_MONTHS:n` | Last n months | `SELECT Id FROM Opportunity WHERE CloseDate = LAST_N_MONTHS:6` | | `NEXT_N_MONTHS:n` | Next n months | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_N_MONTHS:3` | | `N_MONTHS_AGO:n` | Exactly n months ago | `SELECT Id FROM Account WHERE CreatedDate > N_MONTHS_AGO:12` | ### Relative N-Quarter Literals | Literal | Description | Example | |---|---|---| | `LAST_N_QUARTERS:n` | Last n quarters | `SELECT SUM(Amount) FROM Opportunity WHERE CloseDate = LAST_N_QUARTERS:4 AND IsWon = true` | | `NEXT_N_QUARTERS:n` | Next n quarters | `SELECT Id FROM Opportunity WHERE CloseDate = NEXT_N_QUARTERS:2` | | `N_QUARTERS_AGO:n` | Exactly n quarters ago | `SELECT Id FROM Opportunity WHERE CloseDate > N_QUARTERS_AGO:2` | ### Relative N-Year Literals | Literal | Description | Example | |---|---|---| | `LAST_N_YE