Help us improve
Share bugs, ideas, or general feedback.
From vanguard-frontier-agentic
Generates bulk Salesforce data operation scripts (Data Loader CSV templates and Anonymous Apex) for owner reassignment, deduplication, mass field update, stale record closing, contact deactivation, and lead conversion.
npx claudepluginhub raishin/vanguard-frontier-agentic --plugin vanguard-frontier-agenticHow this skill is triggered — by the user, by Claude, or both
Slash command
/vanguard-frontier-agentic:salesforce-bulk-data-ops-skillThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Pure-generation T0 skill that produces production-safe scripts for bulk
Guides Salesforce data migrations using Bulk API 2.0, jsforce ETL, Data Loader for org-to-org transfers, CRM imports, and validation with TypeScript examples.
Executes read-only SOQL queries against a connected Salesforce org via sf data query CLI under T1 least-privilege scope. Returns sanitized JSON with structured audit envelope. Use for live record evidence like pipeline counts, field values, or aggregate queries.
Provides patterns for Salesforce platform development: Lightning Web Components (LWC), Apex triggers/classes, REST/Bulk APIs, Connected Apps, Salesforce DX with scratch orgs and 2GP.
Share bugs, ideas, or general feedback.
Pure-generation T0 skill that produces production-safe scripts for bulk Salesforce data operations. Outputs both:
sf apex run --file in sandbox,
with bulkification, error queues, partial success handling, and audit
logging built inNothing is executed by this skill. Execution requires human review, sandbox
dry-run via salesforce-deployment-validator-skill, and production approval
via salesforce-live-guard-agent.
Use salesforce-bulk-data-ops-skill when the work is to generate the
script or template for a bulk data operation:
Delegate elsewhere when:
| Situation | Skill to use |
|---|---|
| Single record lookup or spot update | salesforce-soql-explorer-skill → handoff |
| Permanent hard-delete of records | T3 prohibited — route to salesforce-live-guard-agent |
| Schema changes (add/remove fields) | salesforce-metadata-fetcher-skill |
| Sandbox dry-run execution of generated scripts | salesforce-deployment-validator-skill |
| Production approval for execution | salesforce-live-guard-agent |
| Field mapping for migration CSV | salesforce-field-mapping-skill |
Before generating any bulk script, confirm:
Account, Opportunity, Contact, Lead)
or custom (Custom_Object__c).If any critical context is missing for the specific operation, ask before generating.
| Operation | Recommended approach |
|---|---|
| Owner reassignment (< 10k records) | Anonymous Apex with Database.update + allOrNone=false |
| Owner reassignment (> 10k records) | Apex Batch class |
| Mass field update (< 10k records) | Anonymous Apex OR Data Loader Update |
| Mass field update (> 10k records) | Data Loader Update with CSV OR Apex Batch |
| Deduplication / merge | Anonymous Apex using Database.merge (limit 3 records per merge call) |
| Bulk close stale records | Anonymous Apex with date filter and Database.update |
| Contact deactivation | Anonymous Apex (no delete — soft-deactivate via HasOptedOutOfEmail and custom status field) |
| Lead conversion | Anonymous Apex using Database.convertLead |
Before generating the execution script, generate the backup query:
// Backup: export records before modification
List<Opportunity> backupRecords = [
SELECT Id, OwnerId, StageName, CloseDate, Amount
FROM Opportunity
WHERE <your_filter>
LIMIT 10000
];
// Export this list to CSV before running the update script
System.debug(JSON.serialize(backupRecords));
Include a Data Loader SELECT template to export the affected records before modification.
Apply these mandatory patterns in every Apex script:
Database.update(records, false) (allOrNone=false for partial success)Database.SaveResult[]For every script that mutates records, add an audit log:
// Audit log pattern
List<Bulk_Op_Log__c> auditEntries = new List<Bulk_Op_Log__c>;
for (Database.SaveResult sr : results) {
if (!sr.isSuccess) {
auditEntries.add(new Bulk_Op_Log__c(
Operation__c = 'MassOwnerReassign',
Record_Id__c = sr.getId,
Error_Message__c = sr.getErrors[0].getMessage,
Timestamp__c = DateTime.now
));
}
}
if (!auditEntries.isEmpty) {
Database.insert(auditEntries, false);
}
Produce a Data Loader–ready CSV header row and example data row for the
operation. Include the Id column and the fields being updated.
Include explicit execution pathway guidance in the output.
Score every output before emitting. Threshold: 85+ ship, 70–84 ship with caveat, below 70 reject and revise.
| Dimension | Points | What earns full marks |
|---|---|---|
| Bulkification | 25 | No DML inside loops; records chunked to 200 per batch; collection-based update pattern used |
| Error queue / partial success handling | 20 | Database.update with allOrNone=false; SaveResult[] iterated; failed records collected and logged; script continues after partial failure |
| Idempotency | 15 | Script can be safely re-run without double-applying changes; uses a status field or processed flag; duplicate detection included |
| Null handling | 15 | All field accesses null-guarded; SOQL WHERE clause handles null fields; no NullPointerException risk |
| Audit logging | 15 | Every failure logged with record ID and error message; success count logged; custom audit object or System.debug used |
| Rollback strategy | 10 | Backup SOQL query provided; Recycle Bin / Field History notes included; hard-delete refused with T3 note |
Scoring penalties:
This skill is static-review (T0) only:
sf apex run --file <script.apex> --target-org <sandbox-alias>
via salesforce-deployment-validator-skill.salesforce-live-guard-agent for
human-approval workflow.Hard-deletes (Database.delete followed by Database.emptyRecycleBin,
or DELETELIST in Data Loader) are T3 prohibited. This skill will
not generate hard-delete scripts. All delete patterns use Salesforce
native soft-delete (Recycle Bin).
Stop and decline if:
emptyRecycleBin,
DELETELIST without recycle bin). Explain T3 prohibition.salesforce-live-guard-agent).ModifyAllData bypass for a specific user
context (flag as security concern).verdict: "ship | ship-with-caveat | reject"
quality_score: <0-100>
quality_notes: "<what drove the score>"
operation_summary:
operation_type: "<owner_reassign|mass_field_update|deduplication|bulk_close|deactivate|lead_conversion>"
target_object: "<SObjectApiName>"
estimated_volume: "<user-provided estimate>"
approach: "<anonymous_apex|apex_batch|data_loader>"
backup_query:
description: "Export these records before running the script"
soql: "<SELECT fields FROM Object WHERE filter>"
data_loader_export_template: "<comma-separated API names for Data Loader export>"
apex_script:
description: "<what the script does>"
execution_command: "sf apex run --file <script.apex> --target-org <sandbox-alias>"
code: |
<apex script text>
data_loader_template:
description: "<what the template is for>"
operation: "<update|upsert|insert>"
csv_header_row: "<comma-separated API names>"
example_data_row: "<example values>"
notes: "<any special Data Loader config notes>"
audit_pattern:
included_in_script: <true|false>
audit_object: "<Bulk_Op_Log__c or System.debug>"
captures: ["record_id", "error_message", "timestamp"]
rollback_strategy:
recycle_bin_recoverable: <true|false>
field_history_tracked_fields: "<list if known>"
manual_rollback_steps: "<step-by-step if recycle bin is insufficient>"
backup_query_included: <true|false>
execution_pathway:
step_1: "Review generated script with admin team"
step_2: "Run in sandbox via salesforce-deployment-validator-skill"
step_3: "Verify results in sandbox"
step_4: "Route to salesforce-live-guard-agent for production approval"
t2_t3_notes:
t2_sandbox_required: true
t3_prohibited: "<hard-delete prohibited; this script uses soft-delete only>"
production_approval_required: true
assumptions:
- "<explicit list of assumptions made>"
This is a T0 generation skill with no live org connection. Apply:
'005Xx000001REPLACE') and label them clearly
as placeholders.Id targetOwnerId = [SELECT Id FROM User WHERE Username = :targetUsername LIMIT 1].Id;
| Situation | Hand off to |
|---|---|
| Sandbox dry-run execution | salesforce-deployment-validator-skill |
| Production approval for execution | salesforce-live-guard-agent |
| Field mapping for the CSV template | salesforce-field-mapping-skill |
| Query to identify target records first | salesforce-soql-explorer-skill |
| Apex code review before execution | salesforce-apex-lwc-code-review-skill |
emptyRecycleBin) — stop, explain T3
prohibition, suggest soft-delete with a custom Is_Deleted__c flag.salesforce-metadata-fetcher-skill then
salesforce-data-architecture-agent.| File | When to read |
|---|---|
references/data-loader-templates.md | Data Loader operation templates with CSV patterns |
references/anonymous-apex-patterns.md | Database.update with allOrNone=false, error collection, batching |
references/rollback-strategy.md | Backup patterns, soft-delete vs. hard-delete, Field History, Recycle Bin |