/data360-code-extension-generate
Develop and deploy Data Cloud Code Extensions using SF CLI plugin. Use this skill when creating custom Python transformations for Data Cloud, deploying code extensions, or testing data transformations. Supports init, run, scan, and deploy operations.
$ npx -y skills add forcedotcom/sf-skills --skill data360-code-extension-generate --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/data360-code-extension-generate
Context preview
The summary Claude sees to decide when to auto-load this skill.
Develop and deploy Data Cloud Code Extensions using SF CLI plugin. Use this skill when creating custom Python transformations for Data Cloud, deploying code extensions, or testing data transformations. Supports init, run, scan, and deploy operations.
SKILL.md
data360-code-extension-generate.SKILL.mdname: data360-code-extension-generate
description: "Develop and deploy Data Cloud Code Extensions using SF CLI plugin. Use this skill when creating custom Python transformations for Data Cloud, deploying code extensions, or testing data transformations. Supports init, run, scan, and deploy operations."
metadata:
version: "1.0"
relatedSkills:
- "data360-schema-get"
cliTools:
- tool: ["docker"]
semver: ">=20.0.0"
- tool: ["pip"]
semver: ">=23.0.0"
- tool: ["python"]
semver: ">=3.11.0"
- tool: ["python3"]
semver: ">=3.11.0"
- tool: ["sf"]
semver: ">=2.0.0"data360-code-extension-generate Skill
Overview
This skill provides a complete workflow for developing, testing, and deploying custom Python code extensions to Salesforce Data Cloud. Code extensions allow you to write Python transformations that read from and write to Data Lake Objects (DLOs) and Data Model Objects (DMOs).
When to Use
- User wants to create a new code extension project
- User needs to test a code extension locally
- User wants to scan code for required permissions
- User needs to deploy a code extension to Data Cloud
- User is working with Data Cloud transformations
- User wants to read/write DLO or DMO data programmatically
Prerequisites Check
Before executing any code extension commands, verify prerequisites:
1. **SF CLI with plugin installed**
sf plugins --core | grep data-code-extension
If not installed:
sf plugins install @salesforce/plugin-data-code-extension
2. **Python 3.11**
python --version # Should show 3.11.x
3. **Data Cloud Custom Code SDK**
pip list | grep salesforce-data-customcode
If not installed:
pip install salesforce-data-customcode
4. **Docker running** (for deploy only)
docker ps
5. **Authenticated org**
sf org display --target-org <org_alias> --json
Skill Workflow
Phase 1: Initialize Project
Create a new code extension project with scaffolding.
**Commands:**
For **script-based** code extensions (batch transformations):
sf data-code-extension script init --package-dir <directory>
For **function-based** code extensions (real-time):
sf data-code-extension function init --package-dir <directory>
**Required Option:**
- `--package-dir, -p` - Directory path where the package will be created
**What it creates:**
my-transform/ # Project root
├── payload/ # CRITICAL: This is what --package-dir must point to for deploy
│ ├── entrypoint.py # Main transformation code
│ └── config.json # Code extension configuration
├── requirements.txt # Python dependencies
└── README.md
Directory Context During Workflow
**IMPORTANT:** Understanding the directory structure is critical for successful deployment.
**Commands and their directory requirements:**
| Command | Run From | Path/File Argument | |---------|----------|-------------------| | `init` | Parent directory | `<project-name>` or `.` | | `scan` | Project root | `./payload/entrypoint.py` | | `run` | Project root | `./payload/entrypoint.py` | | `deploy` | Project root | `--package-dir ./payload` (**REQUIRED**) |
**CRITICAL: The `--package-dir` argument in deploy command MUST point to the `payload` directory, not the project root.**
Phase 2: Develop Transformation
Edit `payload/entrypoint.py` with transformation logic.
**Script Example (Batch):**
from datacustomcode import Client
client = Client()
# Read from DLO
df = client.read_dlo('Employee__dll')
# Transform data (uppercase position field)
df['position_upper'] = df['position'].str.upper()
# Write to output DLO
client.write_to_dlo('Employee_Upper__dll', df, 'overwrite')**Function Example (Real-time):**
from datacustomcode import FunctionClient
def transform(event, context):
client = FunctionClient(context)
input_data = event['data']
output = {
'name': input_data['name'].upper(),
'status': 'processed'
}
return output**Common Operations:**
- `client.read_dlo('DLO_Name__dll')` - Read from DLO
- `client.read_dmo('DMO_Name')` - Read from DMO
- `client.write_to_dlo('DLO_Name__dll', df, 'overwrite')` - Write to DLO
- `client.write_to_dmo('DMO_Name', df, 'upsert')` - Write to DMO
Phase 3: Scan for Permissions
Scan the entrypoint file to detect required permissions and generate config.json.
**Command:**
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py
**What it detects:**
- Read permissions for DLOs/DMOs
- Write permissions for DLOs/DMOs
- Python package dependencies
- Updates `config.json` and `requirements.txt`
Phase 4: Validate DLO Schema (Pre-Test Check)
**CRITICAL: Before running tests locally, validate that all DLOs used in your code exist and have the expected fields.**
Step 4a: Extract DLOs from config.json
After scanning, review the generated `config.json` to identify all DLOs:
cat payload/config.json
Step 4b: Validate Each DLO Schema
**Use the `data360-schema-get` skill to verify DLOs exist and check field names.**
For each DLO referenced in your code:
1. **Verify DLO exists:**
python3 scripts/get_dlo_schema.py <org_alias> <dlo_name>
2. **Verify field names match** — compare fields used in your `entrypoint.py` against the DLO schema.
3. **Check all DLOs:**
- Validate all DLOs in `read` permissions
- Validate all DLOs in `write` permissions
- Check field names match exactly (case-sensitive)
- Verify data types are compatible with operations
Step 4c: Validation Checklist
Before proceeding to run, ensure:
- [ ] All DLOs in config.json exist in target org
- [ ] All field names used in code exist in DLO schemas
- [ ] Field data types match your transformation logic
- [ ] Primary
Read more
name: data360-code-extension-generate
description: "Develop and deploy Data Cloud Code Extensions using SF CLI plugin. Use this skill when creating custom Python transformations for Data Cloud, deploying code extensions, or testing data transformations. Supports init, run, scan, and deploy operations."
metadata:
version: "1.0"
relatedSkills:
- "data360-schema-get"
cliTools:
- tool: ["docker"]
semver: ">=20.0.0"
- tool: ["pip"]
semver: ">=23.0.0"
- tool: ["python"]
semver: ">=3.11.0"
- tool: ["python3"]
semver: ">=3.11.0"
- tool: ["sf"]
semver: ">=2.0.0"data360-code-extension-generate Skill
Overview
This skill provides a complete workflow for developing, testing, and deploying custom Python code extensions to Salesforce Data Cloud. Code extensions allow you to write Python transformations that read from and write to Data Lake Objects (DLOs) and Data Model Objects (DMOs).
When to Use
- User wants to create a new code extension project
- User needs to test a code extension locally
- User wants to scan code for required permissions
- User needs to deploy a code extension to Data Cloud
- User is working with Data Cloud transformations
- User wants to read/write DLO or DMO data programmatically
Prerequisites Check
Before executing any code extension commands, verify prerequisites:
1. **SF CLI with plugin installed**
sf plugins --core | grep data-code-extension
If not installed:
sf plugins install @salesforce/plugin-data-code-extension
2. **Python 3.11**
python --version # Should show 3.11.x
3. **Data Cloud Custom Code SDK**
pip list | grep salesforce-data-customcode
If not installed:
pip install salesforce-data-customcode
4. **Docker running** (for deploy only)
docker ps
5. **Authenticated org**
sf org display --target-org <org_alias> --json
Skill Workflow
Phase 1: Initialize Project
Create a new code extension project with scaffolding.
**Commands:**
For **script-based** code extensions (batch transformations):
sf data-code-extension script init --package-dir <directory>
For **function-based** code extensions (real-time):
sf data-code-extension function init --package-dir <directory>
**Required Option:**
- `--package-dir, -p` - Directory path where the package will be created
**What it creates:**
my-transform/ # Project root ├── payload/ # CRITICAL: This is what --package-dir must point to for deploy │ ├── entrypoint.py # Main transformation code │ └── config.json # Code extension configuration ├── requirements.txt # Python dependencies └── README.md
Directory Context During Workflow
**IMPORTANT:** Understanding the directory structure is critical for successful deployment.
**Commands and their directory requirements:**
| Command | Run From | Path/File Argument | |---------|----------|-------------------| | `init` | Parent directory | `<project-name>` or `.` | | `scan` | Project root | `./payload/entrypoint.py` | | `run` | Project root | `./payload/entrypoint.py` | | `deploy` | Project root | `--package-dir ./payload` (**REQUIRED**) |
**CRITICAL: The `--package-dir` argument in deploy command MUST point to the `payload` directory, not the project root.**
Phase 2: Develop Transformation
Edit `payload/entrypoint.py` with transformation logic.
**Script Example (Batch):**
from datacustomcode import Client
client = Client()
# Read from DLO
df = client.read_dlo('Employee__dll')
# Transform data (uppercase position field)
df['position_upper'] = df['position'].str.upper()
# Write to output DLO
client.write_to_dlo('Employee_Upper__dll', df, 'overwrite')**Function Example (Real-time):**
from datacustomcode import FunctionClient
def transform(event, context):
client = FunctionClient(context)
input_data = event['data']
output = {
'name': input_data['name'].upper(),
'status': 'processed'
}
return output**Common Operations:**
- `client.read_dlo('DLO_Name__dll')` - Read from DLO
- `client.read_dmo('DMO_Name')` - Read from DMO
- `client.write_to_dlo('DLO_Name__dll', df, 'overwrite')` - Write to DLO
- `client.write_to_dmo('DMO_Name', df, 'upsert')` - Write to DMO
Phase 3: Scan for Permissions
Scan the entrypoint file to detect required permissions and generate config.json.
**Command:**
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py
**What it detects:**
- Read permissions for DLOs/DMOs
- Write permissions for DLOs/DMOs
- Python package dependencies
- Updates `config.json` and `requirements.txt`
Phase 4: Validate DLO Schema (Pre-Test Check)
**CRITICAL: Before running tests locally, validate that all DLOs used in your code exist and have the expected fields.**
Step 4a: Extract DLOs from config.json
After scanning, review the generated `config.json` to identify all DLOs:
cat payload/config.json
Step 4b: Validate Each DLO Schema
**Use the `data360-schema-get` skill to verify DLOs exist and check field names.**
For each DLO referenced in your code:
1. **Verify DLO exists:**
python3 scripts/get_dlo_schema.py <org_alias> <dlo_name>
2. **Verify field names match** — compare fields used in your `entrypoint.py` against the DLO schema.
3. **Check all DLOs:**
- Validate all DLOs in `read` permissions
- Validate all DLOs in `write` permissions
- Check field names match exactly (case-sensitive)
- Verify data types are compatible with operations
Step 4c: Validation Checklist
Before proceeding to run, ensure:
- [ ] All DLOs in config.json exist in target org
- [ ] All field names used in code exist in DLO schemas
- [ ] Field data types match your transformation logic
- [ ] Primary
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/sf-skills
Other skills on sf-skills.
- /agentforce-generate
Build, modify, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, optimizes, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent actions, tools,
Open skill - /agentforce-observe
Analyze production Agentforce agent behavior using session traces and Data Cloud. 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,
Open skill - /agentforce-test
Write, run, and analyze structured test suites for Agentforce agents — functional AND security. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf agent test create, run, run-eval, or results commands; asks about test coverage strategy, metric
Open skill - /automation-flow-generate
Generate Salesforce Flows using the MCP tool execute_metadata_action. Use when the user asks to create, build, or generate a flow — including Screen, Autolaunched, Record-Triggered (before/after-save), Scheduled. Also trigger for flow-like requests such as \"when a record is
Open skill - /dx-code-analyzer-configure
Set up, configure, and troubleshoot Salesforce Code Analyzer for any project. Handles installation, prerequisite checks, diagnosing broken setups, creating and editing code-analyzer.yml overrides, engine-specific settings, ignore patterns, severity overrides, and CI/CD pipeline
Open skill - /dx-code-analyzer-custom-rule-create
Create custom Code Analyzer rules for Regex (pattern matching), PMD (XPath/AST for Apex and metadata XML), and ESLint (LWC/JavaScript/TypeScript). Use when users want to enforce coding standards, ban patterns, detect hardcoded values, govern metadata, or add rules not in the
Open skill

