Agent skill

Platform Soql Query

by forcedotcom in forcedotcom/sf-skills

A skill your agent uses when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and…

Apache-2.0Auto-check passedDatabases

Install Platform Soql Query

skills CLI
$ npx skills add forcedotcom/sf-skills --skill platform-soql-query -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install forcedotcom/sf-skills platform-soql-query --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/forcedotcom/sf-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/platform-soql-query .claude/skills/platform-soql-query && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
platform-soql-query
GitHub stars
1.1k
Token cost
~1.6k tokens
SKILL.md length
530 words
Files
16 (incl. scripts, references, assets)
Skills in repo
248
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and…

  • Works in 4 steps: Generate the simplest correct query → Choose the right query shape → Optimize for selectivity and safety → …
  • The user needs SOQL/SOSL authoring
  • SKILL.md covers When This Skill Owns the Task, Required Context to Gather First, Recommended Workflow and High-Signal Rules, plus 4 more sections
  • Runs Python scripts from its folder

What it does

Platform Soql Query is an agent skill from forcedotcom/sf-skills. Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements. TRIGGER when the user writes, optimizes, or debugs SOQL/SOSL, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER for bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 18 other files, including scripts, reference files and assets (for example `README.md`, `references/anti-patterns.md` and `references/cli-commands.md`).

It sits in Databases, covering Query optimization. It works with Salesforce. The repository describes itself as: Salesforce's curated collection of agent skills for building applications. Optimized for Agentforce Vibes, compatible with all AI tools. The licence is Apache-2.0.

When your agent uses it

  • The user needs SOQL/SOSL authoring
  • Optimization: natural-language-to-query generation
  • Relationship queries
  • Query-plan/selectivity analysis

Example prompts

  • “/platform-soql-query”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Generate the simplest correct query
  2. Choose the right query shape
  3. Optimize for selectivity and safety
  4. Validate execution path if needed

What it can do on your machine

Read from SKILL.md and the folder at commit 3c15867. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Platform Soql Query loads about 1.6k tokens when it runs, and up to ~16k if it reads all its reference files. Until then it costs about 130 tokens; SKILL.md has 530 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~130
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~16k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from forcedotcom/sf-skills at commit 3c15867, republished under its Apache-2.0 licence (© forcedotcom). 530 words, ~1,576 tokens.

Download SKILL.mdSave it as .claude/skills/platform-soql-query/SKILL.md (or your agent's skills folder). This skill also uses 15 other files; get the full folder from GitHub.
name
platform-soql-query
description
Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements. TRIGGER when the user writes, optimizes, or debugs SOQL/SOSL, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER for bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.
metadata.version
1.1
metadata.domains
Platform
metadata.relatedSkills
experience-lwc-generate, platform-apex-generate, platform-apex-logs-debug, platform-apex-test-run, platform-data-manage

platform-soql-query: Salesforce SOQL Query Expert

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 Task

Use platform-soql-query when the work involves:

  • .soql files
  • 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 First

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

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
NeedDefault pattern
parent data from childchild-to-parent traversal
child rows from parentsubquery
counts / rollupsaggregate query
records with / without related rowssemi-join / anti-join
text search across objectsSOSL
3. Optimize for selectivity and safety

Check:

  • indexed / selective filters
  • no unnecessary fields
  • no avoidable wildcard or scan-heavy patterns
  • security enforcement expectations
4. Validate execution path if needed

If the user wants runtime verification, hand off execution to:


High-Signal Rules

  • never use SELECT * style thinking; query only required fields
  • do not query inside loops in Apex contexts
  • prefer filtering in SOQL rather than post-filtering in Apex
  • use aggregates for counts and grouped summaries instead of loading unnecessary records
  • evaluate wildcard usage carefully; leading wildcards often defeat indexes
  • account for security mode / field access requirements when queries move into Apex

Output Format

When finishing, report in this order:

  1. Query purpose
  2. Final SOQL/SOSL
  3. Why this shape was chosen
  4. Optimization or security notes
  5. Execution suggestion if needed

Suggested shape — use references/soql-syntax-reference.md for exact syntax:

text
Query 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>

Show full SKILL.md (204 more words)Show less

Cross-Skill Integration

NeedDelegate toReason
run the query against an orgplatform-data-manageexecution and export
embed the query in services/selectorsplatform-apex-generateimplementation context
analyze slow-query symptoms from logsplatform-apex-logs-debugruntime evidence
wire query-backed UIexperience-lwc-generatefrontend integration

Score Guide

ScoreMeaning
90+production-optimized query
80–89good query with minor improvements possible
70–79functional but performance concerns remain
< 70needs revision before production use

Reference File Index

FileWhen to read
references/soql-syntax-reference.mdSyntax, operators, date literals, relationship query patterns
references/query-optimization.mdSelectivity rules, indexing strategy, governor limits, security patterns
references/soql-reference.mdQuick reference — operators, date functions, aggregate functions, WITH clauses
references/anti-patterns.mdCommon SOQL mistakes and their fixes — read before finalizing any query
references/selector-patterns.mdApex selector layer patterns — read when embedding queries in Apex classes
references/field-coverage-rules.mdField coverage validation — read when generating SOQL used inside Apex code
references/cli-commands.mdsf CLI query execution, bulk export, query plan commands
assets/basic-queries.soqlStarter query examples for common objects
assets/relationship-queries.soqlParent-to-child and child-to-parent relationship query patterns
assets/aggregate-queries.soqlCOUNT, SUM, GROUP BY, ROLLUP query patterns
assets/optimization-patterns.soqlSelective filter and index-aware query patterns
assets/bulkified-query-pattern.clsApex Map-based bulk query pattern for trigger contexts
assets/selector-class.clsFull selector class implementation template
scripts/post-tool-validate.pyPost-write hook — runs static SOQL validation and live query plan analysis after .soql file edits

© forcedotcom, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 15 other files (scripts, references, assets) in skills/platform-soql-query of forcedotcom/sf-skills.

  • SKILL.md
  • README.md
  • assets/aggregate-queries.soql
  • assets/basic-queries.soql
  • assets/bulkified-query-pattern.cls
  • assets/optimization-patterns.soql
  • assets/relationship-queries.soql
  • assets/selector-class.cls
  • references/anti-patterns.md
  • references/cli-commands.md
  • references/field-coverage-rules.md
  • references/query-optimization.md
  • references/selector-patterns.md
  • references/soql-reference.md
  • references/soql-syntax-reference.md
  • scripts/post-tool-validate.py

Open the folder on GitHubat commit 3c15867

Compare with similar skills

Platform Soql Query next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Platform Soql Query compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Platform Soql Query this skillforcedotcom/sf-skills1.1k—~1.6kAutomated safety check: PassApache-2.0
SQL Optimization Patternsynulihao/AgentSkillOS61710 repos~3.3kAutomated safety check: PassNone
Query Engine Designrevfactory/claude-code-harness120—~474Automated safety check: PassNone
Query Plan Snapshot CLIeclipse-rdf4j/rdf4j420—~1.5kAutomated safety check: PassBSD-3-Clause
Wp Acf And Content Modelingjorgerosal/wordpress-skills100—~3.2kAutomated safety check: PassMIT
Jpa Patternsaffaan-m/ECC274k5 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • SQL Optimization Patterns

    ynulihao/AgentSkillOS

    Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.

    617 GitHub starsUsed in 10 repos~3.3k tokens
    DatabasesAuto-check passed
  • Query Engine Design

    revfactory/claude-code-harness

    SQL query engine design and implementation guide. An agent skill from revfactory/claude-code-harness.

    120 GitHub stars~474 tokensUpdated 7 mo ago
    DatabasesAuto-check passed
  • Query Plan Snapshot CLI

    eclipse-rdf4j/rdf4j

    Use QueryPlanSnapshotCli to capture and compare RDF4J query plans, then assess likely performance improvements/regressions from execution verification and semantic plan diffs.

    420 GitHub stars~1.5k tokensUpdated today
    DatabasesAuto-check passed
  • Wp Acf And Content Modeling

    jorgerosal/wordpress-skills

    WordPress ACF and content modeling review. An agent skill from jorgerosal/wordpress-skills.

    100 GitHub stars~3.2k tokensUpdated 4 mo ago
    DatabasesAuto-check passed
  • Jpa Patterns

    affaan-m/ECC

    JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.

    274k GitHub starsUsed in 5 repos~1.2k tokens
    DatabasesAuto-check passed
  • Postgres Patterns

    ThibautBaissac/rails_ai_agents

    PostgreSQL database patterns for query optimization, schema design, indexing, and security.

    665 GitHub starsUsed in 7 repos~922 tokens
    DatabasesAuto-check passed

More from forcedotcom/sf-skills

All 248 skills in this repo
  • Agentforce Architecture Analyze

    forcedotcom/sf-skills

    Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins.

    1.1k GitHub stars~3.6k tokensUpdated 4 days ago
    Auto-check passed
  • Agentforce D360 Analyze

    forcedotcom/sf-skills

    Data Cloud 360° view of a single Agentforce session. An agent skill from forcedotcom/sf-skills.

    1.1k GitHub stars~2.9k tokensUpdated 4 days ago
    Auto-check passed
  • Apply a Salesforce sandbox post-copy automation JSON config against a target org.

    1.1k GitHub stars~5.3k tokensUpdated 4 days ago
    Auto-check: notes
  • Apply a Salesforce sandbox post-copy automation JSON config against a target org.

    1.1k GitHub stars~5.4k tokensUpdated 4 days ago
    Auto-check: notes
  • Design Systems Slds Apply

    forcedotcom/sf-skills

    Apply SLDS-compliant UI using the correct blueprints, styling hooks, utility classes, and icons.

    1.1k GitHub stars~3.7k tokensUpdated 4 days ago
    Auto-check passed
  • Experience Lwc Generate

    forcedotcom/sf-skills

    Lightning Web Components with PICKLES methodology and 165-point scoring.

    1.1k GitHub stars~2.4k tokensUpdated 4 days ago
    Auto-check passed

Works with

Categories

Questions about Platform Soql Query

What does Platform Soql Query do?

A skill your agent uses when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and…. Platform Soql Query is an agent skill from forcedotcom/sf-skills. Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements.

When should I use Platform Soql Query?

Platform Soql Query fits situations like: the user needs SOQL/SOSL authoring; optimization: natural-language-to-query generation; relationship queries; query-plan/selectivity analysis.

How do I install Platform Soql Query in Claude Code?

Run `npx skills add forcedotcom/sf-skills --skill platform-soql-query -a claude-code`. Or copy the skill folder (skills/platform-soql-query in forcedotcom/sf-skills) into .claude/skills/platform-soql-query in your project. Claude Code loads it when a task matches its description.

How do I install Platform Soql Query in Codex?

Run `npx skills add forcedotcom/sf-skills --skill platform-soql-query -a codex`. Or copy the skill folder (skills/platform-soql-query in forcedotcom/sf-skills) into .agents/skills/platform-soql-query in your project. Codex loads it when a task matches its description.

Can I use Platform Soql Query in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add forcedotcom/sf-skills --skill platform-soql-query -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/platform-soql-query, .gemini/skills/platform-soql-query, .github/skills/platform-soql-query and .opencode/skills/platform-soql-query in your project.

What does Platform Soql Query need to run?

Going by SKILL.md and its folder, Platform Soql Query needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Platform Soql Query access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Platform Soql Query safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Platform Soql Query use?

Platform Soql Query is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Platform Soql Query use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 15k tokens, read only when the agent opens those files.

What are the alternatives to Platform Soql Query?

Skills that share tags, products or a category with Platform Soql Query: SQL Optimization Patterns (ynulihao/AgentSkillOS, 617 stars), Query Engine Design (revfactory/claude-code-harness, 120 stars), Query Plan Snapshot CLI (eclipse-rdf4j/rdf4j, 420 stars) and Wp Acf And Content Modeling (jorgerosal/wordpress-skills, 100 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Platform Soql Query?

forcedotcom (a GitHub organization) maintains it in forcedotcom/sf-skills, which has 1,058 GitHub stars. The repository holds 248 skills in this directory. The repository was last updated on October 3, 2026.

Source: forcedotcom/sf-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.