
Handling Sf Data
Create and load large Salesforce datasets with Bulk API, batch Apex, or CLI import patterns for realistic testing and migrations.
Overview
Handling SF Data is an agent skill most often used in Build (also Operate) that guides bulk Salesforce record creation via Bulk API, CLI import, and batch Apex.
Install
npx skills add https://github.com/forcedotcom/sf-skills --skill handling-sf-dataWhat is this skill?
- Documents bulk insert of 10,000+ records with Bulk API 2.0 and performance testing scenarios
- Recommends sf data import bulk with CSV over Anonymous Apex for volume
- Includes Batchable Apex pattern (e.g. BulkAccountCreator) with Database.executeBatch sizing
- Covers Data Loader and chunked batch approaches for migration validation
- Explicit warning: large scripts are for CLI/Bulk API, not single Anonymous Apex runs
- 10,000+ records bulk insert guidance
- Batch execute example with chunk size 200
Adoption & trust: 711 installs on skills.sh; 513 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need 10k+ Salesforce records for testing or migration drills but Anonymous Apex and manual inserts hit limits immediately.
Who is it for?
Developers on Salesforce sandboxes or integration projects seeding volume for Bulk API, reports, or migration validation.
Skip if: Non-Salesforce stacks or small fixtures creatable in a few DML statements in dev scripts.
When should I use this skill?
Bulk API testing, performance testing, data migration validation, or report/dashboard testing requires large Salesforce record volumes.
What do I get? / Deliverables
You choose a bulk-safe path—CSV bulk import, Data Loader, or batch Apex—and execute large datasets without blowing governor limits.
- Batch Apex or bulk import plan
- Executable bulk data generation approach for target objects
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Bulk data handling is implemented as Salesforce backend work—Apex batches, CSV imports, and org data shape—during product and integration buildout. Backend subphase covers server-side data creation, governor-limit-aware batch jobs, and Bulk API workflows rather than UI or marketing tasks.
Where it fits
Seed 10k Accounts via batch Apex to stress-test a new integration sync job.
Prepare CSV and sf data import bulk for Bulk API 2.0 contract tests.
Refresh a full sandbox with migration-like volume before a cutover rehearsal.
How it compares
Skill recipes for Salesforce data volume—not a generic SQL seed script or Postgres fixture generator.
Common Questions / FAQ
Who is handling-sf-data for?
Solo builders and integrators working in Salesforce orgs who must load or generate large record sets for API, reporting, or migration testing.
When should I use handling-sf-data?
During Build when implementing data-heavy features or sync jobs, and in Operate when rehearsing migrations or refreshing perf-test sandboxes—whenever 10,000+ records are required.
Is handling-sf-data safe to install?
Scripts can modify org data and use CLI credentials; review the Security Audits panel on this page, run only in sandboxes first, and never point bulk jobs at production without change control.
SKILL.md
READMESKILL.md - Handling Sf Data
/** * ═══════════════════════════════════════════════════════════════════════════════ * BULK INSERT 10,000+ RECORDS * For Bulk API and large data volume testing * ═══════════════════════════════════════════════════════════════════════════════ * * ⚠️ IMPORTANT: This script is designed to be run via sf CLI Bulk API * NOT via Anonymous Apex (which has governor limits) * * PURPOSE: * Generate large datasets for: * • Bulk API 2.0 testing * • Performance testing * • Data migration validation * • Report/Dashboard testing with realistic volumes * * APPROACHES: * 1. Use sf data import bulk with CSV files (recommended) * 2. Use Data Loader for very large datasets * 3. Use batch Apex to create in smaller chunks * * ═══════════════════════════════════════════════════════════════════════════════ */ // ═══════════════════════════════════════════════════════════════════════════════ // APPROACH 1: BATCH APEX FOR LARGE DATA CREATION // ═══════════════════════════════════════════════════════════════════════════════ /** * Batch class to create large number of Account records * Execute with: Database.executeBatch(new BulkAccountCreator(10000), 200); */ public class BulkAccountCreator implements Database.Batchable<Integer>, Database.Stateful { private Integer targetCount; private Integer createdCount = 0; private String namePrefix; private List<String> industries; private DateTime startTime; public BulkAccountCreator(Integer count) { this.targetCount = count; this.namePrefix = 'BulkData'; this.industries = new List<String>{ 'Technology', 'Healthcare', 'Finance', 'Manufacturing', 'Retail', 'Education', 'Energy', 'Media' }; this.startTime = DateTime.now(); } public Iterable<Integer> start(Database.BatchableContext bc) { // Create list of indices to process List<Integer> indices = new List<Integer>(); for (Integer i = 0; i < targetCount; i++) { indices.add(i); } return indices; } public void execute(Database.BatchableContext bc, List<Integer> indices) { List<Account> accounts = new List<Account>(); for (Integer i : indices) { accounts.add(new Account( Name = namePrefix + '_' + String.valueOf(i).leftPad(7, '0'), Industry = industries[Math.mod(i, industries.size())], Type = Math.mod(i, 3) == 0 ? 'Customer' : 'Prospect', AnnualRevenue = 50000 + (Math.mod(i, 1000) * 1000), NumberOfEmployees = 10 + Math.mod(i, 1000), BillingCity = 'San Francisco', BillingState = 'CA', BillingCountry = 'USA', Description = 'Bulk created record ' + i )); } insert accounts; createdCount += accounts.size(); } public void finish(Database.BatchableContext bc) { DateTime endTime = DateTime.now(); Long durationMs = endTime.getTime() - startTime.getTime(); System.debug('═══════════════════════════════════════════════════════════════'); System.debug('BULK CREATION COMPLETE'); System.debug('═══════════════════════════════════════════════════════════════'); System.debug('Records Created: ' + createdCount); System.debug('Duration: ' + durationMs + 'ms (' + (durationMs / 1000) + ' seconds)'); System.debug('Rate: ' + (createdCount * 1000 / durationMs) + ' records/second'); System.debug('═══════════════════════════════════════════════════════════════'); } } // Execute with: // Database.executeBatch(new BulkAccountCreator(10000), 200); // ═══════════════════════════════════════════════════════════════════════════════ // APPROACH 2: GENERATE CSV FOR BULK API IMPORT // Run this to generate CSV, then use sf data import bulk // ═══════════════════════════════════════════════════════════════════════════════ /**