agentleFS
SalesforceLabsSalesforceLabs/afls-for-claude/skills/salesforce-query/SKILL.md

salesforce-query

Skill10 starsChanged 29 days agoApache-2.0View on GitHub

Helps construct and execute SOQL queries against Life Sciences Cloud (LSC) orgs. Use when user needs to query data, check configurations, or explore the LSC data model in their Salesforce org.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    NEVER use run_soql for compact layouts: Use retrieve_metadata to fetch compact layout metadata, or use the Tooling API with a query like:

    line 66
  2. Distinctive:

    Start with small LIMIT values to test queries

    line 74
  3. Very specific:

    Use describe_sobject liberally - don't assume field names

    line 75
  4. Distinctive:

    Check the Admin Console documentation for feature-specific object relationships

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

For LSC-specific query guidance, call search_lsc_knowledge({ query: "<topic>" }) to get sourced documentation about the relevant objects and fields.

Salesforce Query Assistant for LSC

You help users query and explore their LSC Salesforce orgs.

Before Querying

  1. Check setup status with check_lsc_setup to ensure:
    • Salesforce CLI is installed
    • User is authenticated to an org
    • Target org is set
  2. If not set up, guide through:
    • Installing SF CLI with install_sf_cli
    • Authenticating: sf org login web --alias my-lsc-org
    • Setting target with set_target_org

Important: Discover Object Names First

LSC object API names vary by implementation and package version. Always use describe_sobject to verify object and field names before writing queries.

Common objects to explore:

  • Account - HCPs and HCOs (often PersonAccount)
  • Visit or similar - Visit records
  • Product2 - Products
  • Territory-related objects

Query Workflow

  1. Ask user what data they need
  2. Use describe_sobject to find the correct object and field names
  3. Build the query using discovered field names
  4. Execute with run_soql
  5. Iterate if needed

Example Workflow

User: "Show me recent visits"

  1. First, discover the Visit object:
    describe_sobject for likely visit objects
  2. Then query with actual field names from the describe result

Objects That Cannot Be Queried via SOQL

Some Salesforce metadata is not accessible via SOQL — these require the Tooling API or Metadata API instead:

Object / FeatureCorrect API
CompactLayout / Compact LayoutsTooling API or Metadata API
LifeSciConfigRecord / Admin Console settingsTooling API (list_admin_settings)
LifeSciConfigFieldValue / DB Schema recordsTooling API (list_db_schema)
Quick Actions / Custom ActionsTooling API (list_lsc_actions)
Page LayoutsMetadata API (retrieve_metadata)

NEVER use run_soql for compact layouts. Use retrieve_metadata to fetch compact layout metadata, or use the Tooling API with a query like:

SELECT Id, Name, Label FROM CompactLayout WHERE EntityDefinitionId = '<ObjectId>'

via sf data query --use-tooling-api.

Tips

  • Start with small LIMIT values to test queries
  • Use describe_sobject liberally - don't assume field names
  • LSC uses Health Cloud/Industry Cloud objects, not custom __c objects for core functionality
  • Check the Admin Console documentation for feature-specific object relationships

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.