description: "Generate minimal seed-data stubs for Salesforce metadata evaluation datasets in the afv-library. Use this skill to create seed-data directories containing lightweight dependency declarations (custom fields, objects, Apex class stubs) that a dataset's gold file references. TRIGGER when: user says generate seed data, create seed-data stubs, populate seed-data, dataset dependencies, gold file dependencies, add supporting metadata for eval, or wants to set up prerequisite objects/fields for a test dataset. Also use when the user mentions seed-data, eval fixtures, stub generation, or asks to fill in the seed-data directory for any skill's tests/evals/ dataset. SKIP when: user wants to generate the gold file itself (use the domain-specific generating skill), wants to run evals (use eval runner tooling), or wants to create a new skill from scratch (use creating-sf-skill)."
Generate seed-data **stubs** — minimal supporting metadata dependencies — for evaluation datasets in the afv-library. Stubs declare the bare-minimum custom objects, fields, relationships, and Apex classes that a dataset's gold file references, just enough so the gold file can be validated in isolation.
## Scope
- **In scope**: Analyzing gold files to identify custom dependencies, generating minimal stub XML/Apex for those dependencies, validating stubs deploy successfully via dry-run, and populating the `seed-data/` directory.
- **Out of scope**: Generating the gold file itself (delegate to the domain-specific skill), creating new eval datasets or prompt.md files (delegate to `creating-sf-skill`), deploying metadata to production orgs.
---
## Required Inputs
Gather before proceeding:
- **Dataset path**: Path to a single dataset (`skills/<name>/tests/evals/<dataset>/`) or a domain path containing multiple datasets. Always ask if not provided.
- **Target org alias**: The Salesforce org alias for dry-run validation (e.g., `myDevOrg`). Ask if not provided.
Defaults unless specified:
- API version: `62.0`
- Stub style: absolute minimum elements per metadata type (see `references/stub-rules.md`)
---
## Workflow
All steps are sequential. Do not skip or reorder.
### Phase 1 — Identify and Read
1.**Identify the dataset(s)**
- If the path contains `tests/evals/<datasetName>` (or has `prompt.md` / `gold/` directly inside), treat as a single dataset.
- Otherwise, look for `tests/evals/` subdirectory. If it exists, list all subdirectories — each is a dataset. Process them all.
- If neither pattern matches, ask the user to clarify.
2.**Read the gold file(s)**
- Look for gold files in `{dataset_path}/gold/`. These are Salesforce metadata XML or Apex files.
- If gold files exist, proceed to step 3.
- If gold files do NOT exist, ask: "This dataset has no gold file. Would you like me to generate one from `prompt.md`?" If yes, read `prompt.md` and generate a plausible gold file, then proceed.
3.**Read stub generation rules** — load `references/stub-rules.md` before analyzing.
### Phase 2 — Analyze and Generate
4.**Analyze dependencies**
- Read all gold files and identify every custom dependency. Look for:
- **Custom fields** (`__c`): referenced in formulas, conditions, assignments, or relationship traversals (`__r.Name` implies a lookup `__c`)
- **Custom objects** (`__c`): any custom object the gold metadata lives on or references via lookups
- **Apex classes**: parent classes, interfaces, or utility classes referenced by gold code
- For each dependency, determine: metadata type, correct API name, minimum required attributes.
- Standard Salesforce objects (Account, Contact, Case, etc.) and their standard fields do NOT need stubs.
5.**Generate stubs**
- Create the `seed-data/` directory structure following the rules in `references/stub-rules.md`.
- Include ONLY the minimum elements per metadata type — no optional attributes.
- For picklists: only include values explicitly referenced in the gold file.
6.**Compare against example** — verify output matches patterns in `examples/stub-examples.md`.
### Phase 3 — Validate
7.**Validate with dry-run deployment**
- Create a temporary SFDX project:
```bash
cd /tmp && sf project generate --name seed-data-validation-$(date +%s) --template empty
```
- Read the temp project's `sfdx-project.json` to resolve the deploy path — do not hardcode `force-app/main/default/`. Extract `packageDirectories[].path` (use the entry with `"default": true`; if none, use the first entry).
- Copy seed-data and gold files into the resolved deploy path: