forcedotcom/sf-skills / skills/crm-analytics-wave-generate
crm-analytics-wave-generate
VerifiedUse to build a Wave Recipe, deploy a CRM Analytics dataset or dashboard, or author the full CRMA asset stack — apps, Wave Recipes (.wdpr), datasets, and dashboards — against a connected Salesforce org via REST and Metadata APIs, without CRM Analytics Studio or Dashboard Builder. TRIGGER when: user asks to build or create a Wave Recipe, generate a .wdpr or .wdpr-meta.xml, deploy a .wdash or .wapp, run a recipe or dataflowjob programmatically, upload CSV data via InsightsExternalData, validate a dataset schema with synthetic data, fetch dataset XMD, audit dashboard SAQL re-encoding, or find unused dataset fields. TRIGGER on keywords: Wave Recipe, CRMA, CRM Analytics, wdpr, wdash, wapp, WaveRecipe, Wave dataflow, dataflowjob, InsightsExternalData, SAQL, dataset XMD, Analytics Studio, R3 format, wave/recipes, wave/dashboards, or analytics on Salesforce objects (opportunities, leads, cases, accounts, sales). DO NOT TRIGGER for standard Salesforce reports or LWC components unrelated to CRM Analytics.
references/dataset-hygiene.md
View on GitHub# Dataset Hygiene and Dashboard Auditing
## Finding unused dataset fields
Run `scripts/find_unused_dataset_fields.js <alias> <DatasetName>`. It:
1. Resolves the dataset → fetches its main XMD → enumerates `dimensions ∪ measures ∪ dates` → set of canonical field names.
2. Pages through `GET /wave/dashboards?pageSize=200`.
3. For each dashboard, `GET /wave/dashboards/{id}` → concatenates every `state.steps[*].query`.
4. Keeps only dashboards whose SAQL contains `load "<DatasetName>"` (tolerates `"` HTML-encoded form).
5. Extracts every single-quoted token from SAQL, intersects with the field-name set.
6. Outputs the unused set.
**Caveats:**
- Compound steps referencing fields with the same name across multiple datasets will look "used" against any dataset with a matching field name.
- Aggregateflex steps store column references in a structured `columns` block, not in a SAQL `query`. The scanner only handles SAQL steps — extend the extractor for `state.steps[*].columns[*].field` if needed.
- Dashboards in retired/archived apps still count as "users" unless you filter by folder.
## Finding where a field is used
Same scanner, inverted: for a single field name, list every (dashboard, step) whose SAQL token set contains it. Adapt `find_unused_dataset_fields.js` — replace the field-set intersection with a single-field membership test.
## Detecting SAQL re-encoding decay
Dashboards edited via PATCH without first decoding SAQL accumulate `&quot;`, `&amp;quot;`, etc. Detection: GET every dashboard in the target app, count occurrences of the substring `&` in each `state.steps[*].query`. Anything > 0 means at least one extra encoding layer. (Single-level `"` is normal and expected.)
Fix: apply the `decodeAll` helper from `references/dashboard-authoring.md` to every affected step's query, then PATCH the dashboard with the decoded state.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |