
Using Ui Bundle Salesforce Data
Wire Salesforce UI bundles and GraphQL schema lookups so your agent builds correct queries, filters, and mutations against org data.
Overview
Using UI Bundle Salesforce Data is an agent skill for the Build phase that helps solo builders connect Salesforce UI bundles to org data using schema.graphql types, filters, and mutation inputs.
Install
npx skills add https://github.com/forcedotcom/afv-library --skill using-ui-bundle-salesforce-dataWhat is this skill?
- Guides UI-bundle patterns for reading and mutating Salesforce records through GraphQL-aligned types
- Pairs with graphql-search.sh to dump seven sections per entity: type, filter, orderBy, create/update inputs and represen
- Documents how to run schema lookups from the SFDX project root or a custom path via -s/--schema
- Helps solo builders avoid wrong field names and mutation shapes before wiring LWC or Aura data layers
- graphql-search.sh outputs 7 sections per entity (type, filter, orderBy, create/update inputs and representations)
Adoption & trust: 1.3k installs on skills.sh; 513 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are building a Salesforce UI bundle but keep guessing field names, filter inputs, and create/update mutation shapes without a reliable schema reference.
Who is it for?
Solo builders on SFDX who need Lightning or bundled UIs backed by verified GraphQL schema sections for Account, Contact, Opportunity, or custom objects.
Skip if: Teams not on Salesforce, pure marketing sites with no org data, or apps that only need one-off REST calls with no UI bundle or schema.graphql in the repo.
When should I use this skill?
When implementing or refactoring a Salesforce UI bundle that reads or writes org data and you have or can generate schema.graphql in an SFDX project.
What do I get? / Deliverables
After the skill runs, your agent produces GraphQL-aligned queries and mutations and uses schema search to verify entities before you wire the UI bundle data layer.
- GraphQL query and mutation patterns aligned to schema types for target entities
- Verified field, filter, and sort inputs from schema search before UI implementation
Recommended Skills
Journey fit
Connecting Lightning or bundled UIs to live Salesforce objects is core product construction, not launch or ops tuning. The skill centers on CRM data contracts—schema.graphql, filters, and CRUD representations—not generic frontend styling alone.
How it compares
Use instead of ad-hoc SOQL or copied GraphQL snippets when your source of truth should be the generated schema.graphql in the SFDX project.
Common Questions / FAQ
Who is using-ui-bundle-salesforce-data for?
It is for solo and indie developers building Salesforce experiences who want agent guidance on UI bundles and GraphQL-backed data access from an SFDX project.
When should I use using-ui-bundle-salesforce-data?
Use it in the Build phase while integrating CRM data into UI bundles—after you have schema.graphql locally and before you finalize list views, filters, or create/update flows in Lightning components.
Is using-ui-bundle-salesforce-data safe to install?
Treat it like any third-party agent skill: review the Security Audits panel on this Prism page and confirm what repo scripts and org access your workflow requires before running against production data.
SKILL.md
READMESKILL.md - Using Ui Bundle Salesforce Data
#!/usr/bin/env bash set -euo pipefail # exit on error (-e), undefined vars (-u), and propagate pipeline failures (-o pipefail) # graphql-search.sh — Look up one or more Salesforce entities in schema.graphql. # # Run from the SFDX project root (where schema.graphql lives): # bash scripts/graphql-search.sh Account # bash scripts/graphql-search.sh Account Contact Opportunity # # Pass a custom schema path with -s / --schema: # bash scripts/graphql-search.sh -s /path/to/schema.graphql Account # bash scripts/graphql-search.sh --schema ./other/schema.graphql Account Contact # # Output sections per entity: # 1. Type definition — all fields and relationships # 2. Filter options — <Entity>_Filter input (for `where:`) # 3. Sort options — <Entity>_OrderBy input (for `orderBy:`) # 4. Create mutation wrapper — <Entity>CreateInput # 5. Create mutation fields — <Entity>CreateRepresentation (for create mutations) # 6. Update mutation wrapper — <Entity>UpdateInput # 7. Update mutation fields — <Entity>UpdateRepresentation (for update mutations) SCHEMA="./schema.graphql" # ── Argument parsing ───────────────────────────────────────────────────────── while [[ $# -gt 0 ]]; do case "$1" in -s|--schema) if [[ -z "${2-}" || "$2" == -* ]]; then echo "ERROR: --schema requires a file path argument" exit 1 fi SCHEMA="$2" shift 2 ;; --) shift break ;; -*) echo "ERROR: Unknown option: $1" echo "Usage: bash $0 [-s <schema-path>] <EntityName> [EntityName2 ...]" exit 1 ;; *) break ;; esac done if [ $# -eq 0 ]; then echo "Usage: bash $0 [-s <schema-path>] <EntityName> [EntityName2 ...]" echo "Example: bash $0 Account" echo "Example: bash $0 Account Contact Opportunity" echo "Example: bash $0 --schema /path/to/schema.graphql Account" exit 1 fi if [ ! -f "$SCHEMA" ]; then echo "ERROR: schema.graphql not found at $SCHEMA" echo " Make sure you are running from the SFDX project root, or pass the path explicitly:" echo " bash $0 --schema <path/to/schema.graphql> <EntityName>" echo " If the file is missing entirely, generate it from the UI bundle dir:" echo " cd force-app/main/default/uiBundles/<app-name> && npm run graphql:schema" exit 1 fi if [ ! -r "$SCHEMA" ]; then echo "ERROR: schema.graphql is not readable at $SCHEMA" echo " Check file permissions: ls -la $SCHEMA" exit 1 fi if [ ! -s "$SCHEMA" ]; then echo "ERROR: schema.graphql is empty at $SCHEMA" echo " Regenerate it from the UI bundle dir:" echo " cd force-app/main/default/uiBundles/<app-name> && npm run graphql:schema" exit 1 fi # ── Helper: extract lines from a grep match through the closing brace ──────── # Prints up to MAX_LINES lines after (and including) the first match of PATTERN. # Uses a generous line count — blocks are always closed by a "}" line. extract_block() { local label="$1" local pattern="$2" local max_lines="$3" local match local grep_exit=0 match=$(grep -nE "$pattern" "$SCHEMA" | head -1) || grep_exit=$? if [ "$grep_exit" -eq 2 ]; then echo " ERROR: grep failed on pattern: $pattern" >&2 return 1 fi if [ -z "$match" ]; then echo " (not found: $pattern)" return 3 fi echo "### $label" grep -E "$pattern" "$SCHEMA" -A "$max_lines" | \ awk '/^\}$/{print; exit} {print}' | \ head -n "$max_lines" || true echo "" } # ── Main loop ──────────────────────────────────────────────────────────────── for ENTITY in "$@"; do # Validate entity name: must be a valid PascalCase identifier (letters, digits, underscores) if [[ ! "$ENTITY" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then echo "ERROR: Invalid entity name: '$ENTITY'" echo " Entity names must start with a letter or underscore, followed by letters, digits, or underscores." echo " Examples: Account, My_Custom_Object__c" continue fi echo "" ech