platform-apex-anonymous-run
Skill by forcedotcom
Runs anonymous Apex against a connected Salesforce org from a .apex file or pasted snippet. It captures the debug log and reports compile and runtime results for Salesforce developers.
Install platform-apex-anonymous-run
Built from the published package, never by AI.
git clone --depth 1 https://github.com/forcedotcom/sf-skills /tmp/sf-skills && mkdir -p ~/.claude/skills && cp -r /tmp/sf-skills/plugins/builder/salesforce-development/skills/platform-apex-anonymous-run ~/.claude/skills/platform-apex-anonymous-runRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install platform-apex-anonymous-run in Claude Code
git clone --depth 1 https://github.com/forcedotcom/sf-skills /tmp/sf-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/sf-skills/plugins/builder/salesforce-development/skills/platform-apex-anonymous-run ~/.gemini/antigravity-cli/skills/platform-apex-anonymous-runAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install platform-apex-anonymous-run in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill runs anonymous Apex against the connected Salesforce org using the sf apex run command. It accepts an existing .apex file or a snippet pasted into the conversation. Snippets are written to a temporary file under .sfdx/tmp first, because the CLI only accepts a file path. The skill then parses the JSON result and reports compile errors, runtime exceptions, and governor limit usage when the log includes them.
Scripts can be wrapped in a savepoint and rollback so org data is left unchanged. If the target org appears to be production, the skill warns before running but does not block the run. It is aimed at Salesforce developers who want to execute and check Apex code. Authoring classes and triggers, running unit tests, and deep debug-log analysis are handled by other skills.
Written from the project's SKILL.md and checked against it.
What it can do
- Run from fileExecutes an existing .apex file against the target org with sf apex run.
- Run pasted snippetsWrites a pasted snippet to a temp file and executes it after the developer confirms it.
- Report compile and runtime resultsSurfaces compile problems with line and column, or runtime exception messages and stack traces.
- Capture debug logReturns the debug log, inline for short logs or saved to a file for large ones.
- Savepoint and rollback wrappingWraps verification scripts in Database.setSavepoint and Database.rollback so org state is untouched.
- Production warningWarns before running against an org that looks like production, without automatically blocking.
- Governor limit signalsFlags LIMIT_USAGE_FOR_NS, EXCEPTION_THROWN, FATAL_ERROR and SOQL or DML patterns in the log.
What you need
- Salesforce CLI (sf) version 2.0.0 or later
- An authenticated Salesforce org
Try asking
- Run scripts/seed-test-data.apex against my default org
- Execute this snippet and tell me the Account count
- Test this upsert logic and roll it back afterward
Good to know
- Anonymous Apex can perform DML, callouts and platform events, so runs are treated as writes unless stated otherwise.
- The production warning is informational only and does not block execution.
- Debug log content may be missing or sparse if no trace flag is active.
- Does not author, deploy or unit test .cls or .trigger files.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: plugins/builder/salesforce-development/skills/platform-apex-anonymous-run/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to platform-apex-anonymous-run
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
platform-apex-anonymous-run: common questions
Does it roll back changes made by my Apex script?
Only if the script is wrapped in a savepoint and rollback. The skill recommends this wrapper for verification-style scripts.
Will it stop me from running code against production?
No. It warns before running against a production-looking org, but the developer decides whether to proceed.
Why do I sometimes get no debug log?
The source says the debug log is returned only if a TraceFlag is active for the running user or a log tail is attached. Running sf apex tail log in another terminal can help.
How do I install platform-apex-anonymous-run?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is platform-apex-anonymous-run free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is platform-apex-anonymous-run safe to use?
It scores 80 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to platform-apex-anonymous-run?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
