data360-code-extension-generate
FreeRuns bundled scriptsNot checkedCreate, develop, test, and deploy Data 360 (Data Cloud) Code Extensions with the sf CLI data-code-extension plugin and the salesforce-data-customcode Python…
by forcedotcom★ 1,200 GitHub starsAbout this skill
data360-code-extension-generate
Overview
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.
Agent Rules (apply to every phase)
- Pass
--target-org <ORG_ALIAS>explicitly torun,deployand everysf org/sf apicommand, even when it's the CLI default.init,scanandzipreject it (Nonexistent flag: --target-org). - Shell state doesn't persist. Start every block that runs
sf data-code-extension,python3orpipwith 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 oreval: some hosts (for example Code Builder) ask for approval on each one. CopyPY_ENVandAPI_VERSIONexactly ascheck_env.shprints them. - Check before you install, and skip anything already present.
- Confirm with the user before changing the org: deploy, delete, or running a deployed transform.
- Hand interactive or privileged steps to the user:
sf org login web, enabling Code Extension, installing or starting Docker Desktop,sudo, installing Homebrew. - Never print secrets (access tokens, session IDs, OAuth client IDs or consumer keys).
- Resolve, print, proceed. Don't ask for values the environment determines (Phase 0a). Ask only when a value is missing or ambiguous. If your shell can't prompt, ask in the conversation and write the files yourself.
- Schema first, then code (Phase 2). Never write code first and ask the user to check the schema afterwards.
- Data 360 MCP server first for org lookups (schemas, queries, runs, deletes). Do the MCP check (Phase 0b) once per session before the first lookup, even if Phase 0 was skipped. Fall back to
sf apior the UI only when it isn't connected or a call fails, and say which you used. OnSession not found(404), retry once before falling back. Details: references/mcp-integration.md. - stderr: when piping
sf … --jsonintojq, use2>/dev/null, never2>&1(warnings break the JSON). Never redirect stderr onscan,runordeploy; their errors and tracebacks go there.
Phase 0: Environment and Org Readiness
0a. Resolve parameters
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).
0b. Run the read-only check
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:
sfcan't run in this shell: your host's
Install data360-code-extension-generate in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the data360-code-extension-generate skill do?
Create, develop, test, and deploy Data 360 (Data Cloud) Code Extensions with the sf CLI data-code-extension plugin and the salesforce-data-customcode Python SDK. Use this skill when creating or writing a code extension script or function (for example one that reads a DLO and writes a DLO), creating custom PySpark transformations for Data 360, editing an existing code extension payload/entrypoint.py, setting up a local code extension environment, scanning, running locally, deploying, or redeploying code extensions. Supports environment setup, init, scan, run, zip, and deploy for script and function packages.
How do I install the data360-code-extension-generate skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the data360-code-extension-generate skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic