/sf-agentforce:data360-code-extension-generatefrom Salesforce — Agentforce & Data 360
Creates, develops, tests, and deploys Data 360 (Data Cloud) Code Extensions using the sf CLI plugin and Python SDK. Handles environment setup, init, scan, local run, zip, and deploy for script and function packages.
Ships in Salesforce — Agentforce & Data 360. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A Data 360 code extension is customer-owned Python (PySpark) that runs inside Data 360:
| Type | Purpose | Local test |
|---|---|---|
| script | Batch transformation deployed as a data transform. Reads and writes DLOs or DMOs. | script run against real org data |
| function | Custom node for Search Index Chunking (--use-in-feature SearchIndexChunking). | function run --test-with test.json |
Workflow: environment check → init → discover schemas → develop → scan → run locally → deploy → run the deployed transform. The skill needs only a shell, file editing, and the ability to ask the user questions. It works with a project venv or with a single system Python 3.11 (cloud workspaces, containers).
Use it to set up a code extension environment, create a script or function package, change payload/entrypoint.py, scan, run locally, deploy, redeploy, or clean up.
--target-org <ORG_ALIAS> explicitly to run, deploy and every sf org / sf api command, even when it's the CLI default. init, scan and zip reject it (Nonexistent flag: --target-org).sf data-code-extension, python3 or pip with the <PY_ENV> line from Phase 0b; other commands don't need it. Write <ORG_ALIAS>, <PROJECT_DIR>, <API_VERSION> and <package_name> literally. Never use $(…), backticks or eval: some hosts (for example Code Builder) ask for approval on each one. Copy PY_ENV and API_VERSION exactly as check_env.sh prints them.sf org login web, enabling Code Extension, installing or starting Docker Desktop, sudo, installing Homebrew.sf api or the UI only when it isn't connected or a call fails, and say which you used. On Session not found (404), retry once before falling back. Details: references/mcp-integration.md.sf … --json into jq, use 2>/dev/null, never 2>&1 (warnings break the JSON). Never redirect stderr on scan, run or deploy; their errors and tracebacks go there.Take what the user already gave and pass "" for the rest; check_env.sh (0b) resolves it:
| Parameter | Resolution order (first match wins) |
|---|---|
PROJECT_DIR | User value → $D360_PROJECT_DIR → /home/codebuilder/dx-project if it exists (Code Builder) → current folder |
ORG_ALIAS | User value → $D360_TARGET_ORG → CLI default org if Connected → the only Connected org. Alias, or username if there's no alias |
<package_name> | User value, else a snake_case name from the request (for example employee_upper) |
Tell the user the values in one line and continue without waiting ("Using org … and project …. Say so if you want different ones."). Stop and ask only if several orgs are Connected with no Connected default (show them), or if none is Connected (ask for the My Domain URL and hand the browser login to the user: environment-setup.md §2).
The plugin needs exactly Python 3.11 and uses whatever python3 is on PATH. The check picks system mode (python3 is 3.11 and pip isn't blocked; <PY_ENV> puts the user-base bin folder on PATH) or venv mode (<PROJECT_DIR>/.venv; <PY_ENV> activates it). An existing .venv always means venv mode. Details: references/environment-setup.md §3.
bash <SKILL_DIR>/scripts/check_env.sh "<PROJECT_DIR or empty>" "<ORG_ALIAS or empty>" # optional 3rd argument: system | venv
It changes nothing. It prints ✅/❌ for sf and the plugin, Python 3.11 (after <PY_ENV>), pip or venv state, salesforce-data-customcode and pipreqs, Java, Docker and the org connection, then PROJECT_DIR=, ORG_ALIAS=, MODE=, PY_ENV= and API_VERSION=. Use the printed PY_ENV and API_VERSION from here on.
For each ❌, follow environment-setup.md in this order, then rerun the check:
sf can't run in this shell: your host's sandbox blocks it. Rerun with permission to run outside the sandbox; until then, ignore the other ❌s.python3.11 -m venv .venv (not uv venv), then run bash <SKILL_DIR>/scripts/venv_hook.sh "<PROJECT_DIR>".pipreqs in one command with python3 -m pip (never bare pip3), as the check prints it. The first install downloads PySpark (about 300 MB); let it finish.Don't start Phase 1 until every ❌ except Docker (deploy only) is fixed. If an install fails (for example, no network), stop and tell the user. Use only this project's Python; never borrow another project's venv. Java: JDK 17 is recommended (11 works); JDK 21 works except for toPandas() and pandas UDFs (environment-setup.md §Java).
MCP check (once, here). Look at your own tool list, including deferred tools listed by name only, for a server whose name contains d360 or data360 and whose tools end in search, payload_examples and execute. Load them if your host requires it, then print MCP: available (<server>) or MCP: not connected. Reuse this answer for the rest of the session.
There's no API or CLI for this. Before deploying, ask the user to turn on Data Cloud Setup → Feature Manager → Code Extension and confirm. The user also needs Data 360 admin permissions.
Use script unless the user asks for a function or mentions Search Index Chunking. Print the choice and continue.
<PY_ENV>
cd <PROJECT_DIR>
sf data-code-extension script init --package-dir <package_name>
# function: sf data-code-extension function init --package-dir <package_name> --use-in-feature SearchIndexChunking
The package root <package_name>/ holds payload/entrypoint.py, payload/config.json (written by scan) and requirements.txt. Run scan, run and deploy from the package root (Command Reference). Full layout: references/quick-reference.md.
The stock entrypoint reads Account_std__dll and writes Account_std_copy__dll, which usually don't exist (table does not exist). Replace them with real objects (Phase 2).
Do this every time before you write or edit entrypoint.py, including follow-ups such as "update entrypoint.py to read X and write Y". You can reuse schemas already fetched in this session.
payload_examples for d360_dlo_get, then execute, one DLO per call. Otherwise use the sf api fallback. Say which you used. Commands and response shapes: references/schema-discovery.md.d360_query_sql, or the fallback in schema-discovery.md), especially for self-joins and root conditions (null vs 0).<target column> ← <source field or expression>. Then write the code.Mapping rules:
KQ_id__c, DataSource__c, DataSourceObject__c, InternalOrganization__c and cdp_sys_SourceVersion__c, and say why. If the user needs one, they must add a lowercase field to the target DLO in Data Cloud.Checklist before Phase 3:
select() of lowercase target columns only1.0, so cast it before comparing with Text: F.col("<key>").cast("long").cast("string")Write the code from the Phase 2 mapping, using only names it returned. read_dlo and read_dmo return PySpark DataFrames, not pandas.
from pyspark.sql.functions import col, upper
from datacustomcode.client import Client
from datacustomcode.io.writer.base import WriteMode
def main():
client = Client()
df = client.read_dlo("<SOURCE_DLO>")
# One expression per target column, in the order of the Phase 2 mapping.
result = df.select(
col("<source_field_a>").alias("<target_column_a>"),
upper(col("<source_field_b>")).alias("<target_column_b>"),
)
client.write_to_dlo("<TARGET_DLO>", result, WriteMode.OVERWRITE)
if __name__ == "__main__":
main()
SDK rules (scan enforces them): read DLOs or DMOs, never both; DLO→DLO or DMO→DMO only; at least one read, with the object name as a string literal; the output DLO must exist and match the columns you write.
Use WriteMode.OVERWRITE for a full recompute. APPEND, MERGE and MERGE_UPSERT_DELETE are also available; OVERWRITE_PARTITIONS raises an error. More patterns, write modes and the optional SDK helpers (LLM text generation, Einstein predictions, bundled files): references/quick-reference.md. For a function, implement function(request: SearchIndexChunkingV1Request, runtime: Runtime) -> SearchIndexChunkingV1Response from the generated template.
<PY_ENV>
cd <PROJECT_DIR>/<package_name>
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py
scan rewrites payload/config.json (read and write permissions) and requirements.txt (with pipreqs). Rerun it after every code change, and check that permissions.read and permissions.write list exactly the Phase 2 objects. On PipreqsScanError, install pipreqs and rerun. Don't use --no-requirements unless the user asks: the deployed transform would be missing packages.
<PY_ENV>
cd <PROJECT_DIR>/<package_name>
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org <ORG_ALIAS>
# function: sf data-code-extension function run --entrypoint ./payload/entrypoint.py --test-with ./payload/tests/test.json
run reads real org data (1,000 rows per read) and prints the output instead of writing it, so the target DLO stays empty. That's expected.Arrow optimization ... DirectByteBuffer UserWarning is harmless.This changes the org. Confirm with the user first. Docker must be running (docker info), and Code Extension must be enabled (0c).
<PY_ENV>
cd <PROJECT_DIR>/<package_name>
sf data-code-extension script deploy \
--target-org <ORG_ALIAS> \
--name <name> \
--package-dir ./payload \
--package-version 0.0.1 \
--description "<description>" \
[--cpu-size CPU_L|CPU_XL|CPU_2XL|CPU_4XL]
-d is --description, not the directory. --package-dir is always ./payload, never the package root. --cpu-size defaults to CPU_2XL. function deploy takes the same flags.deploy with the same --name fails with DeploymentExists, even with a new --package-version. Delete the data transform, then the code extension (UI or MCP, confirming each delete), then deploy again.Output objects ... are already in use).Writing to the DLO happens only when the deployed transform runs. Confirm with the user first. Start it from Data Cloud → Data Transforms → <name> → Run Now (runs take about 10 minutes), or with the MCP transform tools. Then check the output DLO in the UI or with an MCP query.
After every run, successful or not, read the run's messages and tracebacks in the system DLO DataCustomCodeLogs__dll: filter on DataCustomCodeName__c = '<name>' and take the latest ExecutionId__c. The query and how to read the rows: references/run-logs.md. To trace a deployed run, add print() or logging calls and redeploy.
Cleanup: delete the data transform, then the code extension, confirming each delete with the user.
| Error | Fix |
|---|---|
PythonVersionMismatch / PYTHON_VERSION_MISMATCH | Start the block with <PY_ENV>. Venv mode: rerun scripts/venv_hook.sh <PROJECT_DIR> |
PipreqsScanError | Install pipreqs with python3 -m pip, start the block with <PY_ENV>, and rerun scan |
table does not exist | Wrong DLO name (for example the stock Account_std__dll). See Phase 2 |
ValueError: The following columns are not present in the DLO | The listed columns have capital letters. Apply the lowercase rule (Phase 2) |
DeploymentExists | Delete the transform, then the code extension, then redeploy |
| Deployed run fails or writes nothing | Read DataCustomCodeLogs__dll (Phase 7) |
Everything else: references/troubleshooting.md.
| Command | Run from | Required flags | Optional flags |
|---|---|---|---|
script init / function init | Parent folder | -p/--package-dir <package_name> | function: -u/--use-in-feature SearchIndexChunking |
script scan / function scan | Package root | (-e/--entrypoint ./payload/entrypoint.py) | -d/--dry-run, -n/--no-requirements, --config-file |
script run | Package root | -e/--entrypoint, -o/--target-org | --config-file, --dependencies |
function run | Package root | -e/--entrypoint, -t/--test-with | --target-org, --config-file, --dependencies |
script zip / function zip | Package root | -p/--package-dir | -n/--network |
script deploy / function deploy | Package root | -n/--name, --package-version, -d/--description, -p/--package-dir ./payload, -o/--target-org | --cpu-size, --network (Jupyter packages only) |
Verified against plugin data-code-extension 1.4.1 and SDK salesforce-data-customcode 6.1.0. If the plugin version differs, check with sf data-code-extension <type> <command> --help.
salesforce-data-customcode)references/README.md (opens in a new tab)references/environment-setup.md (opens in a new tab)references/mcp-integration.md (opens in a new tab)references/quick-reference.md (opens in a new tab)references/run-logs.md (opens in a new tab)references/schema-discovery.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)scripts/check_env.sh (opens in a new tab)scripts/venv_hook.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
16 skills in this plugin
/afcc-setup-coordinateOrchestrates end-to-end headless setup of Agentforce Contact Center (AFCC) on a Salesforce org. Scans the org first, presents a delta plan for approval, then sequentially provisions demo users, Omni-Channel base settings, a human queue with routing config and members, presence statuses, permission sets, a PSTN voice number, and an active PstnVoice MessagingChannel wired to the queue. Interactive at key decision points — never assumes country, number type, queue names, or user counts. TRIGGER: set up AFCC, configure Agentforce Contact Center, stand up voice contact center, AFCC migration setup, provision AFCC org headlessly./agentforce-bot-upgradeUse this skill to upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec generation, agentforce-generate authoring, and post-conversion .agent enhancements. TRIGGER when: user asks to migrate, upgrade, or convert one or more Einstein Bots (BotDefinition/BotVersion chatbots) to Agentforce agents; runs a multi-bot bot-to-agent upgrade; needs Einstein Bot metadata turned into Agent Spec handoffs and generated .agent agents; convert bots to agents; upgrade my service bots; move bots to Agentforce. DO NOT TRIGGER when: user already has an approved Agent Spec and only wants direct .agent authoring, deploy, test, or observe flows; user wants to migrate or upgrade an EXISTING Agentforce agent from a legacy GenAiPlannerBundle to an NGA aiAuthoringBundle (that is agentforce-generate's 'Migrate a Legacy Agent to Agent Script' flow, not an Einstein Bot upgrade); the request is unrelated to Einstein Bot migration./agentforce-d360-analyzeData Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific Agentforce session by session id (Agent Session UUID `019d…` or MessagingSession id `0Mw…`). Also triggers on session discovery — find/list/search sessions by time, agent, channel, outcome, or conversation text — when the user has no session id yet. DO NOT TRIGGER for design-time architecture questions (use agentforce-architecture-analyze instead) or for runtime perf/latency/SLO questions that require platform telemetry beyond Data Cloud./agentforce-hyperclassifier-configureOnboard a customer org and evaluate or improve Agentforce HyperClassifier routing descriptions against labeled utterances. TRIGGER for classifier evaluation, expected-versus-actual routing reports, repeated regressions, or description optimization with customer ECA authentication. DO NOT TRIGGER for general agent conversation testing, runtime session tracing, or automatic agent deployment./agentforce-observeAnalyze production Agentforce agent behavior using session traces and Data Cloud, and manage Agent Health Monitoring (AHM) alerts. TRIGGER when: user queries STDM session data or Data Cloud trace records; investigates production agent failures, regressions, or performance issues; asks about session traces, conversation logs, or agent metrics; wants to reproduce a reported production issue in preview; runs findSessions or trace analysis queries; creates, lists, updates, or deletes an AHM data alert on an agent metric (escalation rate, deflection, etc.); asks why an alert is not firing or wants to check whether alerts have fired (notification counts, or the per-alert Incidents view). DO NOT TRIGGER when: user creates, modifies, or debugs .agent files during development (use agentforce-generate); writes or runs test specs (use agentforce-test); uses sf agent preview for local development iteration; deploys or publishes agents./agentforce-offline-experimentation-runUse this skill when users want to execute this workflow when a user wants to test how a different LLM model would handle existing Agentforce agent conversations. Trigger when users mention agentforce, offline, experimentation.npx claudepluginhub reej-consulting/reej-sf-skills --plugin sf-agentforce3 plugins ship this exact skill · first indexed Nov 14, 2026
Other plugins' skills for the same job