agentleFS
advancedcommunitiesadvancedcommunities/salesforce-mcp-server/skills/salesforce/SKILL.md

salesforce

Skill33 starsChanged 2 months agoMITView on GitHub

Use when working with Salesforce orgs — executing Apex, writing SOQL/SOSL, managing records, running tests, deploying metadata, or analyzing code. Guidance for the Salesforce MCP Server's tools, prompts, and resources.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. jdrhyne/agent-skills★ 240same name
    2. refly-ai/refly-skills★ 203same name
    3. HybridAIOne/hybridclaw★ 157same name
    4. enzoleonardi/claude-salesforce-skill★ 8same name
    5. Shanksg/clawskills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 6 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before doing anything else, determine the target org and check permissions.

    line 14
  2. Very specific:

    Use query_records for most data retrieval tasks (exact field filters, relationships, aggregations).

    line 33
  3. Very specific:

    Use search_records only when you need cross-object keyword search (e.g., "find all records mentioning Acme Corp").

    line 34
  4. Distinctive:

    Never build SOSL when a simple SOQL WHERE clause suffices.

    line 35
  5. Distinctive:

    Prefer CRUD tools for simple record operations — they're faster and don't require read-write mode.

    line 46
  6. Very specific:

    Use execute_anonymous_apex when you need transaction control, multiple object operations, or complex logic.

    line 47
  7. Very specific:

    Prefer run_code_analyzer over scanner_run for general-purpose analysis.

    line 59
  8. Very specific:

    Use scanner_run_dfa only when you need deep data-flow security analysis (it's slow).

    line 60
  9. Distinctive:

    All 40 tools grouped by category:

    line 119
  10. Distinctive:

    Start by confirming the target org, list custom objects, then describe the ones the user is interested in to see fields and relationships.

    line 155
  11. Very specific:

    Always describe the object first to get correct field API names, then build the SOQL query.

    line 163
  12. Very specific:

    Run tests first, verify coverage is >= 75%, then deploy.

    line 179
  13. Distinctive:

    Use prompts for guided multi-step workflows.

    line 199

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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

Salesforce MCP Server — Skill Guide

Overview

The Salesforce MCP Server gives you 40 tools, 5 prompts, and 5 resources to interact with Salesforce orgs through the Salesforce CLI. This skill teaches you how to choose the right tool, chain tools into workflows, and avoid common mistakes.

Start Here: Establish Org Context

Before doing anything else, determine the target org and check permissions.

  1. Get the default org — call get_default_org. If a default is set, you can omit targetOrg from all subsequent calls.
  2. List connected orgs — call list_connected_salesforce_orgs if the user hasn't specified which org to use.
  3. Check permissions — call get_server_permissions to see if the server is in read-only mode, which orgs are allowed, and whether client browser mode is on.
  4. Set a default — if the user picks an org, call set_default_org so future calls don't need targetOrg.

Rule: Never guess the org. Always resolve it first.

Tool Selection Guide

Querying Data

NeedToolWhy
Structured query on a single object with field conditionsquery_recordsSOQL — precise field selection, WHERE clause, ORDER BY, LIMIT
Text search across multiple objectssearch_recordsSOSL — FIND {term} IN ALL FIELDS RETURNING Obj1, Obj2
Export large result sets to CSV/JSONquery_records_to_fileStreams results to a file to avoid context window bloat
  • Use query_records for most data retrieval tasks (exact field filters, relationships, aggregations).
  • Use search_records only when you need cross-object keyword search (e.g., "find all records mentioning Acme Corp").
  • Never build SOSL when a simple SOQL WHERE clause suffices.

Executing Code vs. CRUD Operations

NeedToolWhy
Complex business logic, loops, multiple DML opsexecute_anonymous_apexRuns anonymous Apex in the org
Create a single recordcreate_recordREST API — simpler, no Apex needed
Update a single recordupdate_recordREST API — direct field updates
Delete a single recorddelete_recordREST API — direct delete by ID
  • Prefer CRUD tools for simple record operations — they're faster and don't require read-write mode.
  • Use execute_anonymous_apex when you need transaction control, multiple object operations, or complex logic.
  • execute_anonymous_apex is blocked in read-only mode; CRUD tools are also blocked in read-only mode.

Code Analysis

NeedToolWhy
Modern rule-based analysis (PMD, ESLint, regex)run_code_analyzerNewer, recommended tool
List available analysis ruleslist_code_analyzer_rulesSee what rules are available
Legacy multi-engine scanscanner_runOlder tool, still functional
Data flow / path-based security analysisscanner_run_dfaGraph Engine — deep SOQL injection, CRUD/FLS analysis
  • Prefer run_code_analyzer over scanner_run for general-purpose analysis.
  • Use scanner_run_dfa only when you need deep data-flow security analysis (it's slow).

Generating Code

NeedTool
Apex class filesgenerate_class
Apex trigger filesgenerate_trigger
Lightning Web Component or Aura componentgenerate_component
Custom tab for an objectschema_generate_tab

Important: All generate_* tools write files locally. They do NOT push to the org. Use deploy_start afterward to deploy the generated metadata.

Org & User Management

NeedTool
List all connected orgslist_connected_salesforce_orgs
Get current default orgget_default_org
Set default orgset_default_org
Clear default orgclear_default_org
Login to a new orglogin_into_org
Log out of an orglogout
Open org in browseropen
Get user detailsdisplay_user
Assign permission setassign_permission_set
Assign permission set licenseassign_permission_set_license

Metadata & Packages

NeedTool
List metadata components of a typelist_metadata
List all metadata type nameslist_metadata_types
Deploy metadata to orgdeploy_start
Install a packagepackage_install
Uninstall a packagepackage_uninstall

Testing & Debugging

NeedTool
Run Apex testsrun_apex_tests
Get async test resultsget_apex_test_results
Get code coverage infoget_apex_code_coverage
List debug logsapex_log_list
Fetch a specific debug logapex_get_log

Records

NeedTool
Open a record in the browseropen_record
Create a new recordcreate_record
Update an existing recordupdate_record
Delete a recorddelete_record

Tool Reference

All 40 tools grouped by category:

Apex (7): execute_anonymous_apex, run_apex_tests, get_apex_test_results, get_apex_code_coverage, generate_class, generate_trigger, apex_log_list, apex_get_log

Query (2): query_records (SOQL), query_records_to_file (SOQL to file)

Search (1): search_records (SOSL)

SObject (2): sobject_list, sobject_describe

Org Management (7): list_connected_salesforce_orgs, get_default_org, set_default_org, clear_default_org, login_into_org, logout, open

Records (4): open_record, create_record, update_record, delete_record

Admin (4): get_server_permissions, assign_permission_set, assign_permission_set_license, display_user

Metadata (3): list_metadata, list_metadata_types, deploy_start

Code Analysis (4): run_code_analyzer, list_code_analyzer_rules, scanner_run, scanner_run_dfa

Packages (2): package_install, package_uninstall

Schema (1): schema_generate_tab

Lightning (1): generate_component

Skill (1): install_skill

Workflow Patterns

1. Explore an Org

get_default_org → list_connected_salesforce_orgs → sobject_list → sobject_describe

Start by confirming the target org, list custom objects, then describe the ones the user is interested in to see fields and relationships.

2. Query Data

sobject_describe → query_records (or search_records for text search)

Always describe the object first to get correct field API names, then build the SOQL query. For large exports, use query_records_to_file.

3. Write & Run Apex

execute_anonymous_apex → apex_log_list → apex_get_log

Execute Apex, then fetch debug logs to inspect the execution output and diagnose issues.

4. Test & Deploy

run_apex_tests → get_apex_test_results → get_apex_code_coverage → deploy_start

Run tests first, verify coverage is >= 75%, then deploy. Use deploy_start with dryRun: true to validate before the real deployment.

5. Debug Issues

apex_log_list → apex_get_log → execute_anonymous_apex (to test fixes)

List recent logs, fetch the problematic one, analyze it, then use anonymous Apex to test potential fixes.

6. Generate & Deploy Code

generate_class / generate_trigger / generate_component → deploy_start

Generate the files locally, then deploy to the target org.

Prompts

Use prompts for guided multi-step workflows. They fetch live org data and provide structured instructions.

PromptWhen to Use
soql_builderUser needs help constructing a SOQL query — fetches object schema and guides field selection
apex_reviewUser wants a code review of an Apex class — fetches the class body and applies a review checklist
org_health_checkUser wants to assess org health — fetches limits, coverage, and org info
deploy_checklistUser is preparing for a deployment — generates a readiness checklist with live data
debug_apexUser is debugging — fetches and analyzes a debug log for errors and performance

Resources

Resources provide browsable contextual data. Use them to include org information in your context.

ResourceURIWhen to Use
Server Permissionssalesforce://permissionsCheck read-only mode, allowed orgs, client browser mode, default org (alias only)
Org Metadatasalesforce://org/{alias}/metadataGet org summary and available metadata types
Org Objectssalesforce://org/{alias}/objectsList all SObjects in the org
Object Schemasalesforce://org/{alias}/object/{name}Get detailed field/relationship info for an SObject
Org Limitssalesforce://org/{alias}/limitsCheck API limits and usage

Critical Pitfalls

  1. Don't guess the org — Always resolve the target org with get_default_org or ask the user. Calling tools against the wrong org can cause data loss.
  2. Don't use SOSL when SOQL suffices — search_records (SOSL) is for cross-object text search. For structured single-object queries, always use query_records (SOQL).
  3. Don't skip sobject_describe before querying — Field API names are case-sensitive and often differ from labels. Describe the object first to get correct API names.
  4. Don't forget deploy_start after generating code — generate_class, generate_trigger, and generate_component only write files locally. You must deploy to push them to the org.
  5. Respect read-only mode — When the server is in read-only mode, Apex execution, record CRUD, and other write operations are blocked. Check get_server_permissions first.
  6. Don't put large result sets in context — For queries returning many records, use query_records_to_file to write to a file instead of dumping everything into the conversation.
  7. Validate before deploying — Always use deploy_start with dryRun: true first, especially for production orgs.
  8. Don't run DFA unnecessarily — scanner_run_dfa is slow and resource-intensive. Use run_code_analyzer for general analysis and reserve DFA for deep security audits.
  9. Check test coverage before deploying — Salesforce requires >= 75% code coverage for production deployments. Use get_apex_code_coverage to verify.
  10. Don't pass targetOrg when a default is set — If get_default_org returns a value, omit targetOrg from subsequent calls to keep things clean.
  11. Handle client browser mode — When open or open_record returns openInClientBrowser: true, the desktop browser was not launched: navigate to the returned url with your own browser tool. The URL carries a single-use Salesforce login token, so don't echo it back or send it anywhere else. Open one link before asking for the next: Salesforce reuses the same short-lived token for about a minute, so links fetched back to back can share one and later navigations may land on a login page. If the user wants their own browser, call the tool again with forceSystemBrowser: true. The mode is reported as useClientBrowser by get_server_permissions and salesforce://permissions.
  12. Use aliases, not usernames — Org identifiers are always masked: list_connected_salesforce_orgs returns masked usernames (e.g. ja***@ex***.com), org IDs (e.g. 00D***********dEAA) and instance URLs (e.g. https://ac***.my.salesforce.com, sandbox https://ac***--ua***.sandbox.my.salesforce.com) plus a note field, and get_default_org, get_server_permissions and salesforce://permissions report the default org by alias only. Masked values can't be used as targetOrg, so pass an org alias instead. If an org (including the default org) has no alias, ask the user to set one (e.g. sf alias set myOrg=<username>).

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.