一键导入
sf-apex
Apex development commands including class and trigger generation, anonymous execution, unit test running, and debug log management.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Apex development commands including class and trigger generation, anonymous execution, unit test running, and debug log management.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Salesforce CLI (sf command) reference and best practices. Use this skill when working with Salesforce development, deployment, org management, data operations, or CI/CD workflows. Covers modern sf v2 commands from version 2.140.6 (June 28, 2026).
Raw REST API and GraphQL requests via sf CLI. Use for custom endpoints, GraphQL queries/mutations, and arbitrary HTTP calls to Salesforce APIs.
Data operations including SOQL queries, single record CRUD, bulk import/export/update, and search.
Org management commands including listing, displaying, opening, and creating Scratch Orgs and Sandboxes.
Agentforce agent management commands including creation, activation, deactivation, and testing.
Authentication commands for connecting to Salesforce orgs. Includes Web Login, JWT, SFDX-URL, and Access Token flows.
| name | sf-apex |
| description | Apex development commands including class and trigger generation, anonymous execution, unit test running, and debug log management. |
sf apex DevelopmentCommands for Apex development.
Create Apex class.
# Create class
sf apex generate class --name MyClass \
--output-dir force-app/main/default/classes
# Create unit test class
sf apex generate class --name MyClassTest \
--template ApexUnitTest \
--output-dir force-app/main/default/classes
DefaultApexClass (default)ApexExceptionApexUnitTestCreate Apex trigger.
# Create trigger
sf apex generate trigger --name AccountTrigger \
--sobject Account \
--event "before insert,after update" \
--output-dir force-app/main/default/triggers
Execute anonymous Apex.
# Execute from file
sf apex run --target-org myOrg --file myScript.apex
# Execute inline
echo "System.debug('Hello World');" | sf apex run --target-org myOrg
# Interactive mode
sf apex run --target-org myOrg
Run Apex tests.
# Run all local tests
sf apex run test --target-org myOrg --test-level RunLocalTests
# Run specific class
sf apex run test --target-org myOrg --tests MyClassTest
# Run with code coverage
sf apex run test --target-org myOrg \
--test-level RunLocalTests \
--code-coverage
Get test results.
# Get test results
sf apex get test --target-org myOrg --test-run-id <test-run-id>
# Get with code coverage
sf apex get test --target-org myOrg \
--test-run-id <test-run-id> \
--code-coverage
Debug log management.
# List logs
sf apex log list --target-org myOrg
# Get specific log
sf apex log get --target-org myOrg --log-id <log-id>
# Tail logs (real-time)
sf apex log tail --target-org myOrg --color